unsupported: Digital Ocean Setup - theRAPTLab/gsgo GitHub Wiki

Rough instructions for setting up a Digital Ocean Server to run GEM-STEP.

IMPORTANT: GEM-STEP was designed to work on a Local Area Network. While it's possible to run the server across a Wide Area Network ala Digital Ocean, performance and security can be problematic.

Updated 2020-12/18

Create a project

Create a Droplet

Ubuntu 20.04 x64
Starter: Standard
$5/mo
Data Center Region: NYC3
Use an ssh key
Name: gemstep-2020-ubuntu-s-1vcpu-1gb-nyc3-01

To SSH in:
ssh -i ~/.ssh/<yourkey> [email protected]

Install Repo

git clone https://gitlab.com/stepsys/gem-step/gsgo.git
cd gsgo
git checkout dev

Install NVM / Node

DO Instructions setting up Node (Follow the NVM instructions)

sudo apt-get update
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.37.2/install.sh | bash

Log out and back in to set environment vars, or
    export NVM_DIR="$HOME/.nvm"
    [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"  # This loads nvm
    [ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"  # This loads nvm bash_completion

nvm install v12.14.1

Open Ports

DO Instructions for opening a port in node

ufw enable
ufw allow from 50.78.100.230 to any port 22
ufw allow 80
ufw allow 2525/tcp
ufw allow 2929/tcp
ufw allow 2930/tcp
ufw allow 3030/tcp

Use ufw status to check your settings.

Expand the number of required iNotify wachers

Explanation here

sudo sh -c "echo fs.inotify.max_user_watches=524288 >> /etc/sysctl.conf"
sudo sysctl -p

Init and Start

npm ci
npm run bootstrap
npm start

Set up a start script

Create a script do-start.sh:

#!/bin/bash

echo "Starting GEM-STEP..."
npm run gem

Make it executable

chmod u+x do-script.sh

Start it up with pm2 and set it load on reboot

npm install pm2@latest -g
pm2 start do-start.sh
pm2 startup systemd
pm2 save

Helpful commands:

pm2 status -- Lists status of programs
pm2 reload do-start.sh
pm2 reload all

Make sure it's running

reboot
systemctl status pm2-root

Updates

The do-start.sh script only runs npm run gem. So if you update the code, make sure you do all necessary cleaning/installing, e.g.

npm ci
npm run bootstrap
pm2 reload all
⚠️ **GitHub.com Fallback** ⚠️