From 025718cb12459b2984c24499a757004807a93fdc Mon Sep 17 00:00:00 2001 From: Marton Kiss Date: Tue, 3 Mar 2015 09:43:22 +0100 Subject: [PATCH] Added backup/recovery description to askbot migration spec This change provides a detailed description of askbot database and static files recovery, including the solr reindexing process. Change-Id: I3cc0cb616ceec7256edd4dc499d52dc6ca2aee0e --- specs/migrate_askbot.rst | 88 +++++++++++++++++++++++++++++++++++++++- 1 file changed, 87 insertions(+), 1 deletion(-) diff --git a/specs/migrate_askbot.rst b/specs/migrate_askbot.rst index 48f6c6e..dd35ff3 100644 --- a/specs/migrate_askbot.rst +++ b/specs/migrate_askbot.rst @@ -112,9 +112,95 @@ Askbot don't have integration tests implemented. After instance creation and initial data migration, I suggest to do a 1-2 week long silent test of the UI and address upcoming bugs during that period. +Backup / recovery steps +======================= + +Backup assets +------------- + +Askbot holds all of the site data in a postgresql database, and all static files +in the filesystem. In case of the existing deployment it is available at +/srv/ask/dumps directory. The dumps are created by the shell script +srv/ask/node2/cron/backup.sh executed daily by cron. + +Invoke management commands +-------------------------- + +The management cli tool is available under /srv/askbot-sites/slot0/config, so +to invoke management commands you need to enter this directory first. + + $ cd /srv/askbot-sites/slot0/config + $ python manage.py + +Stop celeryd and apache, jetty services +--------------------------------------- + + $ sudo service askbot-celeryd stop + $ sudo service apache2 stop + $ sudo service jetty stop + +Restore database dump +--------------------- + +Recreate an empty database: + + $ sudo su - postgres -c 'dropdb askbotdb' + $ sudo su - postgres -c 'createdb askbotdb --owner=ask' + +Restore from backup: + + $ psql -d askbotdb -h localhost -U ask -W -f /path/to/last-dump.sql + +`Notice` you will be prompted for the ask_db_password from hiera. + +Sync db and migrate: + + $ cd /srv/askbot-sites/slot0/config + $ sudo python manage.py syncdb + $ sudo python manage.py migrate + +`Notice` this step is required to apply schema changes between askbot versions. + +Start celeryd +------------- + + $ sudo service askbot-celeryd start + $ sudo service apache2 start + +Rebuild solr indexes +-------------------- + + $ sudo service jetty start + $ cd /srv/askbot-sites/slot0/config + $ sudo python manage.py askbot_rebuild_index -l en + $ sudo python manage.py askbot_rebuild_index -l zh + +Test the solr deployment, query string "sahara": + + $ curl "http://127.0.0.1:8983/solr/core-en/select/?fq=django_ct%3A%28askbot.thread%29&rows=10&q=%28sahara%29&start=0&wt=json&fl=%2A+score" + +`Notice` this query must return a non-empty resultset. + +Restart celeryd +--------------- + + $ sudo service askbot-celeryd restart + $ sudo service apache2 restart + +Restore static files +-------------------- + +Static files must be extracted into /srv/askbot-sites/slot0/upfiles directory. +It mostly holds profile pictures, and site logo, so if pictures not showing up +in the site those files are missing, or have a wrong file permission. + + $ cd /srv/askbot-sites/slot0 + $ sudo rm -rf upfiles + $ sudo tar xf /path/to/last-upfiles.tar --strip-components=2 + Dependencies ============ We are using vamsee-solr module 0.0.7 from puppetforge, and it is forcing Us to use solr 4.7.2 because 4.10.x requires some extra patches to work and -this upgrade also means a schema change. \ No newline at end of file +this upgrade also means a schema change.