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 run initialize_pav_database.sql.
Installing a local NexLeaf Server
...
Code Block | ||
---|---|---|
| ||
#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 |
Installing the Admin-UI App Server
Copy the files within van-dashboard-admin-app to /opt/settings-server/
Move /opt/settings-server/support_files/van-dashboard-admin.service to the /lib/systemd/system directory.
Code Block | ||
---|---|---|
| ||
#Install the nodejs app cd /opt/settings-server/ npm install #Install the service for it sudo systemctl daemon-reload sudo systemctl enable van-dashboard-admin |
Installing DHIS-2 ("SIS-MA") Report Parsing Scripts
Copy the dhis2_html_parser directory along with its contents to /opt and then run:
Code Block | ||
---|---|---|
| ||
npm install |
Installing Database Backup Scripts
Please note that files referenced below are stored in our repository's database_backup_scripts directory.
Code Block |
---|
sudo mkdir -p /var/lib/pgsql/bin
sudo chown ubuntu /var/lib/pgsql
# Copy aws_s3_sync.sh, pg_backup.config, and pg_backup_rotated.sh into /var/lib/pgsql/bin/
chmod +x /var/lib/pgsql/bin/pg_backup_rotated.sh
chmod +x /var/lib/pgsql/bin/aws_s3_sync.sh
pip install awscli
mkdir ~/.aws
# Copy the file called "credentials" to ~/.aws
chown ubuntu ~/.aws/
chown ubuntu ~/.aws/credentials
#Add the following to the crontab for the ubuntu user:
5 21 * * * /var/lib/pgsql/bin/aws_s3_sync.sh
#Note that NiFi is expected to call /var/lib/pgsql/bin/pg_backup_rotated.sh itself prior to changing database state. |