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
...
Code Block | ||
---|---|---|
| ||
#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
#Launch the webapp
cd /opt/local_nexleaf_server
node index.js |