freeradiantbunny iconfreeradiantbunny.org

freeradiantbunny.org/blog

How To Build a Stock Back-End Server

This doc uses digitalocean.com 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_droplet_freeradiantbunnuyt.pl
./create_droplet_chainlink_node.pl
# 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 digitalocean.com via email account
use Putty to login to root
# system will prompt to change root password

# create user
use FileZilla to upload create_user.pl
use FileZilla to upload /etc/letsencrypt

#use Putty to 
chmod 700 create_user.pl
./create_user.pl
# system will prompt to set user password

# set networking using digitalocean.com website
set networking domain_name mudia.link 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 digitalocean.com access panel
chmod 600 .ssh/id_rsa_bitbucket 
chmod 600 .ssh/id_rsa
chmod 700 setup_frb_server.pl
chmod 700 setup_chainlink_server.pl

# run setup script
./setup_frb_server.pl
./setup_chainlink_server.pl

# update ip address
emacs .freeradiantbunny/config.js

# check website
use browser to visit https://mudia.link/index.html

# 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
./startup_pm2.txt

# reboot
poweroff
# spin up server
# go to digitalocean.com control panel and spinup server

# check website
use browser to visit https://mudia.link/index.html

# install frb database
$SUDO SU POSTGRES
postgres$createuser freerad2_special
postgres$psql
postgres#create database freerad2_frbfrb;
postgres#grant all privileges on database freerad2_frbfrb to freerad2_special;
postgres#password freerad2_special
postgres#password postgres
postgres#\q
postgres$exit

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 db_backup.pl
./db_backup.pl

# add db_backup script to crontab
sudo crontab -e

Related Links

Setting Up a Chainlink Node



[TOP]