Represent and openparliament.ca currently share two: a large dedicated server, alpheus, and a smaller virtual server, tempeh. The servers are configured identically, except that PostgreSQL on tempeh has streaming replication set up with alpheus (meaning that the Represent database on tempeh is read-only). If alpheus goes down, Represent fails over to tempeh (see below). The servers run Nginx, PostgreSQL 9.6, PostGIS 2.3, and Memcached.
This directory contains some server configuration files.
The represent user's directory contains:
app/: a clone of represent-canadaapp/represent/settings.py: a copy ofsettings.py.examplewith appropriate changesapp/data/shapefiles/public: a symlink to a clone ofrepresent-canada-dataapp/data/shapefiles/private: a symlink to a clone ofrepresent-canada-private-datalogs/: Gunicorn and Nginx log filesssl/: public key certificates- a clone of represent-canada-data
- a clone of
represent-canada-private-data represent-env/: a Python 3.5 virtualenv
The represent user's crontab contains:
MAILTO=represent@opennorth.ca
0 4 * * * /home/represent/.virtualenvs/app35/bin/python /home/represent/app/manage.py updaterepresentatives
Add the maintainer's public key to represent's .ssh/authorized_keys on alpheus and tempeh
It's generally unnecessary to login to servers, as regular tasks can be done with Fabric. See fabfile.py for details.
brew install Fabric
The two most common tasks are to deploy code and update boundaries.
Run fab alpheus deploy to update the deployment; occasionally, update the deployment on tempeh (fab tempeh deploy).
Run fab alpheus update_boundaries to update the boundaries. You can pass arguments like:
fab alpheus update_boundaries:args="--merge union -d data/shapefiles/public/boundaries/ocd-division/country:ca/2013"
opennorth.ca has a hosted zone and health check in AWS Route 53. Notably:
represent-alpheus.opennorth.ca.aliasesalpheus.opennorth.ca.represent-tempeh.opennorth.ca.aliasestempeh.opennorth.ca.represent.opennorth.ca.aliasesrepresent-alpheus.opennorth.ca.- TTL: 60, Routing Policy: Failover, Failover Record Type: Primary
represent.opennorth.ca.aliasesrepresent-tempeh.opennorth.ca.- TTL: 60, Routing Policy: Failover, Failover Record Type: Secondary
A health check named represent-alpheus.opennorth.ca monitors an endpoint specified by domain name using the HTTP protocol. The domain name is represent-alpheus.opennorth.ca and the port is 80.