[Unit]
Description=RocketChat Server (follower, depending on main service)
After=network.target
Wants=network-online.target
Wants=systemd-networkd-wait-online.service
PartOf=rocketchat.service

[Service]
# Overwrite BIND_IP from config files with instance name. We cannot use
# Environment for this, since EnvironmentFile takes precedence over it.
ExecStart=env BIND_IP=%I /usr/bin/node /usr/share/rocketchat/bundle/main.js
Restart=on-failure
RestartSec=10
ExecReload=/bin/kill -USR1 $MAINPID
SyslogIdentifier=rocketchat

Environment=NODE_ENV=production
EnvironmentFile=/etc/rocketchat.conf
EnvironmentFile=/etc/rocketchat-follower.conf

DynamicUser=true
PrivateUsers=true
CapabilityBoundingSet=
NoNewPrivileges=true
RemoveIPC=true
LockPersonality=true
ProtectControlGroups=true
ProtectKernelTunables=true
ProtectKernelModules=true
ProtectKernelLogs=true
ProtectClock=true
ProtectHostname=true
ProtectProc=noaccess
RestrictRealtime=true
RestrictSUIDSGID=true
RestrictNamespaces=true
ProtectSystem=strict
ProtectHome=true
PrivateTmp=true
PrivateDevices=true
SystemCallArchitectures=native
SystemCallFilter=@system-service

[Install]
WantedBy=rocketchat.service