Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

This page provides technical notes on the process we went through to setup the technical systems.

...

Setting up an automatic SSH connection to SELV's host machine

SELV’s instance of PostgreSQL is not configured to allow for external connections. Instead, SELV’s host provides an SSH server through which external clients may establish a tunnel. By tunneling an arbitrary local port to localhost:5432 on SELV, clients may access its instance of PostgreSQL via SSH. The following steps describe how this was setup on the VAN-Dashboard's server.

#Install autossh
sudo add-apt-repository ppa:eugenesan/ppa
sudo apt-get update
sudo apt-get install autossh -y

...

#Manually run SSH to test it and accept the server’s RSA fingerprint
ssh -i ~/.ssh/selv -L 5431:localhost:5432 ec2-user@selv.villagereach.org
exit

#Define our service and its environment variables
sudo vim /etc/systemd/system/selv-dashboard-autossh.service
Add the content of selv-dashboard-autossh.service to the above file.

sudo vim /etc/default/selv-dashboard-autossh
Add the content of selv-dashboard-autossh to the above file.

#Reload service, set it to run at startup (“enable” it) and then start it
sudo systemctl daemon-reload
sudo systemctl enable selv-dashboard-autossh.service
sudo systemctl start selv-dashboard-autossh.service

#Verify that, because there's an SSH connection to SELV's host machine, the following command prompts you for a password
psql -h 127.0.0.1 -p 5431 -d open_lmis -U olreporter
 

#Verify that the above still works after a reboot
sudo reboot
psql -h 127.0.0.1 -p 5431 -d open_lmis -U olreporter

Ensuring that nginx launches when Ubuntu starts

...

After executing the above commands, I ran initialize_pav_database.sql.

Installing a local

...

NexLeaf Server

Code Block
languagebash
#Install NodeJS
sudo curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash - 
sudo apt-get install nodejs

#Retrieve and install the webapp
sudo git clone https://github.com/villagereach/van-dashboard-nexleaf.git 
sudo mv ./van-dashboard-nexleaf /opt/local_nexleaf_server 
cd /opt/local_nexleaf_server
sudo npm install

#Note that it will eventually be necessary to remove the test images in /opt/local_nexleaf_server/public/images/nexleaf_data
rm /opt/local_nexleaf_server/public/images/nexleaf_data/*.png

#To #Launchlaunch the webapp
node index.js manually to troubleshoot
#node index.js

Configuring the NexLeaf to Launch when Ubuntu Starts

Copy this file to /lib/systemd/system/local-nexleaf-server.service and then run the following commands.

Code Block
languagebash
#Reload the systemctl daemon and tell it to launch local-nexleaf-server upon system-start
sudo systemctl daemon-reload
sudo systemctl enable local-nexleaf-server

#Note that, to troubleshoot, you can manually start/stop/check/disable the service as follows
sudo systemctl stop local-nexleaf-server
sudo systemctl start local-nexleaf-server
sudo systemctl status local-nexleaf-server
sudo systemctl disable local-nexleaf-server