haystack/eyebrowse-server — pull request #20 by amyxzhang (2013-11-16 04:48:50+00:00)
Title: 5 fabfile

Added a bunch of things here to make it easier for us to deploy and debug. I've also made a lot of changes to the eyebrowse-staging server and these changes need to happen before using fabfile to deploy to production server.

1. In staging, I created a virtualenv in /eyebrowse-virtualenv. Then I edited /etc/apache2/httpd.conf and added: `WSGIPythonPath /eyebrowse-server:/eyebrowse-virtualenv/lib/python2.6/site-packages`
Then restarted apache.

2. In staging, in /opt/eyebrowse, I created the files debug and file env. env should contain only the word 'prod' or 'dev'. debug should contain only the word 'true' or false'. In staging, env=prod and debug=true. In production, this should be env=prod, debug=false. the env flag is for things in settings such as DB, s3, etc while the debug flag is for things like logging, debug headers, bypassing caches, etc if we ever want to do that. In your local machine, you will need to create these files and they should be env=dev, debug=true.

3. I added log.py which is for us if we ever want to log debug statements in staging or log exceptions everywhere. Just do `from eyebrowse.log import logger`. The logger is logging to `/var/opt/eyebrowse/logs/eyebrowse.log`. The path to this file needs to be created in production. the folder `logs` needs to have full write permissions. You can see it in staging.

4. Added fabfile.py. To deploy new code and/or new requirements to a server, I run `fab amy staging deploy restart_apache`. Add your username if you want to deploy. Make sure you are in the main folder. And this deploys what you have in local. So what I would normally do in local is merge my new pull request. Then deploy to staging. Test it out (will be easier when we have a test suite!). Then if all is well, deploy to prod. And then push to github master.