Monday, February 2, 2015

Upgrading a super old Docker install to update a Discourse forum.


Discourse-logo-big
I just had the fun process of upgrading a Discourse forum for my StartupWeekend company, Leagify.


The forum runs in a Docker container, of which my container is generously hosted by Netsonic in an Ubuntu 14.04 virtual machine.
Netsonic Logo

Typically, upgrading Discourse is super easy.  There is a docker admin page that allows you to update directly from the web interface.  However, I had an ancient version of docker from my original installation, and it needed to updated, which could only be done from the command line.

The command line steps are outlined here:
cd /var/discourse
git pull
./launcher rebuild app

However, these steps didn't work for me, and I got a couple of different error messages.  One of them said something like "Your docker installation is old, please upgrade to 1.2" presumably because my install was really old, and my forum doesn't apparently follow the (now) standard guidelines for installing.

This article describes how I got the upgrade to work for my installation, since I haven't seen a good description of the steps I used all in one place.
  • SSH into your box  If you're reading this, I hope you can handle this step.
  • Don't just install docker from apt-get!  The 14.04 repo versions are OLD!  Also, note the difference between docker and docker.io, as they are different!  You probably want docker.io for a reasonably up-to-date docker install, but even this was too old for my purposes.
  • Re-Install Docker using Docker's instructions.  I opted for the easy curl script: 
curl -sSL https://get.docker.com/ubuntu/ | sudo sh
  • If you were an early adopter of Discourse, you may have put your container in /var/docker instead of /var/discourse.  This is a problem, but not as big of a problem as you'd think.  Do a recursive copy of /var/docker to /var/discourse: 
sudo cp -a /var/docker/ /var/discourse/

  • You should be able to run the rest of the Discourse update steps as originally planned.  You may need to use sudo for some of these commands, depending on how your permissions are set up.
cd /var/discourse
git pull
./launcher rebuild app

  • If these steps don't work, try rebooting the server and doing the official steps one more time.


Hopefully, your wonderful Discourse forum is now up and running again after the 15-20 minutes it took to perform all of these steps! If not, check out the Discourse forums for more information and troubleshooting tips!