Deploy mirrorlist as docker container on staging

Signed-off-by: Patrick Uiterwijk <puiterwijk@redhat.com>
This commit is contained in:
Patrick Uiterwijk 2016-10-09 00:38:52 +00:00
parent 1dfbde8771
commit 6550392ee7
5 changed files with 62 additions and 0 deletions

View file

@ -19,6 +19,8 @@
- collectd/base
- sudo
- rsyncd
- { role: mirrormanager/mirrorlist_proxy,
when: env == "staging"}
- { role: openvpn/client,
when: env != "staging" }
- apache

View file

@ -44,6 +44,10 @@ listen fp-wiki 0.0.0.0:10001
listen mirror-lists 0.0.0.0:10002
balance hdr(appserver)
timeout connect 30s
{% if env == "staging" %}
server mirrorlist-local1 localhost:18081 check inter 5s rise 2 fall 3 weight 100
server mirrorlist-local2 localhost:18082 check inter 5s rise 2 fall 3 weight 100
{% endif %}
server mirrorlist-phx2 mirrorlist-phx2:80 check inter 5s rise 2 fall 3
{% if env == "production" %}
server mirrorlist-dedicatedsolutions mirrorlist-dedicatedsolutions:80 check inter 5s rise 2 fall 3

View file

@ -0,0 +1,11 @@
[Unit]
Description=Mirrorlist Container 1
After=docker.service
Requires=docker.service
[Service]
TimeoutStartSec=0
ExecStart=/usr/bin/docker run --rm --name %n -v /srv/mirrorlist/data:/var/lib/mirrormanager:z -p 18081:80 puiterwijk/infra-test:mirrorlist
[Install]
WantedBy=multi-user.target

View file

@ -0,0 +1,11 @@
[Unit]
Description=Mirrorlist Container 2
After=docker.service
Requires=docker.service
[Service]
TimeoutStartSec=0
ExecStart=/usr/bin/docker run --rm --name %n -v /srv/mirrorlist/data:/var/lib/mirrormanager:z -p 18082:80 puiterwijk/infra-test:mirrorlist
[Install]
WantedBy=multi-user.target

View file

@ -0,0 +1,34 @@
---
# tasklist for setting up the mirrorlist app as a container on proxies
- name: Install docker
package: name=docker state=present
tags:
- mirrorlist_proxy
- name: Run docker
service: name=docker state=started enabled=yes
tags:
- mirrorlist_proxy
- name: Pull mirrorlist image
docker_image:
name: puiterwijk/infra-test:mirrorlist
tags:
- mirrorlist_proxy
# We deploy two service files. Both listen on a different port, so that we can switch
# them out as part of the pkl deployment without having any local downtime.
- name: Deploy service files
copy: src={{item}}.service dest=/etc/systemd/system/{{item}}.service
with_items:
- mirrorlist1
- mirrorlist2
tags:
- mirrorlist_proxy
# We enable mirrorlist1 so we have one that always starts on boot. The pkl deployment script
# will make sure that at least one is running and the other is killed.
- name: Enable mirrorlist1
server: name=mirrorlist1 enabled=yes
tags:
- mirrorlist_proxy