Useful information for running releases on production
- note that some files on production will not appear when running git status because of the lines included on .git/info/exclude (e.g., media/uploads/images/**/*, media/uploads/files/**/*)
- make int can be used to update the django.po and django.mo translation files
- dependencies on git repositories aren’t fixed to a specific release, include -e VCS+REPOS_URL[@REV]#egg=PACKAGE if neccesary
- in order to update the release branch, you will first need (if it is the first time you work with the release branch) to setup that branch in your local machine (http://gitready.com/beginner/2009/03/09/remote-tracking-branches.html), then you can merge from master to release so the release branch includes the last version of lernanta
- useful information for tagging the last commit of a release can be found at http://learn.github.com/p/tagging.html
- to see the changes to the models since the last commit you can use git diff [last commit id] $(find . -name models.py)
- use python manage.py sqlall app_name (need to have the mysql configuration enabled on your local dev environment so it outputs sql appropiate for the server) to see the definition of tables and columns
- use describe (http://dev.mysql.com/doc/refman/5.0/en/describe.html), show create table (http://dev.mysql.com/doc/refman/5.0/en/show-create-table.html) and/or show index from (http://dev.mysql.com/doc/refman/5.0/en/show-index.html) mysql queries to see the existing database structure
- use alter table (http://dev.mysql.com/doc/refman/5.1/en/alter-table.html), rename table (http://dev.mysql.com/doc/refman/5.0/en/rename-table.html) among other mysql queries to modify existing tables
- the password associated with the ssl certificate will be neccesary to restart apache so you will need to have it at hand before running /etc/init.d/apache2 restart
- add your email to the ADMINS conf in settings_local.py to receive notification emails from django when there is a 500 error
- see apache logs with tail -f /var/log/apache2/lernanta-error.log
- extra configuration related to the setup in production can be found at /etc/default/celeryd, /etc/apache2/sites-available/lernanta, /etc/apache2/sites-available/lernanta-ssl
- to restart celeryd use /etc/init.d/celeryd restart
- to get access to the django shell on production use python manage.py shell with the virtualenv activated (~/Envs/lernanta13).
- to make a copy of the lernanta db use mysqldump
- to create a database for lernanta in mysql use CREATE DATABASE <dbname> CHARACTER SET utf8;
- to load a backup into a database run from the bash shell mysql -u root -p <dbname> < backup.sql or from the mysql shell use <dbname> and source backup.sql
- use the MAINTENANCE_MODE on settings_local.py to show a down for manteinance page to all users except site-admins
- use touch wsgi/production.wsgi to reload wsgi each time you need a change to the code to become active (changes to templates do not require this step)
- use tar -cvvzf lernanta-backup.tar.gz lernanta/ to backup the whole lernanta directory with the code, uploaded files, settings_local.py conf, ...
- use git stash and git pull to update the code from the release branch (do not forget to touch wsgi/production.wsgi)
- consult http://p2pu.lighthouseapp.com/projects/71002/tickets/426-automate-anonymization-of-a-copy-of-the-database if you need to get an anonymized version of the db
- consult http://p2pu.lighthouseapp.com/projects/71002/tickets/254-automate-participants-migration if you need to obtain metrics from archive.p2pu.org