Different little optimations

This commit is contained in:
Kevin Veen-Birkenbach 2025-07-17 04:23:05 +02:00
parent 1bdfb71f2f
commit bfc42ce2ac
No known key found for this signature in database
GPG Key ID: 44D8F11FD62F878E
13 changed files with 22 additions and 21 deletions

View File

@ -1,6 +1,6 @@
# Helper variables # Helper variables
_database_id: "svc-db-{{ database_type }}" _database_id: "svc-db-{{ database_type }}"
_database_central_name: "applications | get_app_conf( _database_id, 'docker.services.' ~ database_type ~ '.name')" _database_central_name: "{{ applications | get_app_conf( _database_id, 'docker.services.' ~ database_type ~ '.name') }}"
_database_central_user: "{{ database_type }}" _database_central_user: "{{ database_type }}"
# Definition # Definition

View File

@ -9,7 +9,7 @@ networks:
applications | get_app_conf(application_id, 'features.ldap', False) and applications | get_app_conf(application_id, 'features.ldap', False) and
applications | get_app_conf('svc-db-openldap', 'network.docker', False) applications | get_app_conf('svc-db-openldap', 'network.docker', False)
%} %}
svc-db-openldap: {{ applications | get_app_conf('svc-db-openldap', 'docker.network') }}:
external: true external: true
{% endif %} {% endif %}
{% if application_id != 'svc-db-openldap' %} {% if application_id != 'svc-db-openldap' %}

View File

@ -4,7 +4,9 @@
{{ applications | get_app_conf('svc-db-' ~ database_type, 'docker.network') }}: {{ applications | get_app_conf('svc-db-' ~ database_type, 'docker.network') }}:
{% endif %} {% endif %}
{% if applications | get_app_conf(application_id, 'features.ldap', False) and applications | get_app_conf('svc-db-openldap', 'network.docker') %} {% if applications | get_app_conf(application_id, 'features.ldap', False) and applications | get_app_conf('svc-db-openldap', 'network.docker') %}
svc-db-openldap: {{ applications | get_app_conf('svc-db-openldap', 'docker.network') }}:
{% endif %} {% endif %}
{% if application_id != 'svc-db-openldap' %}
default: default:
{% endif %}
{{ "\n" }} {{ "\n" }}

View File

@ -41,9 +41,8 @@
name: "{{ mariadb_name }}" name: "{{ mariadb_name }}"
register: db_info register: db_info
until: until:
- db_info.containers is defined - db_info.container is defined
- db_info.containers | length > 0 - db_info.container.State.Health.Status == "healthy"
- db_info.containers[0].State.Health.Status == "healthy"
retries: 30 retries: 30
delay: 5 delay: 5
when: when:

View File

@ -2,7 +2,7 @@ application_id: svc-db-mariadb
mariadb_root_pwd: "{{ applications | get_app_conf(application_id,'credentials.root_password', True) }}" mariadb_root_pwd: "{{ applications | get_app_conf(application_id,'credentials.root_password', True) }}"
mariadb_init: "{{ database_username is defined and database_password is defined and database_name is defined }}" mariadb_init: "{{ database_username is defined and database_password is defined and database_name is defined }}"
mariadb_subnet: "{{ networks.local['svc-db-mariadb'].subnet }}" mariadb_subnet: "{{ networks.local['svc-db-mariadb'].subnet }}"
mariadb_network_name: "{{ applications | get_app_conf(application_id,'network', True) }}" mariadb_network_name: "{{ applications | get_app_conf(application_id,'docker.network', True) }}"
mariadb_volume: "{{ applications | get_app_conf(application_id,'docker.volumes.data', True) }}" mariadb_volume: "{{ applications | get_app_conf(application_id,'docker.volumes.data', True) }}"
mariadb_image: "{{ applications | get_app_conf(application_id,'docker.services.mariadb.image','mariadb', True) }}" mariadb_image: "{{ applications | get_app_conf(application_id,'docker.services.mariadb.image','mariadb', True) }}"
mariadb_version: "{{ applications | get_app_conf(application_id,'docker.services.mariadb.version', True) }}" mariadb_version: "{{ applications | get_app_conf(application_id,'docker.services.mariadb.version', True) }}"

View File

@ -19,7 +19,7 @@
- name: create docker network for LDAP, so that other applications can access it - name: create docker network for LDAP, so that other applications can access it
docker_network: docker_network:
name: "{{ applications | get_app_conf(application_id, 'network', True) }}" name: "{{ openldap_network }}"
state: present state: present
ipam_config: ipam_config:
- subnet: "{{ networks.local[application_id].subnet }}" - subnet: "{{ networks.local[application_id].subnet }}"

View File

