Replaced enable_central_database by configuration in application

This commit is contained in:
2025-02-21 05:06:39 +01:00
parent b6eb866b36
commit 9f41e25166
22 changed files with 84 additions and 43 deletions

View File

@@ -47,7 +47,7 @@ When executed, the role will:
1. Load database configuration variables.
2. Generate the appropriate environment file for the database.
3. Incorporate the Docker Compose routines.
4. Create a central database if `enable_central_database` is set to `true`.
4. Create a central database if `applications[application_id].database.central_storage` is set to `true`.
---

View File

@@ -14,9 +14,9 @@
src: "env/{{database_type}}.env.j2"
dest: "{{database_env}}"
notify: docker compose project build and setup
when: not enable_central_database | bool
when: not applications[application_id].database.central_storage | bool
- name: create central database
include_role:
name: "docker-{{database_type}}"
when: enable_central_database | bool
when: applications[application_id].database.central_storage | bool

View File

@@ -1,5 +1,5 @@
# This template needs to be included in docker-compose.yml, which depend on a mariadb database
{% if not enable_central_database | bool %}
{% if not applications[application_id].database.central_storage | bool %}
database:
container_name: {{application_id}}-database
logging:

View File

@@ -1,5 +1,5 @@
# This template needs to be included in docker-compose.yml, which depend on a postgres database
{% if not enable_central_database | bool %}
{% if not applications[application_id].database.central_storage | bool %}
database:
image: postgres:{{applications.postgres.database_version}}-alpine
container_name: {{application_id}}-database

View File

@@ -1,5 +1,5 @@
database_instance: "{{ 'central-' + database_type if enable_central_database | bool else application_id }}"
database_host: "{{ 'central-' + database_type if enable_central_database | bool else 'database' }}"
database_instance: "{{ 'central-' + database_type if applications[application_id].database.central_storage | bool else application_id }}"
database_host: "{{ 'central-' + database_type if applications[application_id].database.central_storage | bool else 'database' }}"
database_name: "{{ application_id }}"
database_username: "{{ application_id }}"
database_port: "{{ 3306 if database_type == 'mariadb' else 5432 }}"