From 67455913698d7659d5e516005d600a2247fc1725 Mon Sep 17 00:00:00 2001 From: "James E. Blair" Date: Sat, 18 Mar 2023 16:40:43 -0700 Subject: [PATCH] Use a static Apache config for registries We should be able to accomplish the registry redirect using a single rewrite rule and a single empty file. Change-Id: I85a09d19bbbad1ba7078076644a3c5cea4d8aeb8 --- .../static/files/50-registry.zuul-ci.org.conf | 9 ++++----- playbooks/roles/static/tasks/main.yaml | 16 ++++++++++++++++ 2 files changed, 20 insertions(+), 5 deletions(-) diff --git a/playbooks/roles/static/files/50-registry.zuul-ci.org.conf b/playbooks/roles/static/files/50-registry.zuul-ci.org.conf index 14a683e5b6..cec29eeb25 100644 --- a/playbooks/roles/static/files/50-registry.zuul-ci.org.conf +++ b/playbooks/roles/static/files/50-registry.zuul-ci.org.conf @@ -27,16 +27,15 @@ SSLCertificateKeyFile /etc/letsencrypt-certs/registry.zuul-ci.org/registry.zuul-ci.org.key SSLCertificateChainFile /etc/letsencrypt-certs/registry.zuul-ci.org/ca.cer - DocumentRoot /afs/openstack.org/project/zuul-ci.org/registry - + DocumentRoot /var/www/registry + Options Indexes FollowSymLinks MultiViews Require all granted AllowOverride None - # Allow mod_rewrite rules - AllowOverrideList Redirect RedirectMatch - ErrorDocument 404 /errorpage.html + RewriteRule ^/v2/(.*)$ https://quay.io/v2/corvus/$1 [R=302,L] + ErrorLog /var/log/apache2/registry.zuul-ci.org_error.log LogLevel warn CustomLog /var/log/apache2/registry.zuul-ci.org_access.log combined diff --git a/playbooks/roles/static/tasks/main.yaml b/playbooks/roles/static/tasks/main.yaml index 6c18d86b9d..ae9d3a5d82 100644 --- a/playbooks/roles/static/tasks/main.yaml +++ b/playbooks/roles/static/tasks/main.yaml @@ -85,6 +85,22 @@ args: removes: /etc/apache2/sites-enabled/000-default.conf +- name: Make a local empty directory for registry roots + file: + state: directory + path: /var/www/registry/v2 + mode: 0755 + owner: root + group: root + +- name: Make a local empty index file for registry roots + copy: + content: "" + dest: /var/www/registry/v2/index.html + mode: 0644 + owner: root + group: root + - name: Enable sites include_tasks: enable_site.yaml loop: