How To Build a Stock Back-End Server

This doc uses and builds a droplet automatically.

Note: Use the green commands to build a website. Use the blue commands to build a server that can be used for a Chainlink node.

Don't have a digitalocean account? Support this website by signing up to digitalocean using this site's associate code and activate a free credit. Thanks for your support.

# create droplet
# use alldrop server
cd ~/devops/digital_ocean_api/
# get a list of available images on digitalocean
doctl compute image list
# create database cluster by hand
# copy database connection string to _user connection_string.txt
# record cost droplat (rate and start timestamp)
# record cost database (rate and start timestamp)

# change root pw
get email from via email account
use Putty to login to root
# system will prompt to change root password

# create user
use FileZilla to upload
use FileZilla to upload /etc/letsencrypt

#use Putty to 
chmod 700
# system will prompt to set user password

# set networking using website
set networking domain_name to point new droplet

# set up system in user dir
use FileZilla to upload many _user files to /home/nodemaster/

# fix nodejs issues 
# objective: delete the pm2 hello server
# use Filezilla as root to download /root/.digitalocean_passwords
# use Notepad to copy password to buffer
# use Putty as nodemaster to log in as nodejs
$su nodejs
nodejs>cd /var/www/html
nodejs>pm2 list
nodejs>pm2 delete hello
nodejs>pm2 save --force
# deluser nodejs
# delete the /home/nodejs

# change permissions
# use access panel
chmod 600 .ssh/id_rsa_bitbucket 
chmod 600 .ssh/id_rsa
chmod 700
chmod 700

# run setup script

# update ip address
emacs .freeradiantbunny/config.js

# check website
use browser to visit

# start server.js on boot
cd freeradiantbunny.node
pm2 start server.js
pm2 list
pm2 save

# set up service so that pm2 starts on boot
pm2 startup > startup_pm2.txt
chmod 700 startup_pm2.txt

# reboot
# spin up server
# go to control panel and spinup server

# check website
use browser to visit

# install frb database
postgres$createuser freerad2_special
postgres#create database freerad2_frbfrb;
postgres#grant all privileges on database freerad2_frbfrb to freerad2_special;
postgres#password freerad2_special
postgres#password postgres

sudo emacs /etc/postgresql/10/.../pg_hda.conf (change postgres & local peer to md5)
sudo systemctl restart postgresql

cd ~/db/freerad2_frbfrb/seeds
psql -W -U freerad2_special freerad2_frbfrb < dump...sql 2> errors.txt

# test database backup
# add db pw to pgpass
emacs ~/.pgpass
cd ~/db/freerad2_frbfrb
chmod 700

# add db_backup script to crontab
sudo crontab -e

Related Links

Setting Up a Chainlink Node