Added role for code redirects
This commit is contained in:
Родитель
312f13dc67
Коммит
ee77f61f94
|
@ -8,6 +8,7 @@
|
|||
- website
|
||||
- docs
|
||||
- blog
|
||||
- code
|
||||
- lgtm
|
||||
- coverage
|
||||
- drone
|
||||
|
|
|
@ -0,0 +1,2 @@
|
|||
code_domain: code.gitea.io
|
||||
code_container: gitea/redirects:latest
|
|
@ -0,0 +1,5 @@
|
|||
- name: restart code
|
||||
systemd:
|
||||
name: code
|
||||
state: restarted
|
||||
daemon_reload: yes
|
|
@ -0,0 +1,21 @@
|
|||
- name: service
|
||||
notify:
|
||||
- restart code
|
||||
template:
|
||||
src: service.j2
|
||||
dest: /etc/systemd/system/code.service
|
||||
|
||||
- name: default
|
||||
notify:
|
||||
- restart code
|
||||
template:
|
||||
src: default.j2
|
||||
dest: /etc/default/code
|
||||
|
||||
- name: start
|
||||
systemd:
|
||||
name: code
|
||||
state: started
|
||||
daemon_reload: yes
|
||||
masked: no
|
||||
enabled: yes
|
|
@ -0,0 +1,23 @@
|
|||
[Unit]
|
||||
Description=Code
|
||||
|
||||
Requires=docker.service
|
||||
After=docker.service
|
||||
|
||||
[Service]
|
||||
Restart=always
|
||||
|
||||
EnvironmentFile=/etc/default/code
|
||||
ExecStop=/bin/sh -c '/usr/bin/docker ps | /bin/grep %p 1> /dev/null && /usr/bin/docker stop %p || true'
|
||||
ExecStartPre=/bin/sh -c '/usr/bin/docker ps | /bin/grep %p 1> /dev/null && /usr/bin/docker kill %p || true'
|
||||
ExecStartPre=/bin/sh -c '/usr/bin/docker ps -a | /bin/grep %p 1> /dev/null && /usr/bin/docker rm %p || true'
|
||||
ExecStartPre=/usr/bin/docker pull {{ code_container }}
|
||||
|
||||
ExecStart=/usr/bin/docker run --rm \
|
||||
--name %p \
|
||||
--hostname {{ code_domain }} \
|
||||
--label traefik.frontend.rule=Host:{{ code_domain }} \
|
||||
{{ code_container }}
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
Загрузка…
Ссылка в новой задаче