mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2025-08-29 15:06:26 +02:00
Implemented helper role docker-central-database and refactored code
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
# This template needs to be included in docker-compose.yml, which depend on a mariadb database
|
||||
{% if not enable_central_database | bool %}
|
||||
database:
|
||||
container_name: {{application_id}}-database
|
||||
logging:
|
||||
driver: journald
|
||||
image: mariadb
|
||||
restart: {{docker_restart_policy}}
|
||||
env_file:
|
||||
- mein_env_file.env
|
||||
command: "--transaction-isolation=READ-COMMITTED --binlog-format=ROW"
|
||||
volumes:
|
||||
- database:/var/lib/mysql
|
||||
healthcheck:
|
||||
test: "/usr/bin/mariadb --user={{database_username}} --password={{database_password}} --execute \"SHOW DATABASES;\""
|
||||
interval: 3s
|
||||
timeout: 1s
|
||||
retries: 5
|
||||
networks:
|
||||
- default
|
||||
{% endif %}
|
||||
{{ "\n" }}
|
@@ -0,0 +1,21 @@
|
||||
# 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:{{applications.postgres.database_version}}-alpine
|
||||
container_name: {{application_id}}-database
|
||||
env_file:
|
||||
- {{database_env}}
|
||||
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" }}
|
Reference in New Issue
Block a user