------------------------------------------------------------------ -- REGIEBUCH -- -- Upgrading Origo Web-Frontend from Drupal 5 to Drupal 6 -- -- -- -- $ Id: $ -- ------------------------------------------------------------------ ----------------------------------------- ----------------------------------------- -- SETUP -- ----------------------------------------- ----------------------------------------- You'll need at least three shells to check the progess of the scripts: Shell #1: run the scripts Shell #2: continuously tail the logfile, grep errors tail -f drupal_upgrade.log | grep error Shell #3: open shell to do other stuff while the script is running ----------------------------------------- ----------------------------------------- -- BACKUP -- ----------------------------------------- ----------------------------------------- IMPORTANT-IMPORTANT-IMPORTANT-IMPORTANT-IMPORTANT-IMPORTANT-IMPORTANT-IMPORTANT-IMPORTANT-IMPORTANT backup all files & data of the things that will be changed: - origo-projects, i.e. the "sites" subfolder of drupal - origo-data, i.e. the database - the WHOLE database! - the drupal installation - the script-files that will be adapted/overwritten: - /usr/local/lib/origo/create_project.php - /etc/origo/origo.conf => use script "backup_drupal.sh" to backup to drupal_5_backup - you might want to put this backup physically on another machine... VERIFY your backup!!! ----------------------------------------- ----------------------------------------- -- PRE UPGRADE -- ----------------------------------------- ----------------------------------------- 0. did you do the backup? 1. if necessary: wrap ems-connection string in origo.conf in doublequotes. 2. check php memory limit (/etc/php5/(cli|apache)/php.ini). increase to ~64MB 3. download & install drush => make sure it is properly installed, so the executable is in your path. Basically just put the files anywhere, and symlink the main php executable. http://ftp.drupal.org/files/projects/drush-6.x-2.0-alpha2.tar.gz 4. update the old site - for a seamless upgrade, the image & img_assist modules need to be updated. 1. download & extract image and img_modules 2. run drush updatedb and cron on all sites ==> use script "00-update_drupal-5.sh" if the drupal instance of interest is not at your $ORIGO_WEB_ROOT, call the script with a parameter pointing to it. ----------------------------------------- ----------------------------------------- -- UPGRADE -- ----------------------------------------- ----------------------------------------- 4. copy sites to safe location - move all sites & symlinks in the "sites/" directory to a safe location. discard drupal-default directories in the backup location. sudo mkdir ~/drupal_sites_backup sudo cp -a $ORIGO_WEB_ROOT/sites ~/drupal_sites_backup sudo rm -rf ~/drupal_sites_backup/sites/all/themes ~/drupal_sites_backup/sites/all/modules ~/drupal_sites_backup/sites/CVS ~/drupal_sites_backup/sites/default ~/drupal_sites_backup/sites/minestrone ~/drupal_sites_backup/sites/template => manually check for legacy backup files (*.old, *.1, etc.) and delete them This will leave you with a backup directory containing only the drupal-sites, the symlinks to them, and possibly a server_settings.inc file. 5. core & module update upgrade core files and modules, patch them 5.1 Tabula Rasa - delete existing drupal 5 installation! sudo rm -rf $ORIGO_WEB_ROOT 5.2 Script Magic use script 01-drupal-6_download.sh ==> adapt variable WEB_ROOT if necessary ==> call with argument where you want the files to be checked out to 6. move sites back cp -R ~/drupal_sites_backup/sites $ORIGO_WEB_ROOT/ => make sure all belongs to www-data: ## sudo chown -R www-data:www-data $ORIGO_WEB_ROOT 7. update database (of each site) upgrade using Drush: run drush-upgrade script on all sites. ==> use script "02-upgrade.sh" get a coffee for this one - it might take a while ;) -------------------------------------------------------- -------------------------------------------------------- -- POST UPGRADE -- -------------------------------------------------------- -------------------------------------------------------- 8. adapt create_project: install screen-scraper for creating new sites. 8.1 copy files sudo cp $ORIGO/origo-web/scripts/create_project.php $ORIGO/origo-web/scripts/drupal-installer.php $ORIGO/origo-web/scripts/cli_installer_lib /usr/local/lib/origo\ => check that default.settings.php exists in /sites/default 8.2 check variables in create_project, you might have to adapt "$origo_path" ==> add a trailing slash to the variable!! => also check if curl is installed! sudo apt-get install php5-curl 9. adapt files - $DRUPAL/sites/all/settings.inc => edit paths for the api, sitename, etc. - check that everything belongs to www-data (fixes "directory files|images not writeable") sudo chown -R www-data:www-data $ORIGO_WEB_ROOT 10. hopefully, you're done!! -------------------------------------------------------------------------------------------------------------------------------------------------------------------- -------------------------------------------------------------------------------------------------------------------------------------------------------------------- -- LIFESAVER: -- What to do if it's all fucked up -- -- (aka: replaying the backup copy) -------------------------------------------------------------------------------------------------------------------------------------------------------------------- -------------------------------------------------------------------------------------------------------------------------------------------------------------------- 1. Backup your backup! If your backup is gone, you're fucked. so first, copy it away - physically, to another machine! 2. replace the whole drupal folder from the backup 3. replace origo.conf and the create_project scripts. 4. replay the sql-dump into the db. 3.1 drop all tables of the db 3.2 insert the dump mysql -u root -p < ~/drupal_5_backup/origo_full_dump.sql 5. restart the backend, you should be good to go.