2024-01-03 11:38:09 +01:00
|
|
|
# This template needs to be included in docker-compose.yml, which depend on a postgres database
|
2024-01-02 21:13:34 +01:00
|
|
|
{% if not enable_central_database %}
|
2023-12-28 00:28:30 +01:00
|
|
|
database:
|
|
|
|
image: postgres:{{database_version}}-alpine
|
|
|
|
environment:
|
|
|
|
- POSTGRES_PASSWORD={{database_password}}
|
|
|
|
- POSTGRES_USER={{database_username}}
|
|
|
|
- POSTGRES_DB={{database_databasename}}
|
2023-12-31 11:14:18 +01:00
|
|
|
- POSTGRES_INITDB_ARGS="--encoding=UTF8 --locale=C"
|
2023-12-28 21:30:33 +01:00
|
|
|
restart: always
|
2023-12-28 00:28:30 +01:00
|
|
|
healthcheck:
|
2023-12-28 18:30:31 +01:00
|
|
|
test: ["CMD-SHELL", "pg_isready -U {{database_databasename}}"]
|
2023-12-28 00:28:30 +01:00
|
|
|
interval: 10s
|
|
|
|
timeout: 5s
|
|
|
|
retries: 6
|
|
|
|
volumes:
|
2024-01-02 21:13:34 +01:00
|
|
|
- type: volume
|
2023-12-28 00:28:30 +01:00
|
|
|
source: database
|
|
|
|
target: /var/lib/postgresql/data
|
2024-01-02 21:13:34 +01:00
|
|
|
networks:
|
|
|
|
- {{docker_compose_project_name}}_network
|
|
|
|
{% endif %}
|