adiciona o nginx e variáveis do ambiente ao arquivo docker compose
This commit is contained in:
@ -1,27 +1,29 @@
|
||||
version: '3.8'
|
||||
|
||||
volumes:
|
||||
diarios_oficiais_search_alems_local_postgres_data: {}
|
||||
diarios_oficiais_search_alems_local_postgres_data_backups: {}
|
||||
staticfiles:
|
||||
media:
|
||||
esdata:
|
||||
|
||||
services:
|
||||
traefik:
|
||||
image: traefik:v2.5
|
||||
env_file:
|
||||
- ./.envs/.local/.traefik
|
||||
image: traefik:v2.11
|
||||
container_name: traefik
|
||||
command:
|
||||
- --api.insecure=true
|
||||
- --providers.docker=true
|
||||
- --providers.docker.exposedbydefault=false
|
||||
- --entrypoints.web.address=:80
|
||||
# Adicionar logs para debug (opcional)
|
||||
- --log.level=INFO
|
||||
- --accesslog=true
|
||||
ports:
|
||||
- "80:80"
|
||||
- "8080:8080" # Dashboard (opcional)
|
||||
- "8080:8080" # Dashboard
|
||||
volumes:
|
||||
- /var/run/docker.sock:/var/run/docker.sock:ro
|
||||
- ./media:/app/diarios_oficiais_search_alems/media
|
||||
|
||||
django:
|
||||
build:
|
||||
@ -38,11 +40,15 @@ services:
|
||||
env_file:
|
||||
- ./.envs/.local/.django
|
||||
- ./.envs/.local/.postgres
|
||||
- ./.envs/.local/.traefik
|
||||
labels:
|
||||
- "traefik.enable=true"
|
||||
- "traefik.http.routers.django.rule=Host(`192.168.235.234`)"
|
||||
# Rota principal - captura tudo exceto /media/ e /static/
|
||||
- "traefik.http.routers.django.rule=Host(`${TRAEFIK_HOST}`) && !PathPrefix(`/media/`) && !PathPrefix(`/static/`)"
|
||||
- "traefik.http.routers.django.entrypoints=web"
|
||||
- "traefik.http.services.django.loadbalancer.server.port=8000"
|
||||
# Prioridade maior para ser avaliada primeiro
|
||||
- "traefik.http.routers.django.priority=100"
|
||||
ports:
|
||||
- '8000:8000'
|
||||
command: /start
|
||||
@ -67,3 +73,17 @@ services:
|
||||
- "ES_JAVA_OPTS=-Xms1g -Xmx1g"
|
||||
volumes:
|
||||
- esdata:/usr/share/elasticsearch/data
|
||||
|
||||
media-server:
|
||||
image: nginx:alpine
|
||||
volumes:
|
||||
- media:/usr/share/nginx/html/media:ro
|
||||
- staticfiles:/usr/share/nginx/html/static:ro
|
||||
labels:
|
||||
- "traefik.enable=true"
|
||||
# Rota específica para arquivos estáticos e media
|
||||
- "traefik.http.routers.media.rule=Host(`${TRAEFIK_HOST}`) && (PathPrefix(`/media/`) || PathPrefix(`/static/`))"
|
||||
- "traefik.http.routers.media.entrypoints=web"
|
||||
- "traefik.http.services.media.loadbalancer.server.port=80"
|
||||
# Prioridade menor para ser avaliada depois
|
||||
- "traefik.http.routers.media.priority=200"
|
||||
|
||||
Reference in New Issue
Block a user