When Sahana Eden has been deployed, then you need to ensure that the system Availability is maintained through any upgrades and that the Data Integrity isn't compromised by ensuring regular Backups are taken.
Backups are generally done by dumping the SQL to the filesystem & then copying to tape from there. Also remember to backup the contents of the uploads/ folder
# Schedule backups for 02:01 daily echo "1 2 * * * * root /usr/local/bin/backup" >> "/etc/crontab"
There are a number of useful maintenance scripts which are added to /usr/local/bin by the installation scripts.
(Examples shown are for Apache/MySQL, variants are available for Cherokee and/or PostgreSQL.)
This script is used to reset an instance to default values, which may include 'prepopulated' data specific to this deployment.
#!/bin/sh /usr/local/bin/maintenance cd ~web2py/applications/eden rm -f databases/* rm -f errors/* rm -f sessions/* rm -f uploads/* sed -i 's/deployment_settings.base.migrate = False/deployment_settings.base.migrate = True/g' models/000_config.py sed -i 's/deployment_settings.base.prepopulate = 0/deployment_settings.base.prepopulate = 1/g' models/000_config.py rm -rf compiled mysqladmin -f drop sahana mysqladmin create sahana cd ~web2py sudo -H -u web2py python web2py.py -S eden -M -R applications/eden/static/scripts/tools/noop.py cd ~web2py/applications/eden sed -i 's/deployment_settings.base.migrate = True/deployment_settings.base.migrate = False/g' models/000_config.py sed -i 's/deployment_settings.base.prepopulate = 1/deployment_settings.base.prepopulate = 0/g' models/000_config.py /usr/local/bin/maintenance off /usr/local/bin/compile
w2pThis script is used to open a Python shell in the web2py environment. This allows database migration scripts to be developed interactively.
#!/bin/sh cd ~web2py python web2py.py -S eden -M
compileThis script is used to compile the Python code so that changes are visible to users (until this time, chages to .py files aren't seen by users). It is called automatically from the 'pull' and 'clean' scripts.
#!/bin/sh cd ~web2py python web2py.py -S eden -R applications/eden/static/scripts/tools/compile.py apache2ctl restart
maintenanceThis script is used to put the site into 'maintenance' mode & restore it to normal operations. It is usually called from the clean & compile scripts.
#!/bin/sh if [ "" != "off" ] then a2dissite maintenance a2ensite production cd ~web2py && sudo -H -u web2py python web2py.py -K eden -Q >/dev/null 2>&1 & else killall -u web2py python a2ensite maintenance a2dissite production fi apache2ctl restart
backupThis does a dump of the SQL database so that it can be backed-up to tape. It is usually called from Cron.
#!/bin/sh NOW=$(date +"%Y-%m-%d") mysqldump sahana > /root/backup-$NOW.sql OLD=$(date --date='7 day ago' +"%Y-%m-%d") rm -f /root/backup-$OLD.sql
This is an alternate Webserver configuration which blocks user access to the application so that upgrades can be done safely. Users see a simple holding page which asks them to try again later. This is (de-)activated by the 'maintenance' script, which is usually called from the 'pull' script.
Tip: It is still possible for administrators to access phpMyAdmin for MySQL database administration whilst the application is offline.
Simple upgrades can be done by running
git pull upstream
If there is a database migration required then this will require extra work. It is highly recommended that Production instances use a Development (and ideally a User Acceptance Testing) instance to practice data migration scripts on. This migration should be done using a copy of the Production database.
When making code customizations, it is best to do this in a branch of the code and then pull that code to the server, rather than editing files directly on the server:
Upgrading the version of Sahana Eden or enabling more modules may require updating configuration settings or installing/upgrading library dependencies.
Update configuration settings fileA new version of Sahana Eden may have new settings in 000_config.py that need to be merged with your current choices. After updating Sahana Eden, compare the copy of 000_config.py in deployment-templates with the site's copy in models. Merge in added and modified lines.
Missing software packages
A new version of Sahana Eden or a newly-enabled module may require software packages that were not included in the original installation. Optional packages may be needed to make use of new features. The latest list of required and optional packages is on the wiki:
For optional features that require missing packages, warnings will be printed when the Web2py server is started that list the features and the packages they need. If you don't need this functionality, then these can be safely ignored.
If missing packages are required then attempting to run the application will result in an error ticket with a message saying that this package was not found.
Since Sahana Eden extends Web2Py, and the two are both undergoing rapid development, the revision of Web2Py can be critical. Whilst the latest 'bleeding edge' version of Web2Py is usually stable, some Web2Py revisions have bugs which break a part of Sahana Eden. You can try upgrading to the latest revision of Web2Py or else downgrading to an older version which does not exhibit this bug.
Sometimes a new version of Sahana Eden may use features from a more recent Web2py than the currently installed version. This typically leads to an error ticket with a message indicating that some item was not found. Update to either the latest Web2py, or the latest known-stable Web2py revision, the version number for which can be found in private/update_check/eden_update_check.py
It is also sometimes posted in the #sahana-eden IRC channel topic (see the Community chapter for connecting to IRC).