Skip to content

Instantly share code, notes, and snippets.

@darshitvvora
Last active April 18, 2019 07:07
Show Gist options
  • Select an option

  • Save darshitvvora/e9e155ea17a79a1f61e87c25164f9d8e to your computer and use it in GitHub Desktop.

Select an option

Save darshitvvora/e9e155ea17a79a1f61e87c25164f9d8e to your computer and use it in GitHub Desktop.
Sample Linux service file - /etc/systemd/system
[Unit]
Description=API Server
After=syslog.target
[Service]
WorkingDirectory=/home/user/repo/api
ExecStart=/usr/local/bin/node server/boot
ExecReload=/usr/bin/kill -HUP $MAINPID
Restart=always
StandardOutput=syslog
StandardError=syslog
SyslogIdentifier=api
User=user
Group=user
Environment="APP_MAIN=server"
Environment="WORKER_COUNT=2"
EnvironmentFile=/home/user/repo/api/.env
[Install]
WantedBy=multi-user.target
@darshitvvora
Copy link
Author

darshitvvora commented Apr 18, 2019

Add boot.js in server folder. It is assume using angular full stack folder structure. This will spin API on 2 cores

boot.js script -https://gist.github.com/darshitvvora/7d49d7243ca1351ff4ecc5d7ca0adf2c

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment