Configure varnish cache on buildvm-s390x-01.stg

This commit is contained in:
Mikolaj Izdebski 2018-11-30 06:39:36 +00:00
parent 2809512f1b
commit 214f94d000
5 changed files with 30 additions and 2 deletions
inventory/host_vars
playbooks/groups
roles
base/templates/iptables
koji_builder/templates
varnish/templates

View file

@ -0,0 +1,4 @@
---
varnish_group: s390kojipkgs
# needed because this host has a varnish cache on it.
custom_rules: [ '-A INPUT -s 10.16.0.0/24 -p tcp -m tcp --dport 80 -j ACCEPT' ]

View file

@ -171,8 +171,8 @@
- import_tasks: "{{ handlers_path }}/restart_services.yml" - import_tasks: "{{ handlers_path }}/restart_services.yml"
- name: configure varnish cache on buildvm-s390x-07.s390.fedoraproject.org - name: configure varnish cache
hosts: buildvm-s390x-07.s390.fedoraproject.org hosts: buildvm-s390x-07.s390.fedoraproject.org:buildvm-s390x-01.stg.s390.fedoraproject.org
tags: tags:
- varnish - varnish
user: root user: root

View file

@ -33,6 +33,9 @@
{% if host in groups['buildvm-s390x'] %} {% if host in groups['buildvm-s390x'] %}
-A OUTPUT -p tcp -m tcp -d 10.16.0.17 --dport 80 -j ACCEPT -A OUTPUT -p tcp -m tcp -d 10.16.0.17 --dport 80 -j ACCEPT
{% endif %} {% endif %}
{% if host in groups['buildvm-s390x-stg'] %}
-A OUTPUT -p tcp -m tcp -d 10.16.0.25 --dport 80 -j ACCEPT
{% endif %}
#koji.fp.o #koji.fp.o
-A OUTPUT -p tcp -m tcp -d 10.5.125.63 --dport 80 -j ACCEPT -A OUTPUT -p tcp -m tcp -d 10.5.125.63 --dport 80 -j ACCEPT

View file

@ -30,6 +30,9 @@ use_createrepo_c=True
{% if host in groups['buildvm-s390x'] %} {% if host in groups['buildvm-s390x'] %}
# s390x builders use a local varnish cache # s390x builders use a local varnish cache
topurl = http://kojipkgs-cache01.s390.fedoraproject.org https://kojipkgs01.fedoraproject.org https://kojipkgs02.fedoraproject.org topurl = http://kojipkgs-cache01.s390.fedoraproject.org https://kojipkgs01.fedoraproject.org https://kojipkgs02.fedoraproject.org
{% elif host in groups['buildvm-s390x-stg'] %}
# s390x staging builder uses a local varnish cache
topurl = http://kojipkgs-cache01.stg.s390.fedoraproject.org {{koji_topurl}}
{% elif koji_topurl == 'https://kojipkgs.fedoraproject.org/' %} {% elif koji_topurl == 'https://kojipkgs.fedoraproject.org/' %}
; add some additional urls for failover ; add some additional urls for failover
topurl = {{koji_topurl}} https://kojipkgs01.fedoraproject.org https://kojipkgs02.fedoraproject.org topurl = {{koji_topurl}} https://kojipkgs01.fedoraproject.org https://kojipkgs02.fedoraproject.org

View file

@ -13,6 +13,19 @@ acl repoallowed {
acl purge { acl purge {
"127.0.0.1"/32; "127.0.0.1"/32;
} }
{% if env == 'staging' %}
backend koji01 {
.host = "koji01.stg.phx2.fedoraproject.org";
.probe = {
.url = "/";
.timeout = 1s;
.interval = 5s;
.window = 5;
.threshold = 3;
}
}
{% else %}
backend kojipkgs01 { backend kojipkgs01 {
.host = "kojipkgs01.phx2.fedoraproject.org"; .host = "kojipkgs01.phx2.fedoraproject.org";
.probe = { .probe = {
@ -40,12 +53,17 @@ sub vcl_init {
primarykojipkgs.add_backend(kojipkgs01); primarykojipkgs.add_backend(kojipkgs01);
primarykojipkgs.add_backend(kojipkgs02); primarykojipkgs.add_backend(kojipkgs02);
} }
{% endif %}
sub vcl_recv { sub vcl_recv {
# This gets arround the silly, ::1 that Apache adds on the proxies (still need to look at that) # This gets arround the silly, ::1 that Apache adds on the proxies (still need to look at that)
set req.http.X-Forwarded-For = regsub(req.http.X-Forwarded-For, "^([a-f0-9:.]+), .+$", "\1"); set req.http.X-Forwarded-For = regsub(req.http.X-Forwarded-For, "^([a-f0-9:.]+), .+$", "\1");
{% if env == 'staging' %}
set req.backend_hint = koji01;
{% else %}
set req.backend_hint = primarykojipkgs.backend(); set req.backend_hint = primarykojipkgs.backend();
{% endif %}
unset req.http.cookie; unset req.http.cookie;
set req.http.clear-cookies = "yes"; set req.http.clear-cookies = "yes";