From c6cd6430bb32dbac17001781bf77073803d5919b Mon Sep 17 00:00:00 2001 From: Kevin Veen-Birkenbach Date: Wed, 27 Aug 2025 21:00:08 +0200 Subject: [PATCH] Refactor Joomla role to new docker.* schema - Move image definition from images.joomla to docker.services.joomla - Add container name, container_port variable, and healthcheck - Introduce JOOMLA_IMAGE, JOOMLA_VERSION, JOOMLA_CONTAINER, JOOMLA_VOLUME in vars - Use volume mapping via docker.volumes.data See: https://chatgpt.com/share/68af55a9-6514-800f-b6f7-1dc86356936e --- roles/web-app-joomla/config/main.yml | 8 ++++++-- roles/web-app-joomla/templates/docker-compose.yml.j2 | 7 +++++-- roles/web-app-joomla/vars/main.yml | 10 +++++++++- 3 files changed, 20 insertions(+), 5 deletions(-) diff --git a/roles/web-app-joomla/config/main.yml b/roles/web-app-joomla/config/main.yml index 9df49d47..b84d8913 100644 --- a/roles/web-app-joomla/config/main.yml +++ b/roles/web-app-joomla/config/main.yml @@ -1,5 +1,3 @@ -images: - joomla: "joomla:latest" features: matomo: true css: true @@ -14,3 +12,9 @@ docker: services: database: enabled: true + joomla: + image: joomla + version: latest + name: joomla + volumes: + data: "joomla_data" diff --git a/roles/web-app-joomla/templates/docker-compose.yml.j2 b/roles/web-app-joomla/templates/docker-compose.yml.j2 index 0c20c692..05f9f939 100644 --- a/roles/web-app-joomla/templates/docker-compose.yml.j2 +++ b/roles/web-app-joomla/templates/docker-compose.yml.j2 @@ -1,15 +1,18 @@ {% include 'roles/docker-compose/templates/base.yml.j2' %} application: - image: "{{ applications | get_app_conf(application_id, 'images.joomla', True) }}" + image: "{{ JOOMLA_IMAGE }}:{{ JOOMLA_VERSION }}" + container_name: "{{ JOOMLA_CONTAINER }}" {% include 'roles/docker-container/templates/base.yml.j2' %} volumes: - data:/var/www/html ports: - - "127.0.0.1:{{ ports.localhost.http[application_id] }}:80" + - "127.0.0.1:{{ ports.localhost.http[application_id] }}:{{ container_port }}" +{% include 'roles/docker-container/templates/healthcheck/curl.yml.j2' %} {% include 'roles/docker-container/templates/networks.yml.j2' %} {% include 'roles/docker-container/templates/depends_on/dmbs_excl.yml.j2' %} {% include 'roles/docker-compose/templates/volumes.yml.j2' %} data: + name: {{ JOOMLA_VOLUME }} {% include 'roles/docker-compose/templates/networks.yml.j2' %} diff --git a/roles/web-app-joomla/vars/main.yml b/roles/web-app-joomla/vars/main.yml index 5d6dc4ae..fecd0c05 100644 --- a/roles/web-app-joomla/vars/main.yml +++ b/roles/web-app-joomla/vars/main.yml @@ -1,2 +1,10 @@ +# General application_id: "web-app-joomla" -database_type: "postgres" \ No newline at end of file +database_type: "postgres" +container_port: 80 + +# Joomla +JOOMLA_VERSION: "{{ applications | get_app_conf(application_id, 'docker.services.joomla.version') }}" +JOOMLA_IMAGE: "{{ applications | get_app_conf(application_id, 'docker.services.joomla.image') }}" +JOOMLA_CONTAINER: "{{ applications | get_app_conf(application_id, 'docker.services.joomla.name') }}" +JOOMLA_VOLUME: "{{ applications | get_app_conf(application_id, 'docker.volumes.data') }}" \ No newline at end of file