mirror of
https://github.com/seanmorley15/AdventureLog.git
synced 2025-08-06 05:35:19 +02:00
Change docker compose env vars
Previously, each container would be handed all the env vars int the .env file. This is bad practice for a variety of reasons. This commit changes it so the docker compose file specified the env file for each container. the benefits: - less env vars to be set by the end user - containers are only given vars relevant to them - when running docker compose up, only containers affected by changed vars are restarted
This commit is contained in:
parent
cadea118d3
commit
6626cd90ec
2 changed files with 31 additions and 14 deletions
15
.env.example
15
.env.example
|
@ -1,11 +1,9 @@
|
||||||
# 🌐 Frontend
|
# 🌐 Frontend
|
||||||
PUBLIC_SERVER_URL=http://server:8000 # PLEASE DON'T CHANGE :) - Should be the service name of the backend with port 8000, even if you change the port in the backend service. Only change if you are using a custom more complex setup.
|
FRONTEND_URL=http://localhost:8014 # URL that is allowed to be used for accessing the frontend
|
||||||
ORIGIN=http://localhost:8015
|
|
||||||
BODY_SIZE_LIMIT=Infinity
|
BODY_SIZE_LIMIT=Infinity
|
||||||
FRONTEND_PORT=8015
|
FRONTEND_PORT=8014 # port used in the internal network (outside docker)
|
||||||
|
|
||||||
# 🐘 PostgreSQL Database
|
# 🐘 PostgreSQL Database
|
||||||
PGHOST=db
|
|
||||||
POSTGRES_DB=database
|
POSTGRES_DB=database
|
||||||
POSTGRES_USER=adventure
|
POSTGRES_USER=adventure
|
||||||
POSTGRES_PASSWORD=changeme123
|
POSTGRES_PASSWORD=changeme123
|
||||||
|
@ -15,11 +13,8 @@ SECRET_KEY=changeme123
|
||||||
DJANGO_ADMIN_USERNAME=admin
|
DJANGO_ADMIN_USERNAME=admin
|
||||||
DJANGO_ADMIN_PASSWORD=admin
|
DJANGO_ADMIN_PASSWORD=admin
|
||||||
DJANGO_ADMIN_EMAIL=admin@example.com
|
DJANGO_ADMIN_EMAIL=admin@example.com
|
||||||
PUBLIC_URL=http://localhost:8016 # Match the outward port, used for the creation of image urls
|
BACKEND_URL=http://localhost:8017 # URL that is allowed to be used for accessing the backend, used for the creation of image urls
|
||||||
CSRF_TRUSTED_ORIGINS=http://localhost:8016,http://localhost:8015
|
BACKEND_PORT=8017 # port exposed to the internal network (outside docker)
|
||||||
DEBUG=False
|
|
||||||
FRONTEND_URL=http://localhost:8015 # Used for email generation. This should be the url of the frontend
|
|
||||||
BACKEND_PORT=8016
|
|
||||||
|
|
||||||
# Optional: use Google Maps integration
|
# Optional: use Google Maps integration
|
||||||
# https://adventurelog.app/docs/configuration/google_maps_integration.html
|
# https://adventurelog.app/docs/configuration/google_maps_integration.html
|
||||||
|
@ -44,4 +39,4 @@ DISABLE_REGISTRATION=False
|
||||||
# Optional: Use Umami for analytics
|
# Optional: Use Umami for analytics
|
||||||
# https://adventurelog.app/docs/configuration/analytics.html
|
# https://adventurelog.app/docs/configuration/analytics.html
|
||||||
# PUBLIC_UMAMI_SRC=https://cloud.umami.is/script.js # If you are using the hosted version of Umami
|
# PUBLIC_UMAMI_SRC=https://cloud.umami.is/script.js # If you are using the hosted version of Umami
|
||||||
# PUBLIC_UMAMI_WEBSITE_ID=
|
# PUBLIC_UMAMI_WEBSITE_ID=
|
||||||
|
|
|
@ -4,7 +4,11 @@ services:
|
||||||
image: ghcr.io/seanmorley15/adventurelog-frontend:latest
|
image: ghcr.io/seanmorley15/adventurelog-frontend:latest
|
||||||
container_name: adventurelog-frontend
|
container_name: adventurelog-frontend
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
env_file: .env
|
environment:
|
||||||
|
- PUBLIC_SERVER_URL=http://server:8000 # PLEASE DON'T CHANGE :) - Should be the service name of the backend with port 8000, even if you change the port in the backend service. Only change if you are using a custom more complex setup.
|
||||||
|
- ORIGIN=${FRONTENT_URL:-http://localhost:8015}
|
||||||
|
- BODY_SIZE_LIMIT=${BODY_SIZE_LIMIT:-Infinity}
|
||||||
|
#- FRONTEND_PORT=${FRONTEND_PORT=:-8015}
|
||||||
ports:
|
ports:
|
||||||
- "${FRONTEND_PORT:-8015}:3000"
|
- "${FRONTEND_PORT:-8015}:3000"
|
||||||
depends_on:
|
depends_on:
|
||||||
|
@ -14,16 +18,34 @@ services:
|
||||||
image: postgis/postgis:16-3.5
|
image: postgis/postgis:16-3.5
|
||||||
container_name: adventurelog-db
|
container_name: adventurelog-db
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
env_file: .env
|
environment:
|
||||||
|
- POSTGRES_DB=${POSTGRES_DB:-database}
|
||||||
|
- POSTGRES_USER=${POSTGRES_USER:-adventure}
|
||||||
|
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD:-changeme123}
|
||||||
volumes:
|
volumes:
|
||||||
- postgres_data:/var/lib/postgresql/data/
|
- postgres_data:/var/lib/postgresql/data/
|
||||||
|
|
||||||
server:
|
server:
|
||||||
#build: ./backend/
|
#build: ./backend/
|
||||||
image: ghcr.io/seanmorley15/adventurelog-backend:latest
|
#image: ghcr.io/seanmorley15/adventurelog-backend:latest
|
||||||
|
image: 9f0471e8d7f872adf81dc41c9296f99fbadac01edb26e
|
||||||
container_name: adventurelog-backend
|
container_name: adventurelog-backend
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
env_file: .env
|
environment:
|
||||||
|
- PGHOST=db
|
||||||
|
- POSTGRES_DB=${POSTGRES_DB:-database}
|
||||||
|
- POSTGRES_USER=${POSTGRES_USER:-adventure}
|
||||||
|
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD:-changeme123}
|
||||||
|
- SECRET_KEY=${SECRET_KEY:-changeme123}
|
||||||
|
- DJANGO_ADMIN_USERNAME=${DJANGO_ADMIN_USERNAME:-admin}
|
||||||
|
- DJANGO_ADMIN_PASSWORD=${DJANGO_ADMIN_PASSWORD:-admin}
|
||||||
|
- DJANGO_ADMIN_EMAIL=${DJANGO_ADMIN_EMAIL:-admin@example.com}
|
||||||
|
- PUBLIC_URL=${BACKEND_URL:-http://localhost:8016}
|
||||||
|
- CSRF_TRUSTED_ORIGINS=${FRONTEND_URL:-http://localhost:8015},${BACKEND_URL:-http://localhost:8016}
|
||||||
|
- DEBUG=False
|
||||||
|
- FRONTEND_URL=${FRONTEND_URL:-http://localhost:8015} # Used for email generation. This should be the url of the frontend
|
||||||
|
- BACKEND_PORT=${BACKEND_PORT:-8016}
|
||||||
|
|
||||||
ports:
|
ports:
|
||||||
- "${BACKEND_PORT:-8016}:80"
|
- "${BACKEND_PORT:-8016}:80"
|
||||||
depends_on:
|
depends_on:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue