Apollo Details
OnSite Deployment
Apollo Details
Customers have reported problems running Apollo as a service in Windows. The following methods have successfully been used as alternatives, with Method 1 being the preferred approach.
Note : You must upgrade your Apollo server to V6 in order to use OnSite V6.
Method 1
-
Install NSSM (https://nssm.cc/download). Download and extract into a directory, such as D:\directory\apps\nssm.
-
Open the command prompt and make sure to run as Administrator.
-
Go to NSSM Directory. For example, D:\directory\apps\nssm\win64
-
Run: nssm install Apollo "D:\directory\apps\nodejs\node.exe"
-
Run: nssm set Apollo AppDirectory "D:\directory\apps\apollo\src"
-
Run: nssm set Apollo AppParameters "index.js"
-
Run: nssm start Apollo
Method 2
-
Create a file in the root of the Apollo application folder called ApolloService.js
-
Paste the following into the file (make sure to update the script location)
//run Apollo as a windows service
var Service = require('node-windows').Service;
// Create Apollo Service object
var svc = new Service({
name:'Apollo',
description: 'Apollo app run as a service',
script: 'D:\\directory\\path\\onsite\\src\\index.js'
});
// Listen for the "install" event, which indicates the
// process is available as a service.
svc.on('install',function(){
svc.start();
}); svc.install();
-
Using CMD as Administrator run the following commands:
npm install -g node-windows
npm link node-windows
npm install node-windows
node ApolloService.js
Linux Service
Install Service for Linux environment Apollo app to run as service
sudo nano /etc/systemd/system/apollo.service
# Systemd unit file for Apollo
[Unit]
Description=Apollo app as service
After=network.target
[Service]
User=ec2-user
Type=simple
ExecStart=/usr/bin/node index.js
WorkingDirectory=/opt/apollo/
Restart=on-failure
[Install]
WantedBy=multi-user.target
Reload and restart service
sudo systemctl daemon-reload
sudo systemctl enable apollo
sudo systemctl status apollo
sudo systemctl start apollo