mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2024-11-14 17:01:05 +01:00
24 lines
792 B
Django/Jinja
24 lines
792 B
Django/Jinja
# This template needs to be included in docker-compose.yml, which depend on a postgres database
|
|
{% if not enable_central_database | bool %}
|
|
database:
|
|
image: postgres:{{database_version}}-alpine
|
|
container_name: {{docker_compose_project_name}}-database
|
|
environment:
|
|
- POSTGRES_PASSWORD={{database_password}}
|
|
- POSTGRES_USER={{database_username}}
|
|
- POSTGRES_DB={{database_name}}
|
|
- POSTGRES_INITDB_ARGS=--encoding=UTF8 --locale=C
|
|
restart: {{docker_restart_policy}}
|
|
healthcheck:
|
|
test: ["CMD-SHELL", "pg_isready -U {{database_name}}"]
|
|
interval: 10s
|
|
timeout: 5s
|
|
retries: 6
|
|
volumes:
|
|
- type: volume
|
|
source: database
|
|
target: /var/lib/postgresql/data
|
|
networks:
|
|
- default
|
|
{% endif %}
|
|
{{ "\n" }} |