Restructured code and matrix rol

This commit is contained in:
2024-01-19 15:12:18 +01:00
parent 0aebca62f6
commit c4209f0559
64 changed files with 249 additions and 224 deletions

View File

@@ -0,0 +1,8 @@
# This template needs to be included in docker-compose.yml
networks:
{% if enable_central_database | bool %}
central_{{ database_type }}:
external: true
{% endif %}
default:
{{ "\n" }}

View File

@@ -0,0 +1,6 @@
# This needs to be included in docker-compose.yml which just contain a database volume
{% if not enable_central_database | bool %}
volumes:
database:
{% endif %}
{{ "\n" }}

View File

@@ -0,0 +1,6 @@
# This template needs to be included in docker-compose.yml which contain a database and additional volumes
volumes:
{% if not enable_central_database | bool %}
database:
{% endif %}
{{ "\n" }}

View File

@@ -0,0 +1,7 @@
# This template needs to be included in docker-compose.yml containers which depend on a database and additional containers
depends_on:
{% if not enable_central_database | bool %}
database:
condition: service_healthy
{% endif %}
{{ "\n" }}

View File

@@ -0,0 +1,9 @@
# This template needs to be included in docker-compose.yml contaienrs, which depend on a database, redis and optional additional volumes
depends_on:
{% if not enable_central_database | bool %}
database:
condition: service_healthy
{% endif %}
redis:
condition: service_healthy
{{ "\n" }}

View File

@@ -0,0 +1,7 @@
# This template needs to be included in docker-compose.yml contaienrs, which just depend on a database
{% if not enable_central_database | bool %}
depends_on:
database:
condition: service_healthy
{% endif %}
{{ "\n" }}

View File

@@ -0,0 +1,7 @@
# This template needs to be included in docker-compose.yml containers
networks:
{% if enable_central_database | bool %}
central_{{ database_type }}:
{% endif %}
default:
{{ "\n" }}

View File

@@ -0,0 +1,26 @@
# 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: {{docker_compose_project_name}}-database
logging:
driver: journald
image: mariadb
restart: {{docker_restart_policy}}
environment:
MYSQL_DATABASE: "{{database_name}}"
MYSQL_USER: "{{database_username}}"
MYSQL_PASSWORD: "{{database_password}}"
MYSQL_ROOT_PASSWORD: "{{database_password}}"
MARIADB_AUTO_UPGRADE: "1"
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" }}

View File

@@ -0,0 +1,24 @@
# 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" }}

View File

@@ -0,0 +1,17 @@
# This template needs to be included in docker-compose.yml, which depend on redis
redis:
image: redis:alpine
container_name: {{docker_compose_project_name}}-redis
restart: {{docker_restart_policy}}
logging:
driver: journald
volumes:
- redis:/data
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 1s
timeout: 3s
retries: 30
networks:
- default
{{ "\n" }}