Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

241
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!