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
This commit is contained in:
James E. Blair 2023-03-18 16:40:43 -07:00
parent 31b505d3ba
commit 6745591369
2 changed files with 20 additions and 5 deletions

View File

@ -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
<Directory /afs/openstack.org/project/zuul-ci.org/registry>
DocumentRoot /var/www/registry
<Directory /var/www/registry>
Options Indexes FollowSymLinks MultiViews
Require all granted
AllowOverride None
# Allow mod_rewrite rules
AllowOverrideList Redirect RedirectMatch
ErrorDocument 404 /errorpage.html
</Directory>
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

View File

@ -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: