FU Wiki server

The FU wiki server is hosted with MIS in their proxmox cluster, and setup using ansible. It runs nginx, php-fpm 7, mysql and drupal using composer. Everything about the setup is automated.

Besides the production server, there are also clones running on the proxmox server in the Nightowl Lab: wikiacc.nightowl.lan, wikitest.nightowl.lan en drupaltest.nightowl.lan that are respectively the acceptance, test and dev versions of the wiki.

Updating the wiki, modules and drupal software

To update the wiki, you first need to test that everything works on our acceptance server. Once that is done, you can update the production server as well.

To run updates against the acceptance server you need to do the following:

  1. Get the ansible repository for Nightowl, and the roles from Dolf setup on your local machine.
  2. Make sure you turn on the wikiaccnightowl server on our proxmox server.
  3. Make a backup of the files and database of the current wiki:
    1. ssh to the fuwiki server: ssh root@wiki.foundationu.com
    2. run the backups: backup_fuwiki
    3. This creates two backup files in the home directory of the root user: fuwiki_files-<currentdate>.tar.gz contains the files for the wiki and wiki_foundationu_com-<currentdate>.sql.bz contains the mysql database dump. Copy those files to your computer using rsync, filezilla or scp.
    4. Now copy those files to the wikiacc.nightowl.lan server using the same program you used to copy them to your pc.
  4. Login with ssh to the wikiacc.nightowl.lan server
  5. Restore the files backup with tar -vxf fuwiki_files-<currentdate>.tar.gz -C /srv/www/vhosts/wikiacc_nightowl_lan/web/sites/default/files/
  6. Restore the mysql database with bzcat wiki_foundationu_com-<currentdate>.sql.bz|mysql -v wikiacc_nightowl_lan
  7. Logout of the server
  8. In your ansible folder, run the ansible playbook for the wiki, but only for the acceptance server with 
    ansible-playbook -i hosts fuwiki.yml --limit=acc
  9. Now visit http://wikiacc.nightowl.lan and check if the wiki is correct. Login with your username and password, and visit some of the pages to see if they function correctly. Compare it with the production server on https://wiki.foundationu.com. Also check if some pages that should not be "public" are indeed not visible if you log out, while some other pages that should be public, still are visible once logged-out. If you get a White Screen of Death (WSoD), or any error messages that you don't get on the production server, there is something wrong with the acceptance server and you need to debug and fix it. If there are clearly errors on the acceptance server that aren't there in production, there may be something wrong with the acceptance server.
  10. After ansible completed successfully, SSH again into wikiacc.nightowl.lan
  11. Go to the drupal folder in /srv/www/vhosts/wikiacc_nightowl_lan/
  12. Run "php -d allow_url_fopen=true /usr/local/bin/composer update" to update drupal and all its modules
  13. Run "./vedor/bin/drush updb"  to run all database updates
  14. Now repeat step 9.
  15. If step 12-14 are ok, you are ready to commit the changes in the drupal versions, and then update the production server. The "composer update"  command you run in step 12 resulted in a new composer.lock (and optionally composer.json). To commit the changes in /srv/www/vhosts/wikiacc_nightowl_lan, run "git commit -a -m 'updated drupal and modules'" and then "git push" to commit and push the changes.

After you ran the updates against the acceptance server and tested them, updating the production server is quite easy. You should already have tested the updates, and also should have backups of the database and files already that you made while testing at the acceptance server. If you skipped this, you will run into issues, and will have no way to recover from them. So DONT SKIP IT!!!

  1. On your computer, in the ansible folder, run the ansible playbook against the production server with "anible-playbook -i hosts fuwiki.yml --limit=prod"
  2. Ssh into the production server and go to the folder /srv/www/vhosts/wiki.foundationu.com
  3. There, run "composer install" to update the code (this won't work if you skipped the step with the acceptance server).
  4. Run "./vendor/bin/drush updb" to run the database updates.
  5. Check (like in step 9 of the acceptance server) if the wiki is functioning properly. There should be no issues if you tested everything first. But in case there is, you can restore it to the previous state like this:
    1. Restore the git repository with "git reset --hard HEAD@{1}". This will roll back the last git pull.
    2. Restore the database backup with "bzcat /root/wiki_foundationu_com-<currentdate>.sql.bz|mysql -v wiki_foundationu_com"
    3. in /srv/www/vhosts/wiki.foundationu.com run "php -d allow_url_fopen=true /usr/local/bin/composer install" to install the previous versions of all packages.
    4. Maybe you may also need to restore the backup of the website files with "tar -vxf /root/fuwiki_files-<currentdate>.tar.gz -C /srv/www/vhosts/wiki_foundationu_com/web/sites/default/files/"
  6. If everything went well, Drupal and its modules should now be updated.

 

This page is subject to our Disclaimer.