Skip to content

Commit c89c805

Browse files
author
Chris Stockton
committed
chore: set StartLimits for persistent services.
I've noticed all !oneshot services set a `RestartSec` of `3s` and we use the systemd defaults of `StartLimitBurst=5` and `StartLimitInterval=10s`. Together this forms a property that under typical conditions a service will be restarted indefinitely until it comes back up due to `(3s * 5) > 10s`, but it is still possible for a service to enter a failed state under some scenarios. This change defensively sets them to 0/0 to keep them in restart loops.
1 parent 7a62697 commit c89c805

File tree

6 files changed

+17
-3
lines changed

6 files changed

+17
-3
lines changed

ansible/files/adminapi.service.j2

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,8 @@ Description=AdminAPI
33
Requires=network-online.target
44
After=network-online.target
55

6-
# Move this to the Service section if on systemd >=250
7-
StartLimitIntervalSec=60
8-
StartLimitBurst=10
6+
StartLimitIntervalSec=0
7+
StartLimitBurst=0
98

109
[Service]
1110
Type=simple

ansible/files/nginx.service.j2

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@ Description=nginx server
33
After=postgrest.service gotrue.service adminapi.service
44
Wants=postgrest.service gotrue.service adminapi.service
55

6+
StartLimitIntervalSec=0
7+
StartLimitBurst=0
8+
69
[Service]
710
Type=forking
811
ExecStart=/usr/local/nginx/sbin/nginx -c /etc/nginx/nginx.conf

ansible/files/pg_egress_collect.service.j2

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
[Unit]
22
Description=Postgres Egress Collector
33

4+
StartLimitIntervalSec=0
5+
StartLimitBurst=0
6+
47
[Service]
58
Type=simple
69
ExecStart=/bin/bash -c "tcpdump -s 128 -Q out -nn -tt -vv -p -l 'tcp and (port 5432 or port 6543)' | perl /root/pg_egress_collect.pl"

ansible/files/postgres_exporter.service.j2

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
[Unit]
22
Description=Postgres Exporter
33

4+
StartLimitIntervalSec=0
5+
StartLimitBurst=0
6+
47
[Service]
58
Type=simple
69
ExecStart=/opt/postgres_exporter/postgres_exporter --disable-settings-metrics --extend.query-path="/opt/postgres_exporter/queries.yml" --disable-default-metrics --no-collector.locks --no-collector.replication --no-collector.replication_slot --no-collector.stat_bgwriter --no-collector.stat_database --no-collector.stat_user_tables --no-collector.statio_user_tables --no-collector.wal {% if qemu_mode is defined and qemu_mode %}--no-collector.database {% endif %}

ansible/files/postgrest.service.j2

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@ Description=PostgREST
33
Requires=postgrest-optimizations.service
44
After=postgrest-optimizations.service
55

6+
StartLimitIntervalSec=0
7+
StartLimitBurst=0
8+
69
[Service]
710
Type=simple
811
# We allow the base config (sent from the worker) to override the generated config

ansible/files/vector.service.j2

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ Documentation=https://vector.dev
44
After=network-online.target
55
Requires=network-online.target
66

7+
StartLimitIntervalSec=0
8+
StartLimitBurst=0
9+
710
[Service]
811
User=vector
912
Group=vector

0 commit comments

Comments
 (0)