computer-playbook/templates/docker/services/postgres.yml.j2

24 lines
792 B
Plaintext
Raw Normal View History

# This template needs to be included in docker-compose.yml, which depend on a postgres database
2024-01-03 12:07:19 +01:00
{% if not enable_central_database | bool %}
2023-12-28 00:28:30 +01:00
database:
image: postgres:{{database_version}}-alpine
2024-01-09 18:16:53 +01:00
container_name: {{docker_compose_project_name}}-database
2023-12-28 00:28:30 +01:00
environment:
- POSTGRES_PASSWORD={{database_password}}
- POSTGRES_USER={{database_username}}
2024-01-06 14:32:49 +01:00
- POSTGRES_DB={{database_name}}
2024-01-08 20:45:23 +01:00
- POSTGRES_INITDB_ARGS=--encoding=UTF8 --locale=C
restart: {{docker_restart_policy}}
2023-12-28 00:28:30 +01:00
healthcheck:
2024-01-06 14:32:49 +01:00
test: ["CMD-SHELL", "pg_isready -U {{database_name}}"]
2023-12-28 00:28:30 +01:00
interval: 10s
timeout: 5s
retries: 6
volumes:
- type: volume
2023-12-28 00:28:30 +01:00
source: database
target: /var/lib/postgresql/data
networks:
2024-01-05 20:22:34 +01:00
- default
{% endif %}
2024-01-04 11:36:55 +01:00
{{ "\n" }}