Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

239
Visualizações
Nginx Gunicon Dash (Flask) App seems to cache results somewhere (where??)

I set up a dash app to visualize the development of COVID-19 Infections in Germany over time on a Google virtual machine running Ubuntu 18.04.

The app is based on three docker container:

  1. The app itself served by gunicorn (on Port 5000)
  2. NGINX container (does the translation from 80 -> 443 -> 5000)
  3. Certbot container (to acquire and renew SSL certificates)

Now my problem is, no matter what I do, the app I get served is a fairly outdated version of the app (data exactly as when I first deployed it. Up until March 28). I tried changing the source data to include newer, but also to include fewer data and did not see any change whatsoever. I also tried changing the Nginx-settings around proxy_buffers, proxy_buffer_size, proxy_buffering, but to no avail.

This leads me to believe that I am getting served a cached app. I tried different browser/machines/devices which leads me to believe that the caching happens server-side.

I am not very familiar with Nginx nor Gunicorn nor Dash for that matter. But what I find very strange is that the results seemed to be cashed, even after docker-compose up and down multiple times.

What am I missing here?

Find the repo here:

based on the following docker-compose file:

version: '3.7'

services:
  web:
    build: ./services/web
    command: gunicorn --bind 0.0.0.0:5000 wsgi:app
    expose:
      - 5000

  nginx:
    image: nginx:1.17-alpine
    restart: unless-stopped
    volumes:
      - ./data/nginx:/etc/nginx/conf.d
      - ./data/certbot/conf:/etc/letsencrypt
      - ./data/certbot/www:/var/www/certbot
    ports:
      - "80:80"
      - "443:443"
    depends_on:
      - web
    command: "/bin/sh -c 'while :; do sleep 6h & wait $${!}; nginx -s reload; done & nginx -g \"daemon off;\"'"

  certbot:
    image: certbot/certbot
    restart: unless-stopped
    volumes:
      - ./data/certbot/conf:/etc/letsencrypt
      - ./data/certbot/www:/var/www/certbot
    entrypoint: "/bin/sh -c 'trap exit TERM; while :; do certbot renew; sleep 12h & wait $${!}; done;'"
over 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

0

Could be because the web Dockerfile runs a COPY command to copy in that entire directory, including data.csv.

Therefor if you place a new data.csv in that directory on the host, it would only be copied into the image if you do docker-compose build.

You could probably fix this by adding a volume mount to the web service, and place data.csv in there, allowing you to update that file on the host, then issue a docker-compose restart web.

To avoid having to issue that restart command, you'd probably have to change the way this part is coded:

def load_data():
    global data
    _ = pd.read_csv(os.path.join(os.path.dirname(__file__), '../data.csv'))
    return _

data = load_data()

Let me know if you need further advice on this.

over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda