Use proper docker volumes in docker compose

This commit is contained in:
Timothy Hobbs 2025-01-21 20:24:35 +01:00
parent b8f4ba6d79
commit abe22b6dda
2 changed files with 34 additions and 28 deletions

View File

@ -67,11 +67,9 @@ Configuration for Production Use
1. Update the `Caddyfile` to replace the `localhost` URL with your desired production URL. 1. Update the `Caddyfile` to replace the `localhost` URL with your desired production URL.
2. Modify the `docker-compose` file to adjust the paths. By default, files are stored in `/tmp`. 2. For custom configurations, bindmount a `local_settings.py` into `/opt/django-helpdesk/standalone/config/local_settings.py`.
3. For custom configurations, bindmount a `local_settings.py` into `/opt/django-helpdesk/standalone/config/local_settings.py`. 3. To customize the logo in the top-left corner of the helpdesk:
4. To customize the logo in the top-left corner of the helpdesk:
.. code-block:: html .. code-block:: html

View File

@ -1,12 +1,20 @@
version: '2' version: '2'
# Define named volumes
volumes:
caddy_data:
caddy_config:
helpdesk_data:
postgres_data:
services: services:
caddy: caddy:
image: caddy:2 image: caddy:2
restart: unless-stopped restart: unless-stopped
volumes: volumes:
- /tmp/data/caddy/data:/data - caddy_data:/data
- /tmp/data/caddy/config:/config - caddy_config:/config
- ./Caddyfile:/etc/caddy/Caddyfile:r - ./Caddyfile:/etc/caddy/Caddyfile:ro
ports: ports:
- "80:80" - "80:80"
- "443:443" - "443:443"
@ -15,8 +23,8 @@ services:
image: djangohelpdesk/standalone image: djangohelpdesk/standalone
user: root user: root
volumes: volumes:
- /tmp/django-helpdesk-data:/data/ - helpdesk_data:/data
- ./custom_navigation_header.html:/opt/django-helpdesk/helpdesk/templates/helpdesk/custom_navigation_header.html:r - ./custom_navigation_header.html:/opt/django-helpdesk/helpdesk/templates/helpdesk/custom_navigation_header.html:ro
env_file: docker.env env_file: docker.env
depends_on: depends_on:
- postgres - postgres
@ -24,5 +32,5 @@ services:
postgres: postgres:
image: postgres:12-bullseye image: postgres:12-bullseye
volumes: volumes:
- ./db:/var/lib/postgresql/data - postgres_data:/var/lib/postgresql/data
env_file: docker.env env_file: docker.env