Skip to content

Commit

Permalink
distribution(systemd): set start limit interval and burst
Browse files Browse the repository at this point in the history
Signed-off-by: Florentin Dubois <florentin.dubois@clever-cloud.com>
  • Loading branch information
FlorentinDUBOIS committed Nov 14, 2023
1 parent 9ab031b commit af5ea00
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 5 deletions.
14 changes: 12 additions & 2 deletions os-build/systemd/sozu.service
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,26 @@ Documentation=https://docs.rs/sozu/
After=network-online.target local-fs.target remote-fs.target time-sync.target
Wants=network-online.target local-fs.target remote-fs.target time-sync.target

StartLimitIntervalSec=10
StartLimitBurst=5

[Service]
RuntimeDirectory=sozu
Type=simple

RuntimeDirectory=sozu
PIDFile=/run/sozu/sozu.pid

ExecStartPre=/usr/bin/sozu config check --config /etc/sozu/config.toml
ExecStart=/usr/bin/sozu start --config /etc/sozu/config.toml
ExecReloadPre=/usr/bin/sozu config check --config /etc/sozu/config.toml
ExecReload=/usr/bin/sozu reload --config /etc/sozu/config.toml
Restart=on-failure

LimitNOFILE=65536

# Since systemd 229, should be in [Unit] but in order to support systemd <229,
# it is also supported to have it here.
StartLimitInterval=10
StartLimitBurst=5

[Install]
WantedBy=multi-user.target
15 changes: 12 additions & 3 deletions os-build/systemd/sozu@.service
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,26 @@ Documentation=https://docs.rs/sozu/
After=network-online.target local-fs.target remote-fs.target time-sync.target
Wants=network-online.target local-fs.target remote-fs.target time-sync.target

StartLimitIntervalSec=10
StartLimitBurst=5

[Service]
RuntimeDirectory=sozu-%i
Type=simple

RuntimeDirectory=sozu-%i
PIDFile=/run/sozu/sozu-%i.pid

ExecStartPre=/usr/bin/sozu config check --config /etc/sozu/%i.toml
ExecStart=/usr/bin/sozu start --config /etc/sozu/%i.toml
ExecReloadPre=/usr/bin/sozu config check --config /etc/sozu/%i.toml
ExecReload=/usr/bin/sozu reload --config /etc/sozu/%i.toml
Restart=on-failure

LimitNOFILE=65536

# Since systemd 229, should be in [Unit] but in order to support systemd <229,
# it is also supported to have it here.
StartLimitInterval=10
StartLimitBurst=5

[Install]
WantedBy=multi-user.target

0 comments on commit af5ea00

Please sign in to comment.