Shared volume between api and nginx
drdraxi
PROOP

8 months ago

I have an API with a Postgres db and Nginx as reverse proxy.

It's a repo with docker compose file that spins up the db and nginx and api gets built using Dockerfile from python scripts.
The DB has a notification that triggers the API and the API generates a bunch of file that I want publicly available. I wanted to use NGINX since I encountered some bottlenecks with gunicorn before.
Is there any way to point the nginx to the volume the API has attached to it or should I just straight up not use nginx and make a route in flask and hope it work.

services:
  nginx:
    image: nginx:alpine
    ports:
      - "80:80"
    depends_on:
      - api
    volumes:
      - ./nginx.conf:/etc/nginx/nginx.conf:ro
      - ./cache:/app/cache:ro
    restart: always

  api:
    build: .
    expose:
      - "5000"
    depends_on:
      - db
    environment:
      - DATABASE_URL=postgresql://postgres:postgres@db:5432/mt_community
      - SECRET_KEY=secret_key
      - GUNICORN_WORKERS=1
      - GUNICORN_WORKER_CONNECTIONS=2000
    volumes:
      - ./:/app
    restart: always

  db:
    image: postgres:15
    volumes:
      - postgres_data:/var/lib/postgresql/data
    environment:
      - POSTGRES_PASSWORD=postgres
      - POSTGRES_USER=postgres
      - POSTGRES_DB=mt_community
    ports:
      - "5432:5432"
    restart: always

volumes:
  postgres_data: 
Solved

4 Replies

drdraxi
PROOP

8 months ago

ce426a01-477d-461d-86e3-7105d9e4fc59


medim
MODERATOR

8 months ago

Hi! shared volumes are not possible at the moment


drdraxi
PROOP

8 months ago

Oh okay. Thanks


medim
MODERATOR

8 months ago

!s


Status changed to Solved medim 8 months ago


Loading...