@ -19,5 +19,6 @@ openldap_name: "{{ applications | get_app_conf(application_id,
openldap_image: "{{ applications | get_app_conf(application_id, 'docker.services.openldap.image', True) }}" openldap_image: "{{ applications | get_app_conf(application_id, 'docker.services.openldap.image', True) }}"
openldap_version: "{{ applications | get_app_conf(application_id, 'docker.services.openldap.version', True) }}" openldap_version: "{{ applications | get_app_conf(application_id, 'docker.services.openldap.version', True) }}"
openldap_volume: "{{ applications | get_app_conf(application_id, 'docker.volumes.data', True) }}" openldap_volume: "{{ applications | get_app_conf(application_id, 'docker.volumes.data', True) }}"
openldap_network: "{{ applications | get_app_conf(application_id, 'docker.network', True) }}"
openldap_network_expose_local: "{{ applications | get_app_conf(application_id, 'network.public', True) | bool or applications | get_app_conf(application_id, 'network.local', True) | bool }}" openldap_network_expose_local: "{{ applications | get_app_conf(application_id, 'network.public', True) | bool or applications | get_app_conf(application_id, 'network.local', True) | bool }}"

View File

@ -3,7 +3,7 @@ postgres_volume: "{{ applications | get_app_conf(application_id, 'docker.
postgres_name: "{{ applications | get_app_conf(application_id, 'docker.services.postgres.name', True) }}" postgres_name: "{{ applications | get_app_conf(application_id, 'docker.services.postgres.name', True) }}"
postgres_image: "{{ applications | get_app_conf(application_id, 'docker.services.postgres.image', True) }}" postgres_image: "{{ applications | get_app_conf(application_id, 'docker.services.postgres.image', True) }}"
postgres_subnet: "{{ networks.local['svc-db-postgres'].subnet }}" postgres_subnet: "{{ networks.local['svc-db-postgres'].subnet }}"
postgres_network_name: "{{ applications | get_app_conf(application_id, 'network', True) }}" postgres_network_name: "{{ applications | get_app_conf(application_id, 'docker.network', True) }}"
postgres_version: "{{ applications | get_app_conf(application_id, 'docker.services.postgres.version', True) }}" postgres_version: "{{ applications | get_app_conf(application_id, 'docker.services.postgres.version', True) }}"
postgres_password: "{{ applications | get_app_conf(application_id, 'credentials.postgres_password', True) }}" postgres_password: "{{ applications | get_app_conf(application_id, 'credentials.postgres_password', True) }}"
postgres_port: "{{ database_port | default(ports.localhost.database[ application_id ]) }}" postgres_port: "{{ database_port | default(ports.localhost.database[ application_id ]) }}"

View File

@ -15,7 +15,7 @@ def get_expected_statuses(domain: str, parts: list[str], redirected_domains: set
Returns: Returns:
A list of expected HTTP status codes. A list of expected HTTP status codes.
""" """
if domain == '{{domains | get_domain('listmonk')}}': if domain == '{{domains | get_domain('web-app-listmonk')}}':
return [404] return [404]
if (parts and parts[0] == 'www') or (domain in redirected_domains): if (parts and parts[0] == 'www') or (domain in redirected_domains):
return [301] return [301]

View File

@ -1,6 +1,6 @@
application_id: "web-app-akaunting" application_id: "web-app-akaunting"
database_type: "mariadb" database_type: "mariadb"
database_password: "applications | get_app_conf(application_id, 'credentials.database_password', True)" database_password: "{{ applications | get_app_conf(application_id, 'credentials.database_password', True) }}"
docker_repository_address: "https://github.com/akaunting/docker.git" docker_repository_address: "https://github.com/akaunting/docker.git"
akaunting_version: "{{ applications | get_app_conf(application_id, 'docker.services.akaunting.version', True) }}" akaunting_version: "{{ applications | get_app_conf(application_id, 'docker.services.akaunting.version', True) }}"
akaunting_image: "{{ applications | get_app_conf(application_id, 'docker.services.akaunting.image', True) }}" akaunting_image: "{{ applications | get_app_conf(application_id, 'docker.services.akaunting.image', True) }}"

View File

@ -37,8 +37,3 @@
token_auth: "{{ matomo_auth_token }}" token_auth: "{{ matomo_auth_token }}"
return_content: yes return_content: yes
status_code: 200 status_code: 200
- name: run the docker matomo tasks once
set_fact:
run_once_web_app_matomo: true
when: run_once_web_app_matomo is not defined

View File

@ -3,3 +3,7 @@
include_tasks: constructor.yml include_tasks: constructor.yml
when: run_once_web_app_matomo is not defined when: run_once_web_app_matomo is not defined
- name: run the docker matomo tasks once
set_fact:
run_once_web_app_matomo: true
when: run_once_web_app_matomo is not defined