feat(profiles): Mise à jour du profile pour traefik
This commit is contained in:
1 parent
6f7c0ee078
commit
510dadb00d
2 files changed
+43
-70
No files matched your search
@@ -1,42 +0,0 @@
|
||||
name: traefik
|
||||
description: Install traefik
|
||||
config:
|
||||
cloud-init.user-data: |
|
||||
#cloud-config
|
||||
|
||||
write_files:
|
||||
- path: "/etc/traefik/traefik.yaml"
|
||||
owner: traefik:traefik
|
||||
permissions: "0644"
|
||||
content: |
|
||||
## Static configuration
|
||||
entryPoints:
|
||||
web:
|
||||
address: ":80"
|
||||
http:
|
||||
redirections:
|
||||
entryPoint:
|
||||
to: websecure
|
||||
scheme: https
|
||||
|
||||
websecure:
|
||||
address: ":443"
|
||||
|
||||
providers:
|
||||
file:
|
||||
directory: "./dynamic"
|
||||
|
||||
log:
|
||||
level: DEBUG
|
||||
|
||||
accessLog:
|
||||
filePath: "/var/log/traefik/access.log.json"
|
||||
format: "json"
|
||||
api:
|
||||
# Dashboard
|
||||
#
|
||||
# Optional
|
||||
# Default: true
|
||||
#
|
||||
dashboard: true
|
||||
insecure: true
|
||||
@@ -14,6 +14,7 @@ config:
|
||||
- tar
|
||||
- unzip
|
||||
- wget
|
||||
- git
|
||||
|
||||
# Users
|
||||
users:
|
||||
@@ -25,36 +26,47 @@ config:
|
||||
|
||||
# Configure second network interface
|
||||
write_files:
|
||||
- path: "/etc/netplan/eth1.yaml"
|
||||
- path: "/etc/systemd/system/traefik.path"
|
||||
owner: root:root
|
||||
permissions: "0644"
|
||||
content: |
|
||||
network:
|
||||
version: 2
|
||||
ethernets:
|
||||
eth1:
|
||||
dhcp4: true
|
||||
[Unit]
|
||||
Description="Monitor the traefik config files"
|
||||
After=network-online.target
|
||||
Wants=network-online.target systemd-networkd-wait-online.service
|
||||
|
||||
[Path]
|
||||
PathModified=/etc/traefik/traefik.yaml
|
||||
PathModified=/etc/traefik/dynamic
|
||||
Unit=traefik.service
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
|
||||
- path: "/etc/systemd/system/traefik.service"
|
||||
owner: root:root
|
||||
permissions: "0644"
|
||||
content: |
|
||||
[Unit]
|
||||
Description=traefik proxy
|
||||
Description="traefik proxy service"
|
||||
After=network-online.target
|
||||
Wants=network-online.target systemd-networkd-wait-online.service
|
||||
|
||||
|
||||
[Service]
|
||||
Restart=on-abnormal
|
||||
|
||||
; User and group the process will run as.
|
||||
User=traefik
|
||||
Group=traefik
|
||||
|
||||
;User=traefik
|
||||
;Group=traefik
|
||||
;=> TODO : fix permissions issues on certificates
|
||||
|
||||
ExecStart=/usr/local/bin/traefik
|
||||
; Always set "-root" to something safe in case it gets forgotten in the traefikfile.
|
||||
ExecStart=/usr/local/bin/traefik --configfile=/etc/traefik/traefik.yaml
|
||||
|
||||
;ExecStart=/usr/local/bin/traefik --configfile=/etc/traefik/traefik.yaml
|
||||
|
||||
; Limit the number of file descriptors; see `man systemd.exec` for more limit settings.
|
||||
LimitNOFILE=1048576
|
||||
|
||||
|
||||
Restart=on-abnormal
|
||||
|
||||
; Use private /tmp and /var/tmp, which are discarded after traefik stops.
|
||||
PrivateTmp=true
|
||||
; Use a minimal /dev (May bring additional security if switched to 'true', but it may not work on Raspberry Pi's or other devices, so it has been disabled in this dist.)
|
||||
@@ -65,18 +77,18 @@ config:
|
||||
ProtectSystem=full
|
||||
; … except /etc/ssl/traefik, because we want Letsencrypt-certificates there.
|
||||
; This merely retains r/w access rights, it does not add any new. Must still be writable on the host!
|
||||
ReadWriteDirectories=/etc/traefik/acme
|
||||
;ReadWriteDirectories=/etc/traefik/acme
|
||||
; The following additional security directives only work with systemd v229 or later.
|
||||
; They further restrict privileges that can be gained by traefik. Uncomment if you like.
|
||||
; Note that you may have to add capabilities required by any plugins in use.
|
||||
CapabilityBoundingSet=CAP_NET_BIND_SERVICE
|
||||
AmbientCapabilities=CAP_NET_BIND_SERVICE
|
||||
NoNewPrivileges=true
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
|
||||
- path: "/etc/traefik/traefik.yaml"
|
||||
owner: traefik:traefik
|
||||
permissions: "0644"
|
||||
content: |
|
||||
## Static configuration
|
||||
entryPoints:
|
||||
@@ -87,17 +99,17 @@ config:
|
||||
entryPoint:
|
||||
to: websecure
|
||||
scheme: https
|
||||
|
||||
|
||||
websecure:
|
||||
address: ":443"
|
||||
|
||||
|
||||
providers:
|
||||
file:
|
||||
directory: "./dynamic"
|
||||
|
||||
|
||||
log:
|
||||
level: DEBUG
|
||||
|
||||
|
||||
accessLog:
|
||||
filePath: "/var/log/traefik/access.log.json"
|
||||
format: "json"
|
||||
@@ -110,31 +122,34 @@ config:
|
||||
dashboard: true
|
||||
insecure: true
|
||||
|
||||
|
||||
runcmd:
|
||||
# Apply network config
|
||||
- [ netplan, generate ]
|
||||
- [ netplan, apply ]
|
||||
|
||||
# Install traefik binary
|
||||
- [ sleep, 5 ]
|
||||
- [ wget, "https://github.com/traefik/traefik/releases/download/v2.11.0-rc2/traefik_v2.11.0-rc2_linux_amd64.tar.gz", -O, /tmp/traefik.tar.gz ]
|
||||
- [ sleep, '5' ]
|
||||
- [ wget, 'https://github.com/traefik/traefik/releases/download/v2.11.0/traefik_v2.11.0_linux_amd64.tar.gz', -O, /tmp/traefik.tar.gz ]
|
||||
- [ tar, vxzf, /tmp/traefik.tar.gz, -C, /tmp ]
|
||||
- [ cp, /tmp/traefik, /usr/local/bin ]
|
||||
- [ chown, root:root, /usr/local/bin/traefik ]
|
||||
- [ chmod, 755, /usr/local/bin/traefik ]
|
||||
- [ chmod, '755', /usr/local/bin/traefik ]
|
||||
- [ setcap, 'cap_net_bind_service=+ep', /usr/local/bin/traefik ]
|
||||
# Prepare traefik config
|
||||
# => TODO : git clone
|
||||
- [ mkdir, -p, /etc/traefik ]
|
||||
- [ mkdir, -p, /etc/traefik/acme ]
|
||||
- [ mkdir, -p, /etc/traefik/dynamic ]
|
||||
- [ mkdir, -p, /var/log/traefik ]
|
||||
- [ chown, -R, root:root, /etc/traefik ]
|
||||
- [ chown, traefik:traefik, /etc/traefik/traefik.yaml ]
|
||||
- [ chmod, '640', '/etc/traefik/traefik.yaml' ]
|
||||
- [ chown, -R, traefik:traefik, /etc/traefik/acme ]
|
||||
- [ chown, -R, traefik:traefik, /etc/traefik/dynamic ]
|
||||
- [ chown, -R, traefik:traefik, /var/log/traefik ]
|
||||
# Enable and start the service
|
||||
- [ systemctl, daemon-reload ]
|
||||
- [ systemctl, enable, traefik.service ]
|
||||
- [ systemctl, enable, traefik.path ]
|
||||
- [ systemctl, start, traefik.path ]
|
||||
- [ systemctl, start, traefik.service ]
|
||||
|
||||
Reference in new issue
Block a user