ansible-minio/templates/minio.service.j2
Sébastien c26ce825a9 Systemd service: Restart=always (#36)
- add StartLimitIntervalSec and StartLimitBurst to avoid noisy crashloops
2019-07-23 17:09:34 +02:00

52 lines
1.2 KiB
Django/Jinja

{{ ansible_managed | comment }}
[Unit]
Description=Minio
Documentation=https://docs.minio.io
Wants=network-online.target
After=network-online.target
AssertFileIsExecutable={{ minio_server_bin }}
# Avoid noisy crashloops
StartLimitIntervalSec=60
StartLimitBurst=5
[Service]
WorkingDirectory=/usr/local/
User={{ minio_user }}
Group={{ minio_group }}
PermissionsStartOnly=true
EnvironmentFile={{ minio_server_envfile }}
ExecStartPre=/bin/bash -c "[ -n \"${MINIO_VOLUMES}\" ] || echo \"Variable MINIO_VOLUMES not set in {{ minio_server_envfile }}\""
ExecStart={{ minio_server_bin }} server $MINIO_OPTS $MINIO_VOLUMES
# Let systemd always restart this service, in limits defined by StartLimitIntervalSec and StartLimitBurst.
Restart=always
StandardOutput=journal
StandardError=inherit
# Specifies the maximum file descriptor number that can be opened by this process
LimitNOFILE=65536
# Disable timeout logic and wait until process is stopped
TimeoutStopSec=0
# SIGTERM signal is used to stop Minio
KillSignal=SIGTERM
SendSIGKILL=no
SuccessExitStatus=0
{% if (minio_server_addr.split(':')[-1] | int) < 1024 %}
AmbientCapabilities=CAP_NET_BIND_SERVICE
{% endif %}
[Install]
WantedBy=multi-user.target