From cff82acd9f6f0821cf01f27991b2f20d1868f107 Mon Sep 17 00:00:00 2001 From: Sam Al-Sapti Date: Tue, 6 Dec 2022 19:41:07 +0100 Subject: [PATCH 1/6] Don't set base_domain in Vagrantfile It's already set in playbook.yml according to the vagrant variable. --- Vagrantfile | 3 --- 1 file changed, 3 deletions(-) diff --git a/Vagrantfile b/Vagrantfile index 1e46276..589d56c 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -21,9 +21,6 @@ Vagrant.configure(2) do |config| ansible.playbook = "playbook.yml" ansible.ask_vault_pass = true ansible.verbose = "v" - ansible.extra_vars = { - base_domain: "datacoop.devel" - } # If the VM is already provisioned, we need to use the new port if provisioned? From cd03e98f10219017824b523a5dd267a27bd4d362 Mon Sep 17 00:00:00 2001 From: Sam Al-Sapti Date: Wed, 7 Dec 2022 21:36:35 +0100 Subject: [PATCH 2/6] Add missing services to defaults/main.yml --- roles/docker/defaults/main.yml | 19 +++++++++++++++++++ roles/docker/tasks/services/watchtower.yml | 4 ++-- .../websites/2022.slides.data.coop.yml | 7 +++---- .../services/websites/new-new.data.coop.yml | 7 ++++--- .../tasks/services/websites/new.data.coop.yml | 7 +++---- 5 files changed, 31 insertions(+), 13 deletions(-) diff --git a/roles/docker/defaults/main.yml b/roles/docker/defaults/main.yml index 16e4821..f63a3d4 100644 --- a/roles/docker/defaults/main.yml +++ b/roles/docker/defaults/main.yml @@ -117,6 +117,21 @@ services: - "{{ base_domain }}" - "www.{{ base_domain }}" + new_data_coop_website: + file: websites/new.data.coop.yml + domain: "new.{{ base_domain }}" + version: hugo + + new_new_data_coop_website: + file: websites/new-new.data.coop.yml + domain: "new-new.{{ base_domain }}" + version: latest + + 2022_slides_website: + file: websites/2022.slides.data.coop.yml + domain: "2022.slides.{{ base_domain }}" + version: latest + cryptohagen_website: file: websites/cryptohagen.dk.yml domains: @@ -174,3 +189,7 @@ services: domain: "member.{{ base_domain }}" django_admins: "Vidir:valberg@orn.li" allowed_sender_domain: true + + watchtower: + file: watchtower.yml + version: amd64-1.5.1 diff --git a/roles/docker/tasks/services/watchtower.yml b/roles/docker/tasks/services/watchtower.yml index 87d3f4d..7641b0b 100644 --- a/roles/docker/tasks/services/watchtower.yml +++ b/roles/docker/tasks/services/watchtower.yml @@ -2,7 +2,7 @@ - name: watchtower container docker_container: name: watchtower - image: containrrr/watchtower:1.4.0 + image: containrrr/watchtower:{{ services.watchtower.version }} restart_policy: unless-stopped networks: - name: external_services @@ -11,4 +11,4 @@ - "{{ services.docker_registry.volume_folder }}/auth/config.json:/config.json" env: WATCHTOWER_LABEL_ENABLE: "true" - WATCHTOWER_POLL_INTERVAL: "60" \ No newline at end of file + WATCHTOWER_POLL_INTERVAL: "60" diff --git a/roles/docker/tasks/services/websites/2022.slides.data.coop.yml b/roles/docker/tasks/services/websites/2022.slides.data.coop.yml index 260af82..cf1925e 100644 --- a/roles/docker/tasks/services/websites/2022.slides.data.coop.yml +++ b/roles/docker/tasks/services/websites/2022.slides.data.coop.yml @@ -1,16 +1,15 @@ --- - - name: setup 2022.slides.data.coop website using unipi docker_container: name: 2022.slides.data.coop_website - image: docker.data.coop/unipi:latest + image: docker.data.coop/unipi:{{ services.2022_slides_website.version }} restart_policy: unless-stopped purge_networks: yes networks: - name: external_services env: - VIRTUAL_HOST: "2022.slides.{{ services.data_coop_website.domains|join(',') }}" - LETSENCRYPT_HOST: "2022.slides.{{ services.data_coop_website.domains|join(',') }}" + VIRTUAL_HOST: "{{ services.2022_slides_website.domain }}" + LETSENCRYPT_HOST: "{{ services.2022_slides_website.domain }}" LETSENCRYPT_EMAIL: "{{ letsencrypt_email }}" # Temporarily hosting on github command: "--remote=https://github.com/sorbusursina/datacoop-slides.git#slides2022" diff --git a/roles/docker/tasks/services/websites/new-new.data.coop.yml b/roles/docker/tasks/services/websites/new-new.data.coop.yml index 05ff1f3..d17af7b 100644 --- a/roles/docker/tasks/services/websites/new-new.data.coop.yml +++ b/roles/docker/tasks/services/websites/new-new.data.coop.yml @@ -1,14 +1,15 @@ +--- - name: setup new-new data.coop website using unipi docker_container: name: new-new.data.coop_website - image: docker.data.coop/unipi:latest + image: docker.data.coop/unipi:{{ services.new_new_data_coop_website.version }} restart_policy: unless-stopped purge_networks: yes networks: - name: external_services env: - VIRTUAL_HOST: "new-new.{{ services.data_coop_website.domains|join(',') }}" - LETSENCRYPT_HOST: "new-new.{{ services.data_coop_website.domains|join(',') }}" + VIRTUAL_HOST: "{{ services.new_new_data_coop_website.domain }}" + LETSENCRYPT_HOST: "{{ services.new_new_data_coop_website.domain }}" LETSENCRYPT_EMAIL: "{{ letsencrypt_email }}" # The ssh-key is for read-only only command: "--remote=git@git.data.coop:halfd/new-website.git#main --ssh-key ed25519:Ag9RekCyC2eow4P/e5crVvSTQ7dTK46WkG0wqEPVJbU= --ssh-authenticator SHA256:l9kdLkb0kJm46pOJ4tCHCtFUaqV1ImbZWMA5oje10fI" diff --git a/roles/docker/tasks/services/websites/new.data.coop.yml b/roles/docker/tasks/services/websites/new.data.coop.yml index f70596a..90ba65c 100644 --- a/roles/docker/tasks/services/websites/new.data.coop.yml +++ b/roles/docker/tasks/services/websites/new.data.coop.yml @@ -1,15 +1,14 @@ --- - - name: setup new data.coop website using hugo docker_container: name: new.data.coop_website - image: docker.data.coop/data-coop-website:hugo + image: docker.data.coop/data-coop-website:{{ services.new_data_coop_website.version }} restart_policy: unless-stopped networks: - name: external_services env: - VIRTUAL_HOST : "new.{{ services.data_coop_website.domains|join(',') }}" - LETSENCRYPT_HOST: "new.{{ services.data_coop_website.domains|join(',') }}" + VIRTUAL_HOST : "{{ services.new_data_coop_website.domain }}" + LETSENCRYPT_HOST: "{{ services.new_data_coop_website.domain }}" LETSENCRYPT_EMAIL: "{{ letsencrypt_email }}" labels: com.centurylinklabs.watchtower.enable: "true" From 000216d74d037ee34ad75121dae6d394b6ede161 Mon Sep 17 00:00:00 2001 From: Sam Al-Sapti Date: Wed, 7 Dec 2022 21:49:36 +0100 Subject: [PATCH 3/6] Add vhost config for www.data.coop and move vhost-root copying task to data.coop.yml --- roles/docker/files/configs/vhost-www | 4 ++++ roles/docker/tasks/services/matrix_riot.yml | 5 ----- roles/docker/tasks/services/websites/data.coop.yml | 9 +++++++++ 3 files changed, 13 insertions(+), 5 deletions(-) create mode 100644 roles/docker/files/configs/vhost-www diff --git a/roles/docker/files/configs/vhost-www b/roles/docker/files/configs/vhost-www new file mode 100644 index 0000000..713a6d2 --- /dev/null +++ b/roles/docker/files/configs/vhost-www @@ -0,0 +1,4 @@ +server { + server_name www.data.coop; + return 301 $scheme://data.coop$request_uri; +} diff --git a/roles/docker/tasks/services/matrix_riot.yml b/roles/docker/tasks/services/matrix_riot.yml index 666c544..34f302d 100644 --- a/roles/docker/tasks/services/matrix_riot.yml +++ b/roles/docker/tasks/services/matrix_riot.yml @@ -36,11 +36,6 @@ src: files/configs/riot/riot.im.conf dest: "{{ services.riot.volume_folder }}/data/riot.im.conf" -- name: upload vhost config for root domain - template: - src: files/configs/matrix/vhost-root - dest: "{{ services.nginx_proxy.volume_folder }}/vhost/{{ base_domain }}" - - name: upload vhost config for matrix domain template: src: files/configs/matrix/vhost-matrix diff --git a/roles/docker/tasks/services/websites/data.coop.yml b/roles/docker/tasks/services/websites/data.coop.yml index 2492757..6a0fade 100644 --- a/roles/docker/tasks/services/websites/data.coop.yml +++ b/roles/docker/tasks/services/websites/data.coop.yml @@ -1,4 +1,13 @@ --- +- name: Upload vhost config for root domain + copy: + src: files/configs/vhost-root + dest: "{{ services.nginx_proxy.volume_folder }}/vhost/{{ base_domain }}" + +- name: Upload vhost config for WWW domain + copy: + src: files/configs/vhost-www + dest: "{{ services.nginx_proxy.volume_folder }}/vhost/www.{{ base_domain }}" - name: setup data.coop website docker container docker_container: From cf756ee881ce113d55208078ea2ac8ab82b49c7a Mon Sep 17 00:00:00 2001 From: Sam Al-Sapti Date: Wed, 7 Dec 2022 21:51:51 +0100 Subject: [PATCH 4/6] Fix file source --- roles/docker/tasks/services/websites/data.coop.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/docker/tasks/services/websites/data.coop.yml b/roles/docker/tasks/services/websites/data.coop.yml index 6a0fade..58d8af0 100644 --- a/roles/docker/tasks/services/websites/data.coop.yml +++ b/roles/docker/tasks/services/websites/data.coop.yml @@ -1,7 +1,7 @@ --- - name: Upload vhost config for root domain copy: - src: files/configs/vhost-root + src: files/configs/matrix/vhost-root dest: "{{ services.nginx_proxy.volume_folder }}/vhost/{{ base_domain }}" - name: Upload vhost config for WWW domain From 019b646caa51facabf3e73aa4a63bb5de2058460 Mon Sep 17 00:00:00 2001 From: Sam Al-Sapti Date: Wed, 7 Dec 2022 21:57:36 +0100 Subject: [PATCH 5/6] Rename 2022_slides_website due to error --- roles/docker/defaults/main.yml | 2 +- .../tasks/services/websites/2022.slides.data.coop.yml | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/roles/docker/defaults/main.yml b/roles/docker/defaults/main.yml index f63a3d4..5be8b75 100644 --- a/roles/docker/defaults/main.yml +++ b/roles/docker/defaults/main.yml @@ -127,7 +127,7 @@ services: domain: "new-new.{{ base_domain }}" version: latest - 2022_slides_website: + slides_2022_website: file: websites/2022.slides.data.coop.yml domain: "2022.slides.{{ base_domain }}" version: latest diff --git a/roles/docker/tasks/services/websites/2022.slides.data.coop.yml b/roles/docker/tasks/services/websites/2022.slides.data.coop.yml index cf1925e..ba96d4d 100644 --- a/roles/docker/tasks/services/websites/2022.slides.data.coop.yml +++ b/roles/docker/tasks/services/websites/2022.slides.data.coop.yml @@ -2,14 +2,14 @@ - name: setup 2022.slides.data.coop website using unipi docker_container: name: 2022.slides.data.coop_website - image: docker.data.coop/unipi:{{ services.2022_slides_website.version }} + image: docker.data.coop/unipi:{{ services.slides_2022_website.version }} restart_policy: unless-stopped purge_networks: yes networks: - name: external_services env: - VIRTUAL_HOST: "{{ services.2022_slides_website.domain }}" - LETSENCRYPT_HOST: "{{ services.2022_slides_website.domain }}" + VIRTUAL_HOST: "{{ services.slides_2022_website.domain }}" + LETSENCRYPT_HOST: "{{ services.slides_2022_website.domain }}" LETSENCRYPT_EMAIL: "{{ letsencrypt_email }}" # Temporarily hosting on github command: "--remote=https://github.com/sorbusursina/datacoop-slides.git#slides2022" From 3b8c475bb1879e2806dcb2032c528f2a022ff6d3 Mon Sep 17 00:00:00 2001 From: Sam Al-Sapti Date: Wed, 7 Dec 2022 22:04:31 +0100 Subject: [PATCH 6/6] Fix vhost-www --- roles/docker/files/configs/vhost-www | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/roles/docker/files/configs/vhost-www b/roles/docker/files/configs/vhost-www index 713a6d2..2ced969 100644 --- a/roles/docker/files/configs/vhost-www +++ b/roles/docker/files/configs/vhost-www @@ -1,4 +1,2 @@ -server { - server_name www.data.coop; - return 301 $scheme://data.coop$request_uri; -} +server_name www.data.coop; +return 301 $scheme://data.coop$request_uri;