diff --git a/playbooks/roles/lodgeit/files/opendev.svg b/playbooks/roles/lodgeit/files/opendev.svg new file mode 120000 index 0000000000..618f33aadf --- /dev/null +++ b/playbooks/roles/lodgeit/files/opendev.svg @@ -0,0 +1 @@ +../../../../assets/opendev.svg \ No newline at end of file diff --git a/playbooks/roles/lodgeit/tasks/main.yaml b/playbooks/roles/lodgeit/tasks/main.yaml index 09339b84f3..27f3c0af6f 100644 --- a/playbooks/roles/lodgeit/tasks/main.yaml +++ b/playbooks/roles/lodgeit/tasks/main.yaml @@ -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 diff --git a/playbooks/roles/lodgeit/templates/docker-compose.yaml.j2 b/playbooks/roles/lodgeit/templates/docker-compose.yaml.j2 index 373f558f2f..f917ec255d 100644 --- a/playbooks/roles/lodgeit/templates/docker-compose.yaml.j2 +++ b/playbooks/roles/lodgeit/templates/docker-compose.yaml.j2 @@ -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: 'Opendev Pastebin' + LODGEIT_TITLE_OVERRIDE: 'Opendev Pastebin' diff --git a/playbooks/roles/lodgeit/templates/paste.vhost.j2 b/playbooks/roles/lodgeit/templates/paste.vhost.j2 index c72a49fe38..f7b5fc82be 100644 --- a/playbooks/roles/lodgeit/templates/paste.vhost.j2 +++ b/playbooks/roles/lodgeit/templates/paste.vhost.j2 @@ -31,12 +31,16 @@ ProxyPass / http://localhost:9000/ retry=0 ProxyPassReverse / http://localhost:9000/ + + ProxyPass ! + ProxyPass ! Require all granted + Alias /assets /var/lib/lodgeit/www/assets Alias /robots.txt /var/lib/lodgeit/www/robots.txt @@ -74,12 +78,16 @@ RewriteCond %{QUERY_STRING} "method=pastes.getRecent" RewriteRule .* - [F,L] + + ProxyPass ! + ProxyPass ! Require all granted + Alias /assets /var/lib/lodgeit/www/assets Alias /robots.txt /var/lib/lodgeit/www/robots.txt diff --git a/testinfra/test_paste.py b/testinfra/test_paste.py index 014a0813df..5854a8f1be 100644 --- a/testinfra/test_paste.py +++ b/testinfra/test_paste.py @@ -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 '