From f8245550d01f11e16a2670e825c2e943526f5732 Mon Sep 17 00:00:00 2001 From: Tobias Reisinger Date: Fri, 27 Sep 2024 22:56:49 +0200 Subject: [PATCH] Switch registry to scaleway --- inventory/group_vars/all/main.yml | 4 ++++ output.tf | 8 ++++++++ roles/backup/vars/main.yml | 2 +- roles/caddy/vars/main.yml | 2 +- roles/healthcheck/files/docker-compose.yml | 2 +- roles/reitanlage_oranienburg/vars/main.yml | 2 +- scaleway.tf | 13 +++++++++++++ 7 files changed, 29 insertions(+), 4 deletions(-) diff --git a/inventory/group_vars/all/main.yml b/inventory/group_vars/all/main.yml index 7afbfed..5e37967 100644 --- a/inventory/group_vars/all/main.yml +++ b/inventory/group_vars/all/main.yml @@ -12,6 +12,10 @@ mailer: acme_dns: host: acme.serguzim.me +container_registry: + public: "{{ opentofu.scaleway_registry_endpoint_public }}" + private: "{{ opentofu.scaleway_registry_endpoint_private }}" + services_path: /opt/services/ diff --git a/output.tf b/output.tf index e07d0ee..0e7638c 100644 --- a/output.tf +++ b/output.tf @@ -18,3 +18,11 @@ output "scaleway_service_keys" { value = scaleway_iam_api_key.service_keys sensitive = true } + +output "scaleway_registry_endpoint_public" { + value = scaleway_registry_namespace.public.endpoint +} + +output "scaleway_registry_endpoint_private" { + value = scaleway_registry_namespace.private.endpoint +} diff --git a/roles/backup/vars/main.yml b/roles/backup/vars/main.yml index f678569..906627a 100644 --- a/roles/backup/vars/main.yml +++ b/roles/backup/vars/main.yml @@ -1,6 +1,6 @@ --- -backup_image: registry.serguzim.me/services/backup +backup_image: "{{ (container_registry.public, 'services/backup') | path_join }}" backup_svc: name: backup diff --git a/roles/caddy/vars/main.yml b/roles/caddy/vars/main.yml index a68e9a8..cf01edb 100644 --- a/roles/caddy/vars/main.yml +++ b/roles/caddy/vars/main.yml @@ -24,7 +24,7 @@ caddy_env: caddy_compose: watchtower: false - image: registry.serguzim.me/services/caddy:2-alpine + image: "{{ (container_registry.public, 'services/caddy:2-alpine') | path_join }}" volumes: - "./config:/etc/caddy/" - data:/data diff --git a/roles/healthcheck/files/docker-compose.yml b/roles/healthcheck/files/docker-compose.yml index 7400e74..2deb20d 100644 --- a/roles/healthcheck/files/docker-compose.yml +++ b/roles/healthcheck/files/docker-compose.yml @@ -4,7 +4,7 @@ x-common-elements: &common-elements build: context: . - image: registry.serguzim.me/services/healthcheck + image: "{{ (container_registry.public, 'services/healthcheck') | path_join }}" restart: never env_file: - service.env diff --git a/roles/reitanlage_oranienburg/vars/main.yml b/roles/reitanlage_oranienburg/vars/main.yml index ecc55da..976574b 100644 --- a/roles/reitanlage_oranienburg/vars/main.yml +++ b/roles/reitanlage_oranienburg/vars/main.yml @@ -13,7 +13,7 @@ reitanlage_oranienburg_svc: reitanlage_oranienburg_compose: watchtower: false - image: registry.serguzim.me/library/grav + image: "{{ (container_registry.public, 'library/grav') | path_join }}" volumes: - data:/var/www/html/ file: diff --git a/scaleway.tf b/scaleway.tf index 55cf057..4853c83 100644 --- a/scaleway.tf +++ b/scaleway.tf @@ -79,3 +79,16 @@ resource "scaleway_iam_api_key" "service_keys" { application_id = scaleway_iam_application.service_applications[each.key].id expires_at = time_rotating.rotate_after_a_year.rotation_rfc3339 } + + +resource "scaleway_registry_namespace" "public" { + name = "public.serguzim.net" + description = "Public container registry for serguzim.net" + is_public = true +} + +resource "scaleway_registry_namespace" "private" { + name = "private.serguzim.net" + description = "Private container registry for serguzim.net" + is_public = false +}