-
Notifications
You must be signed in to change notification settings - Fork 6
Home
The server uses nginx as a web server, with a reverse proxy through gunicorn.
- nginx config location:
/etc/nginx/nginx.conf
- The nginx config includes /etc/nginx/site-enabled`
Gunicorn runs without a config.
It is loaded in the github post-receive hook, located at/home/ubuntu/git/call-tool.git/hooks/post-receive
After you have cloned the repo, you then add the production remote:
git remote add production ubuntu@<ec2address.com>:/home/ubuntu/git/call-tool.git
At the time of writing, the ec2 address was ec2-54-219-216-34.us-west-1.compute.amazonaws.com
Then you can simply deploy the latest commit by pushing
git push production master
This triggers /home/ubuntu/git/call-tool.git/post-receive
The post-receive file:
-
Loads
$HOME/.profile
which contains environment variables and secrets, including the Sunlight and Twilio API keys, and the secret key required to access the /stats URL. -
Shuts down any gunicorn processes
-
Runs setup scripts
-
Restarts gunicorn again.
- Nginx logs can be found in
/var/log/nginx
- Gunicorn logs are disabled by default but can be enabled by adding the
--log-file gunicorn.log
flag in the post-receive file.
The easiest way to restart the server is simply to run the post-receive hook.
There are no scripts to create the server, simply create an image from within AWS and use the AMI to build new machines. Hopefully we can Dockerize this service in the future to reduce provisioning friction.