roles/node_stuff/templates/node.service.j2 (view raw)
1[Unit]
2Description=A NodeJS project.
3After=syslog.target network.target
4
5[Service]
6Type=simple
7Restart=on-failure
8StartLimitBurst=2
9# Restart, but not more than once every x seconds: 30=30s, 600=10m
10StartLimitInterval=30
11WorkingDirectory={{ repo_dir }}{{ item }}
12ExecStart=/usr/bin/npm start
13User={{ user }}
14StandardOutput=syslog
15StandardError=syslog
16SyslogIdentifier= {{ item }}
17
18[Install]
19WantedBy=multi-user.target