forked from mantl/mantl-packaging
-
Notifications
You must be signed in to change notification settings - Fork 0
/
spec.yml
94 lines (78 loc) · 2.43 KB
/
spec.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
---
name: traefik
version: 0.0.0
epoch: 285
iteration: 6
license: MIT
vendor: Emile Vauge
architecture: x86_64
type: rpm
url: https://github.com/EmileVauge/traefik
description: Træfɪk, a modern reverse proxy
dependencies:
- libcap
- python
- sudo
resources:
- url: https://github.com/emilevauge/traefik/releases/download/v1.0.alpha.285/traefik_linux-amd64
hash-type: sha1
hash: 01564a14919fd364000e085e4aa2a29d134d3d90
targets:
# base
- src: '{{.BuildRoot}}/traefik_linux-amd64'
dest: /usr/bin/{{.Name}}
- src: '{{.SpecRoot}}/{{.Name}}.service'
dest: /etc/systemd/system/{{.Name}}.service
template: yes
- src: '{{empty}}'
dest: /etc/traefik
- src: '{{empty}}'
dest: /etc/traefik/configs
# logging
- src: '{{.SpecRoot}}/logrotate/traefik'
dest: /etc/logrotate.d/traefik
- src: '{{.SpecRoot}}/logrotate/traefik-access'
dest: /etc/logrotate.d/traefik-access
- src: "{{empty}}"
dest: /var/log/{{.Name}}
- src: "{{empty}}"
dest: /var/log/{{.Name}}/archive
# config generation scripts
- src: '{{.SpecRoot}}/config/'
dest: /usr/bin/
- src: '{{.SpecRoot}}/traefik-restart'
dest: /etc/sudoers.d/
scripts:
before-install: |
getent group {{.Name}} > /dev/null || groupadd -r {{.Name}}
getent passwd {{.Name}} > /dev/null || \
useradd -r \
-g {{.Name}} \
-d /etc/{{.Name}} \
-s /sbin/nologin \
-c "{{.Name}} user" \
{{.Name}}
after-install: |
chown -R {{.Name}}:{{.Name}} /etc/{{.Name}}
chown -R {{.Name}}:{{.Name}} /var/log/{{.Name}}
setcap 'cap_net_bind_service=+ep' /usr/bin/{{.Name}}
systemctl enable /etc/systemd/system/{{.Name}}.service 2>/dev/null
systemctl start {{.Name}}.service
sudo -u {{.Name}} traefik-global --port=80 --grace-time-out=10
sudo -u {{.Name}} traefik-web --address=:8080
after-upgrade: |
chown -R {{.Name}}:{{.Name}} /var/log/{{.Name}}
setcap 'cap_net_bind_service=+ep' /usr/bin/{{.Name}}
systemctl daemon-reload
systemctl restart {{.Name}}.service
before-remove: |
systemctl stop {{.Name}}.service
systemctl disable {{.Name}}.service 2>/dev/null
after-remove: |
systemctl daemon-reload
extra-args: |
--rpm-os linux
--rpm-auto-add-directories
--rpm-auto-add-exclude-directories /etc/systemd
--rpm-auto-add-exclude-directories /etc/systemd/system
--rpm-auto-add-exclude-directories /etc/sudoers.d