Use Apache to serve a local OpenDev logo on paste
In order to avoid unnecessary browser requests to other sites, install a copy of the OpenDev logo on the Lodgeit server and serve it from there rather than pointing at one served from Gitea. Change-Id: I4c3678a1de8ca4a41cd0c64aab71b2e0e25373af
This commit is contained in:
parent
e8c456926c
commit
1a227489e2
1
playbooks/roles/lodgeit/files/opendev.svg
Symbolic link
1
playbooks/roles/lodgeit/files/opendev.svg
Symbolic link
@ -0,0 +1 @@
|
||||
../../../../assets/opendev.svg
|
@ -61,6 +61,22 @@
|
||||
group: root
|
||||
mode: 0755
|
||||
|
||||
- name: Create assets dir
|
||||
file:
|
||||
state: directory
|
||||
path: /var/lib/lodgeit/www/assets
|
||||
owner: root
|
||||
group: root
|
||||
mode: 0755
|
||||
|
||||
- name: Install OpenDev logo
|
||||
copy:
|
||||
src: opendev.svg
|
||||
dest: /var/lib/lodgeit/www/assets/opendev.svg
|
||||
owner: root
|
||||
group: root
|
||||
mode: 0644
|
||||
|
||||
- name: Install robots.txt
|
||||
copy:
|
||||
src: robots.txt
|
||||
|
@ -33,5 +33,5 @@ services:
|
||||
environment:
|
||||
LODGEIT_DBURI: 'mysql+pymysql://{{ lodgeit_db_username }}:{{ lodgeit_db_password }}@127.0.0.1:3306/{{ lodgeit_db_dbname }}'
|
||||
LODGEIT_SECRET_KEY: '{{ lodgeit_secret_key }}'
|
||||
LODGEIT_TITLE_OVERRIDE: '<img src="https://opendev.org/opendev/system-config/raw/branch/master/assets/opendev.svg" style="width: 100px; padding-bottom:10px; margin-left:20px;" alt="Opendev Pastebin">'
|
||||
LODGEIT_TITLE_OVERRIDE: '<img src="/assets/opendev.svg" style="width: 100px; padding-bottom:10px; margin-left:20px;" alt="Opendev Pastebin">'
|
||||
|
||||
|
@ -31,12 +31,16 @@
|
||||
ProxyPass / http://localhost:9000/ retry=0
|
||||
ProxyPassReverse / http://localhost:9000/
|
||||
|
||||
<Location "/assets/">
|
||||
ProxyPass !
|
||||
</Location>
|
||||
<Location "/robots.txt">
|
||||
ProxyPass !
|
||||
</Location>
|
||||
<Directory "/var/lib/lodgeit/www">
|
||||
Require all granted
|
||||
</Directory>
|
||||
Alias /assets /var/lib/lodgeit/www/assets
|
||||
Alias /robots.txt /var/lib/lodgeit/www/robots.txt
|
||||
|
||||
</VirtualHost>
|
||||
@ -74,12 +78,16 @@
|
||||
RewriteCond %{QUERY_STRING} "method=pastes.getRecent"
|
||||
RewriteRule .* - [F,L]
|
||||
|
||||
<Location "/assets/">
|
||||
ProxyPass !
|
||||
</Location>
|
||||
<Location "/robots.txt">
|
||||
ProxyPass !
|
||||
</Location>
|
||||
<Directory "/var/lib/lodgeit/www">
|
||||
Require all granted
|
||||
</Directory>
|
||||
Alias /assets /var/lib/lodgeit/www/assets
|
||||
Alias /robots.txt /var/lib/lodgeit/www/robots.txt
|
||||
|
||||
</VirtualHost>
|
||||
|
@ -45,6 +45,12 @@ def test_paste_redirects(host):
|
||||
r = requests.get('http://%s' % (host.backend.get_hostname()))
|
||||
assert r.status_code == 200
|
||||
|
||||
def test_paste_logo(host):
|
||||
cmd = host.run('curl --insecure '
|
||||
'--resolve paste.opendev.org:443:127.0.0.1 '
|
||||
'https://paste.opendev.org/assets/opendev.svg')
|
||||
assert 'image/svg+xml' in cmd.stdout
|
||||
|
||||
def test_paste_robots(host):
|
||||
cmd = host.run('curl --insecure '
|
||||
'--resolve paste.opendev.org:443:127.0.0.1 '
|
||||
|
Loading…
Reference in New Issue
Block a user