-
-
Save oraclejavanet/1756edbe0a6ba929b4ad0564151d67f1 to your computer and use it in GitHub Desktop.
Install a Node.js service for systemctl on CentOS 7
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Unit] | |
After=network.target | |
[Service] | |
ExecStart=/usr/bin/node /var/node/my-service/app.js | |
#Type=forking | |
Restart=always | |
StandardOutput=syslog | |
TimeoutSec=90 | |
SyslogIdentifier=my-service | |
User=nobody | |
Group=nobody | |
Environment=PATH=/usr/bin:/usr/local/bin | |
Environment=NODE_ENV=production | |
[Install] | |
WantedBy=multi-user.target |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/bash | |
curl -sL https://rpm.nodesource.com/setup | bash - | |
yum install -y nodejs gcc-c++ make | |
sudo mkdir -p /var/node/my-service/ | |
# ... cp project into /var/node/my-service/ | |
cd /var/node/my-service/ | |
npm install | |
sudo cp my-service.service /etc/systemd/system/ | |
systemctl enable my-service | |
systemctl start my-service.service |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment