switch mirrorlist containers to podman

This commit is contained in:
Kevin Fenzi 2018-12-12 20:06:59 +00:00
parent 901ca97960
commit 91948c4581
4 changed files with 16 additions and 33 deletions

View file

@ -56,8 +56,8 @@ frontend mirror-lists-frontend
backend mirror-lists-backend
balance hdr(appserver)
timeout connect 30s
server mirrorlist-local1 localhost:18081 check inter 1s rise 2 fall 3 weight 100
server mirrorlist-local2 localhost:18082 check inter 1s rise 2 fall 3 weight 100
server mirrorlist-local1 127.0.0.1:18081 check inter 1s rise 2 fall 3 weight 100
server mirrorlist-local2 127.0.0.1:18082 check inter 1s rise 2 fall 3 weight 100
option httpchk GET /mirrorlist
option allbackups

View file

@ -37,14 +37,10 @@ if [ `systemctl show mirrorlist1 -p ActiveState` != 'ActiveState=active' ]; then
exit 1
fi
# start mirrorlist2 (old pkl and see that it's processing ok)
systemctl start mirrorlist2
sleep ${TIME_RESTART}
# check mirrorlist2 (old pkl and see that it's processing ok)
curl -q -H mirrors.fedoraproject.org ${mirrorlist2} -s -f --retry 50 --retry-delay 10 --retry-connrefused --retry-max-time 180 | grep "sha512" >/dev/null
if [ $? != 0 ]; then
echo "ERROR: mirrorlist2 did not start correctly"
echo "ERROR: mirrorlist2 not processing correctly"
exit 1
fi

View file

@ -46,21 +46,10 @@
tags:
- mirrorlist_proxy
- name: Install docker
- name: Install podman
package: name={{item}} state=present
with_items:
- docker
- python-docker
tags:
- mirrorlist_proxy
- name: setup daemon.json to not restart containers on docker service restarts
copy: src=daemon.json dest=/etc/docker/daemon.json
tags:
- mirrorlist_proxy
- name: Run docker
service: name=docker state=started enabled=yes
- podman
tags:
- mirrorlist_proxy
@ -83,13 +72,17 @@
notify:
- reload systemd
# 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.
# enable both of them to run on boot
- name: Enable mirrorlist1
service: name=mirrorlist1 enabled=yes
tags:
- mirrorlist_proxy
- name: Enable mirrorlist2
service: name=mirrorlist2 enabled=yes
tags:
- mirrorlist_proxy
# install our cron script to handle hourly new pkl changes.
- name: install script to restart mirrorlist containers on pkl changes
copy: src=restart-mirrorlist-containers dest=/usr/local/bin/restart-mirrorlist-containers mode=0755

View file

@ -1,17 +1,11 @@
[Unit]
Description=Mirrorlist Container {{ item }}
After=docker.service
Requires=docker.service
[Service]
TimeoutStartSec=0
Type=oneshot
RemainAfterExit=yes
ExecStart=/usr/bin/docker run --rm --detach --log-driver none --name %n -v /srv/mirrorlist/data/mirrorlist{{ item }}:/var/lib/mirrormanager:z -v /var/log/mirrormanager:/var/log/mirrormanager:z -p 1808{{ item }}:80 {{ mirrorlist_container_image }} -l /var/log/mirrormanager/%n.log
ExecStop=/usr/bin/docker stop --time=1 %n
# Mirrorlist can't take a signal... but docker stop returns before it actually killed everything.
ExecStop=/usr/bin/sleep 10
TimeoutStopSec=180
ExecStartPre=-/usr/bin/podman stop %n
ExecStartPre=-/usr/bin/podman rm %n --force
ExecStart=/usr/bin/podman run --rm=true --log-driver none --name %n -v /srv/mirrorlist/data/mirrorlist{{ item }}:/var/lib/mirrormanager:z -v /var/log/mirrormanager:/var/log/mirrormanager:z -p 1808{{ item }}:80 {{ mirrorlist_container_image }} -l /var/log/mirrormanager/%n.log
ExecStop=/usr/bin/podman stop %n
[Install]
WantedBy=multi-user.target