feat(profiles): Mise à jour du profile pour traefik
This commit is contained in:
1 parent
6f7c0ee078
commit
510dadb00d
2 files changed
+35
-62
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
|
- tar
|
||||||
- unzip
|
- unzip
|
||||||
- wget
|
- wget
|
||||||
|
- git
|
||||||
|
|
||||||
# Users
|
# Users
|
||||||
users:
|
users:
|
||||||
@@ -25,36 +26,47 @@ config:
|
|||||||
|
|
||||||
# Configure second network interface
|
# Configure second network interface
|
||||||
write_files:
|
write_files:
|
||||||
- path: "/etc/netplan/eth1.yaml"
|
- path: "/etc/systemd/system/traefik.path"
|
||||||
|
owner: root:root
|
||||||
permissions: "0644"
|
permissions: "0644"
|
||||||
content: |
|
content: |
|
||||||
network:
|
[Unit]
|
||||||
version: 2
|
Description="Monitor the traefik config files"
|
||||||
ethernets:
|
After=network-online.target
|
||||||
eth1:
|
Wants=network-online.target systemd-networkd-wait-online.service
|
||||||
dhcp4: true
|
|
||||||
|
[Path]
|
||||||
|
PathModified=/etc/traefik/traefik.yaml
|
||||||
|
PathModified=/etc/traefik/dynamic
|
||||||
|
Unit=traefik.service
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
||||||
|
|
||||||
- path: "/etc/systemd/system/traefik.service"
|
- path: "/etc/systemd/system/traefik.service"
|
||||||
owner: root:root
|
owner: root:root
|
||||||
permissions: "0644"
|
permissions: "0644"
|
||||||
content: |
|
content: |
|
||||||
[Unit]
|
[Unit]
|
||||||
Description=traefik proxy
|
Description="traefik proxy service"
|
||||||
After=network-online.target
|
After=network-online.target
|
||||||
Wants=network-online.target systemd-networkd-wait-online.service
|
Wants=network-online.target systemd-networkd-wait-online.service
|
||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
Restart=on-abnormal
|
|
||||||
|
|
||||||
; User and group the process will run as.
|
; User and group the process will run as.
|
||||||
User=traefik
|
;User=traefik
|
||||||
Group=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.
|
; 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.
|
; Limit the number of file descriptors; see `man systemd.exec` for more limit settings.
|
||||||
LimitNOFILE=1048576
|
LimitNOFILE=1048576
|
||||||
|
|
||||||
|
Restart=on-abnormal
|
||||||
|
|
||||||
; Use private /tmp and /var/tmp, which are discarded after traefik stops.
|
; Use private /tmp and /var/tmp, which are discarded after traefik stops.
|
||||||
PrivateTmp=true
|
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.)
|
; 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
|
ProtectSystem=full
|
||||||
; … except /etc/ssl/traefik, because we want Letsencrypt-certificates there.
|
; … 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!
|
; 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.
|
; 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.
|
; 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.
|
; Note that you may have to add capabilities required by any plugins in use.
|
||||||
CapabilityBoundingSet=CAP_NET_BIND_SERVICE
|
CapabilityBoundingSet=CAP_NET_BIND_SERVICE
|
||||||
AmbientCapabilities=CAP_NET_BIND_SERVICE
|
AmbientCapabilities=CAP_NET_BIND_SERVICE
|
||||||
NoNewPrivileges=true
|
NoNewPrivileges=true
|
||||||
|
|
||||||
[Install]
|
[Install]
|
||||||
WantedBy=multi-user.target
|
WantedBy=multi-user.target
|
||||||
|
|
||||||
- path: "/etc/traefik/traefik.yaml"
|
- path: "/etc/traefik/traefik.yaml"
|
||||||
owner: traefik:traefik
|
|
||||||
permissions: "0644"
|
|
||||||
content: |
|
content: |
|
||||||
## Static configuration
|
## Static configuration
|
||||||
entryPoints:
|
entryPoints:
|
||||||
@@ -110,31 +122,34 @@ config:
|
|||||||
dashboard: true
|
dashboard: true
|
||||||
insecure: true
|
insecure: true
|
||||||
|
|
||||||
|
|
||||||
runcmd:
|
runcmd:
|
||||||
# Apply network config
|
# Apply network config
|
||||||
- [ netplan, generate ]
|
- [ netplan, generate ]
|
||||||
- [ netplan, apply ]
|
- [ netplan, apply ]
|
||||||
|
|
||||||
# Install traefik binary
|
# Install traefik binary
|
||||||
- [ sleep, 5 ]
|
- [ 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 ]
|
- [ 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 ]
|
- [ tar, vxzf, /tmp/traefik.tar.gz, -C, /tmp ]
|
||||||
- [ cp, /tmp/traefik, /usr/local/bin ]
|
- [ cp, /tmp/traefik, /usr/local/bin ]
|
||||||
- [ chown, root:root, /usr/local/bin/traefik ]
|
- [ 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 ]
|
- [ setcap, 'cap_net_bind_service=+ep', /usr/local/bin/traefik ]
|
||||||
# Prepare traefik config
|
# Prepare traefik config
|
||||||
|
# => TODO : git clone
|
||||||
- [ mkdir, -p, /etc/traefik ]
|
- [ mkdir, -p, /etc/traefik ]
|
||||||
- [ mkdir, -p, /etc/traefik/acme ]
|
- [ mkdir, -p, /etc/traefik/acme ]
|
||||||
- [ mkdir, -p, /etc/traefik/dynamic ]
|
- [ mkdir, -p, /etc/traefik/dynamic ]
|
||||||
- [ mkdir, -p, /var/log/traefik ]
|
- [ mkdir, -p, /var/log/traefik ]
|
||||||
- [ chown, -R, root:root, /etc/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/acme ]
|
||||||
- [ chown, -R, traefik:traefik, /etc/traefik/dynamic ]
|
- [ chown, -R, traefik:traefik, /etc/traefik/dynamic ]
|
||||||
- [ chown, -R, traefik:traefik, /var/log/traefik ]
|
- [ chown, -R, traefik:traefik, /var/log/traefik ]
|
||||||
# Enable and start the service
|
# Enable and start the service
|
||||||
- [ systemctl, daemon-reload ]
|
- [ systemctl, daemon-reload ]
|
||||||
- [ systemctl, enable, traefik.service ]
|
- [ systemctl, enable, traefik.path ]
|
||||||
|
- [ systemctl, start, traefik.path ]
|
||||||
- [ systemctl, start, traefik.service ]
|
- [ systemctl, start, traefik.service ]
|
||||||
|
|
||||||
Reference in new issue
Block a user