Skip to content

Commands for Server Maintenance

Aaron Rudkin edited this page Feb 10, 2021 · 15 revisions

To restart the mongod server: sudo service mongod restart

To stop the site: sudo service nginx stop

To restart the site: sudo service nginx restart

To do a quick reload of Bottle/UWSGI (for code changes to model or app.py) sudo touch /etc/uwsgi/reboot

If a quick reload is insufficient, try: sudo service uwsgi restart

On occasion, the SSL certificates expire denying users access to the sites. Those certificates are supposed to update via cron, but if they expire they can be re-issued manually with: sudo /opt/letsencrypt/letsencrypt-auto renew --post-hook "service nginx reload"

Deployments

Full deployment: to deploy, first ensure that the dev branch of WebVoteView is pulled into master, and then connect to the production server and run as root: /var/www/DEPLOY. This will move over all of the code and the entire mongo db to the production server.

Patch deployment: connect to the production server and run as root /var/www/DEPLOY_HOURLY. There should be a cron job doing this already. It will check for the existence of /usr/scripts/voteview_metadata/hourly_backup/patch.zip which is created by a call to READ_MANIFEST in that same folder which is supposed to be called by /usr/scripts/voteview_metadata/updateDB/UPDATE.

Ingestion

If ingestion breaks, look on dev at /usr/scripts/log/update.log for an explanation. Fix the problem and restart the process by running cd /usr/scripts/voteview_metadata && sudo -u voteview ./updateDB/UPDATE.

Writer

To regenerate all the output files, run on dev rm -r /var/www/voteview/static/data/out && sudo -u voteview /usr/scripts/voteview_metadata/venv/bin/voteview_writer --congresses=all /var/www/voteview/static/data/out/. Regenerating output files for all congresses will take some hours.