-
Notifications
You must be signed in to change notification settings - Fork 1
OS: Ubuntu Server 18.04
This is a guide specifically for setting up a production ready Helios server on Ubuntu 18.04.
Helios is written in JavaScript and runs best on Node.JS 10. Let's get started by installing this version of node:
curl -sL https://deb.nodesource.com/setup_10.x | sudo -E bash -
sudo apt-get update
sudo apt-get install -y nodejs
sudo setcap 'cap_net_bind_service=+ep' /usr/bin/node
Helios uses MongoDB as its database. MongoDB is a powerful NoSQL database that supports advanced features like sharding and master/slave replication. For our purpose we will simply install an isolated local database.
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 9DA31620334BD75D9DCB49F368818C72E52529D4
echo "deb [ arch=amd64 ] https://repo.mongodb.org/apt/ubuntu bionic/mongodb-org/4.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-4.0.list
sudo apt-get update
sudo apt-get install -y mongodb-org
FIXME: A proper explanation on how to setup MongoDB as a service that automatically starts. I end up creating a new db user and adding the following service, and put the mongodb config in the users home. However this is probably not the standard way of doing this.
# /etc/systemd/system/mongodb.service
[Unit]
Description=Database for Helios
After=network.target
[Service]
User=db
Group=db
ExecStart=/usr/bin/mongod --config /home/db/mongod.conf
Restart=always
RestartSec=3
[Install]
WantedBy=multi-user.target
# /home/db/mongod.conf
# for documentation of all options, see:
# http://docs.mongodb.org/manual/reference/configuration-options/
storage:
dbPath: /home/db/mongodb
journal:
enabled: true
systemLog:
destination: file
logAppend: true
path: /home/db/mongod.log
net:
port: 27017
bindIp: 127.0.0.1
processManagement:
timeZoneInfo: /usr/share/zoneinfo
mkdir /home/db/mongodb
Make sure the user db owns the directory & .conf file!
Create a new user called "helios" and log into it.
adduser helios
su - helios
Then go ahead and clone the repository into the user's home directory.
git clone https://github.com/PatrickSachs/helios
cd helios
Now go ahead and configure your server using the "Getting Started" tutorial, but do not run it yet(no npm run start
).
Compile the server(AFTER adjusting the configuration files):
npm i --prefix /home/helios/helios
npm run build --prefix /home/helios/helios
Now we have to setup Helios to automatically run on startup and automatically restart should it be daring enough to crash.
To do this log back into the root account and follow these steps:
cd /etc/systemd/system/
nano helios.service
Go ahead and insert the following configuration into it:
[Unit]
Description=Helios
After=network.target mongodb.service
[Service]
User=helios
Group=helios
ExecStart=/usr/bin/npm run start --prefix /home/helios/helios
Restart=always
RestartSec=3
[Install]
WantedBy=multi-user.target
Now let's put the whole thing to test and enable the services, and then reboot the server to see how it fares!
systemctl enable mongodb.service
systemctl enable helios.service
reboot
Helios should now be up and running.
- Getting Started
- Configuration
- OS specific guides
- Production
- Development/Test
- Your Corporate Identity