Reverse proxy sample

This commit is contained in:
Luciano Gervasoni
2025-04-04 17:33:27 +02:00
parent 9127552bfd
commit 3e84fc4508
2 changed files with 20 additions and 13 deletions

View File

@@ -27,6 +27,10 @@ DEBUG = (os.environ.get('DJANGO_DEBUG') == "True")
ALLOWED_HOSTS = os.environ.get('DJANGO_ALLOWED_HOSTS', "*").split(",") ALLOWED_HOSTS = os.environ.get('DJANGO_ALLOWED_HOSTS', "*").split(",")
CSRF_TRUSTED_ORIGINS = os.environ.get('DJANGO_ALLOWED_ORIGINS', "*").split(",")
#CSRF_TRUSTED_ORIGINS = ["https://fetcher.matitos.org"]
#CSRF_ALLOWED_ORIGINS = ["https://fetcher.matitos.org"]
#CORS_ORIGINS_WHITELIST = ["https://fetcher.matitos.org"]
# Application definition # Application definition

View File

@@ -31,12 +31,13 @@ services:
restart: unless-stopped restart: unless-stopped
environment: environment:
# Initialization # Initialization
- INITIALIZE_DB=${INITIALIZE_DB:-false} # Related to DB persistence - INITIALIZE_DB=${INITIALIZE_DB:-true} # Related to DB persistence
- DJANGO_SUPERUSER_USERNAME=${DJANGO_SUPERUSER_USERNAME:-matitos} - DJANGO_SUPERUSER_USERNAME=${DJANGO_SUPERUSER_USERNAME:-matitos}
- DJANGO_SUPERUSER_PASSWORD=${DJANGO_SUPERUSER_PASSWORD:-matitos} - DJANGO_SUPERUSER_PASSWORD=${DJANGO_SUPERUSER_PASSWORD:-matitos}
- DJANGO_SUPERUSER_EMAIL=${DJANGO_SUPERUSER_EMAIL:-matitos@matitos.org} - DJANGO_SUPERUSER_EMAIL=${DJANGO_SUPERUSER_EMAIL:-matitos@matitos.org}
# Django # Django
- DJANGO_ALLOWED_HOSTS=${DJANGO_ALLOWED_HOSTS:-*} # host1,host2 - DJANGO_ALLOWED_HOSTS=${DJANGO_ALLOWED_HOSTS:-*} # host1,host2
- DJANGO_ALLOWED_ORIGINS=${ALLOWED_ORIGINS:-https://fetcher.matitos.org} # Reverse proxy
- DJANGO_SECRET_KEY=${DJANGO_SECRET_KEY:-abc123456789qwerty} - DJANGO_SECRET_KEY=${DJANGO_SECRET_KEY:-abc123456789qwerty}
- DJANGO_DEBUG=${DJANGO_DEBUG:-False} - DJANGO_DEBUG=${DJANGO_DEBUG:-False}
- PATH_LOGS_DIRECTORY=${PATH_LOGS_DIRECTORY:-/opt/logs} - PATH_LOGS_DIRECTORY=${PATH_LOGS_DIRECTORY:-/opt/logs}
@@ -59,11 +60,11 @@ services:
- SELENIUM_ENDPOINT=${SELENIUM_ENDPOINT:-http://fetcher_app_selenium:80} - SELENIUM_ENDPOINT=${SELENIUM_ENDPOINT:-http://fetcher_app_selenium:80}
- ENDPOINT_OLLAMA=${ENDPOINT_OLLAMA:-https://ollamamodel.matitos.org} - ENDPOINT_OLLAMA=${ENDPOINT_OLLAMA:-https://ollamamodel.matitos.org}
######################## ########################
volumes: # Dev mode #volumes: # Development mode
- ./app_urls:/opt/app # - ./app_urls:/opt/app
######################## ########################
ports: ports:
- 8000:8000 - 8000 # :8000
depends_on: depends_on:
- fetcher_db - fetcher_db
- fetcher_redis - fetcher_redis
@@ -75,6 +76,14 @@ services:
limits: limits:
cpus: '4' cpus: '4'
memory: 4G memory: 4G
labels: # Reverse proxy sample
- "traefik.enable=true"
- "traefik.http.routers.fetcher.rule=Host(`fetcher.matitos.org`)"
- "traefik.http.routers.fetcher.entrypoints=websecure"
- "traefik.http.routers.fetcher.tls.certresolver=myresolvercd"
networks:
- default # This network
- docker_default # Reverse proxy network
fetcher_db: fetcher_db:
image: postgres:17 image: postgres:17
@@ -99,12 +108,6 @@ services:
ports: ports:
- 6379 #:6379 - 6379 #:6379
#fetcher_dozzle: networks:
# container_name: fetcher_dozzle docker_default:
# image: amir20/dozzle:latest external: true
# volumes:
# - /var/run/docker.sock:/var/run/docker.sock:ro
# ports:
# - 8888:8080
# environment:
# - DOZZLE_FILTER="name=fetcher_"