From 4d09c1ec11c7b789f2dca7ccb108ed8d4d024072 Mon Sep 17 00:00:00 2001 From: Benjamin Bach Date: Tue, 25 Jul 2023 22:17:35 +0200 Subject: [PATCH 1/2] Update ansible task for data.coop website with new branches and docker images --- roles/docker/defaults/main.yml | 8 +++----- roles/docker/tasks/services/websites/data.coop.yml | 14 +++++++++++++- .../tasks/services/websites/new.data.coop.yml | 13 ------------- 3 files changed, 16 insertions(+), 19 deletions(-) delete mode 100644 roles/docker/tasks/services/websites/new.data.coop.yml diff --git a/roles/docker/defaults/main.yml b/roles/docker/defaults/main.yml index 1f34ddb6..6dd7b1dd 100644 --- a/roles/docker/defaults/main.yml +++ b/roles/docker/defaults/main.yml @@ -129,11 +129,9 @@ services: domains: - "{{ base_domain }}" - "www.{{ base_domain }}" - - new_data_coop_website: - file: websites/new.data.coop.yml - domain: "new.{{ base_domain }}" - version: hugo + version: stable + staging_domain: "staging.{{ base_domain }}" + staging_version: stable slides_2022_website: file: websites/2022.slides.data.coop.yml diff --git a/roles/docker/tasks/services/websites/data.coop.yml b/roles/docker/tasks/services/websites/data.coop.yml index 25028e11..e6898ad6 100644 --- a/roles/docker/tasks/services/websites/data.coop.yml +++ b/roles/docker/tasks/services/websites/data.coop.yml @@ -13,7 +13,7 @@ - name: setup data.coop website docker container docker_container: name: data.coop_website - image: docker.data.coop/data-coop-website + image: docker.data.coop/data-coop-website:{{ services.data_coop_website.version }} restart_policy: unless-stopped networks: - name: external_services @@ -21,3 +21,15 @@ VIRTUAL_HOST : "{{ services.data_coop_website.domains|join(',') }}" LETSENCRYPT_HOST: "{{ services.data_coop_website.domains|join(',') }}" LETSENCRYPT_EMAIL: "{{ letsencrypt_email }}" + +- name: setup staging data.coop website using hugo + docker_container: + name: staging.data.coop_website + image: docker.data.coop/data-coop-website:{{ services.data_coop_website.staging_version }} + restart_policy: unless-stopped + networks: + - name: external_services + env: + VIRTUAL_HOST : "{{ services.data_coop_website.staging_domain }}" + LETSENCRYPT_HOST: "{{ services.data_coop_website.staging_domain }}" + LETSENCRYPT_EMAIL: "{{ letsencrypt_email }}" diff --git a/roles/docker/tasks/services/websites/new.data.coop.yml b/roles/docker/tasks/services/websites/new.data.coop.yml deleted file mode 100644 index 30836e1b..00000000 --- a/roles/docker/tasks/services/websites/new.data.coop.yml +++ /dev/null @@ -1,13 +0,0 @@ -# vim: ft=yaml.ansible ---- -- name: setup new data.coop website using hugo - docker_container: - name: new.data.coop_website - image: docker.data.coop/data-coop-website:{{ services.new_data_coop_website.version }} - restart_policy: unless-stopped - networks: - - name: external_services - env: - VIRTUAL_HOST : "{{ services.new_data_coop_website.domain }}" - LETSENCRYPT_HOST: "{{ services.new_data_coop_website.domain }}" - LETSENCRYPT_EMAIL: "{{ letsencrypt_email }}" From 085bb1dfe75a4d6cd6d7815ce194e8bfcc8d284e Mon Sep 17 00:00:00 2001 From: Sam Al-Sapti Date: Wed, 26 Jul 2023 17:03:33 +0200 Subject: [PATCH 2/2] Avoid code duplication --- roles/docker/defaults/main.yml | 7 +++---- roles/docker/tasks/services/websites/data.coop.yml | 14 +++++++------- 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/roles/docker/defaults/main.yml b/roles/docker/defaults/main.yml index 6dd7b1dd..343d6cc0 100644 --- a/roles/docker/defaults/main.yml +++ b/roles/docker/defaults/main.yml @@ -126,12 +126,11 @@ services: data_coop_website: file: websites/data.coop.yml - domains: - - "{{ base_domain }}" - - "www.{{ base_domain }}" + domain: "{{ base_domain }}" + www_domain: "www.{{ base_domain }}" version: stable staging_domain: "staging.{{ base_domain }}" - staging_version: stable + staging_version: staging slides_2022_website: file: websites/2022.slides.data.coop.yml diff --git a/roles/docker/tasks/services/websites/data.coop.yml b/roles/docker/tasks/services/websites/data.coop.yml index e6898ad6..28061778 100644 --- a/roles/docker/tasks/services/websites/data.coop.yml +++ b/roles/docker/tasks/services/websites/data.coop.yml @@ -3,33 +3,33 @@ - name: Upload vhost config for root domain copy: src: files/configs/matrix/vhost-root - dest: "{{ services.nginx_proxy.volume_folder }}/vhost/{{ base_domain }}" + dest: "{{ services.nginx_proxy.volume_folder }}/vhost/{{ services.data_coop_website.domain }}" - name: Upload vhost config for WWW domain copy: src: files/configs/vhost-www - dest: "{{ services.nginx_proxy.volume_folder }}/vhost/www.{{ base_domain }}" + dest: "{{ services.nginx_proxy.volume_folder }}/vhost/{{ services.data_coop_website.www_domain }}" - name: setup data.coop website docker container docker_container: - name: data.coop_website + name: "{{ services.data_coop_website.domain }}_website" image: docker.data.coop/data-coop-website:{{ services.data_coop_website.version }} restart_policy: unless-stopped networks: - name: external_services env: - VIRTUAL_HOST : "{{ services.data_coop_website.domains|join(',') }}" - LETSENCRYPT_HOST: "{{ services.data_coop_website.domains|join(',') }}" + VIRTUAL_HOST: "{{ services.data_coop_website.domain }},{{ services.data_coop_website.www_domain }}" + LETSENCRYPT_HOST: "{{ services.data_coop_website.domain }},{{ services.data_coop_website.www_domain }}" LETSENCRYPT_EMAIL: "{{ letsencrypt_email }}" - name: setup staging data.coop website using hugo docker_container: - name: staging.data.coop_website + name: "{{ services.data_coop_website.staging_domain }}_website" image: docker.data.coop/data-coop-website:{{ services.data_coop_website.staging_version }} restart_policy: unless-stopped networks: - name: external_services env: - VIRTUAL_HOST : "{{ services.data_coop_website.staging_domain }}" + VIRTUAL_HOST: "{{ services.data_coop_website.staging_domain }}" LETSENCRYPT_HOST: "{{ services.data_coop_website.staging_domain }}" LETSENCRYPT_EMAIL: "{{ letsencrypt_email }}"