How do I manually update Discourse and Docker image to latest?

(Sam Saffron) #1

If you self-host Discourse, you occasionally need to run a manual update via the command line to get the latest security releases newest libraries. These updates are not picked up in admin/upgrade, which is why you’ll occasionally need to do this additional step.

  1. Discourse itself should be updated about twice a month, by clicking the “Update to Latest Version” button in your admin dashboard ( admin/upgrade). We do beta releases roughly once every week.

  2. Every two months we recommend SSH’ing into your web server (using putty or your favorite SSH client) and doing

    cd /var/discourse
    git pull
    ./launcher rebuild app
  3. As for Ubuntu updates, make sure you have automatic security updates enabled for your Ubuntu! The command is:

    dpkg-reconfigure -plow unattended-upgrades

    However, that just covers critical security updates. Every so often you should get all the OS updates like so:

    apt-get update
    apt-get dist-upgrade

Due to the way docker packaging has changed you may also have to update your docker from lxc-docker or docker-engine packages. One way to do that is via the Docker script here (it will warn about an existing install but should upgrade ok):

wget -qO- | sh

This will now use the docker-ce main versions.

This is completely safe, we have never seen anything get broken by base Ubuntu updates.

To summarize:

  • update Discourse twice a month via web updater
  • update the container every two months
  • update the OS every six months

You could double these numbers and still be fairly safe, e.g. update Discourse once a month, container every 4 months, OS once every 12 months, and so on.

But you really, really want automatic security updates enabled in Ubuntu, as listed above – all our Digital Ocean “one-time installs” already have automatic security updates set up.


What is the right time to update?

It just depends on the time you have available and how close to bleeding edge you want to be. If you have non-official plugins, it is highly advisable to utilize a test/staging site. If you do not have any non-official plugins, you can likely upgrade immediately, but even then, some plugins may break for a couple of days as the team fixes them (there are a lot of them).

What is common practice when updating with many plugins installed?

If you have a lot of plugins, testing locally or on a test server is highly advised. Especially if you have non-official plugins, as something could have broke. If you find something does break, then it is a matter of, do you have time to fix it? Does the original plugin author have time to fix it? Either of those could take weeks. So at least this way, you simply have a broken test site and not a broken production site.

I’m running low on disk space

If you are running low on disk space (check with df) try clearing up old images using:

./launcher cleanup
apt-get autoclean
apt-get autoremove

Does updating the actual server version of Ubuntu matter since Discourse always operates in Docker?

It matters a lot less. But you should not get so far behind that, say, you are on Ubuntu 12.04 LTS today (time of writing: June 1st, 2016), which was released in mid-2012, four years ago. That version will be end of support life by early 2017.

Trouble while upgrading docker
Correct way to update docker?
No longer getting notifications for out of date containers
Upgrade from v2.0.0.beta10 +37 to 2.1.0.beta1 does fail
Site fails to load with js errors
Problem with category style = box under firefox
Update error, website unavailable, possibly plugin related?
Why do I need a block storage?
Scheduled database backups cause periodic out of memory errors?
Digital Ocean hosting: Do I need a system admin?
Cannot rebuild following site failure: "postgres already running"
Upgrade button is 500-ing for me
Upgrade V2.1 Beta 2 to Beta 4 Require ./launcher rebuild app Twice
Best practices for removing old containers?
1.4.3 Upgrade Oddity?
Postgres changing ownership error when running launcher rebuild app
Daily performance reports keep asking to rebuild container
How do you update Discourse?
Proper Procedure for Upgrading Discourse Docker Container
Add path to cookie
Problem running `./launcher rebuild app` : no output and nothing appears to happen
PNG's a no show
Failed to bootstrap 1.6.0.beta 8 with out of date docker
Docker and Discourse upgrade
Service not available | Update Error
Will not load, no access to installation, aufs not installed - my fix
What do you want to do about modified configuration file grub?
"Upgrade all" button is awesome!
Cannot upgrade due to old version of docker
Installed OK. Working fine for one day. Suddenly stopped working

It might be worth noting here that running these updates takes your site offline for a noticeable period of time (unlike the admin/upgrade ones, which always feel pretty seamless).

(Jeff Atwood) #3

Should take about 10-15 minutes but it depends where you are hosted. Good news is the Docker images don’t change too often.

Site maintenance mode during rebuilds?
(Jeff Atwood) #10

I moved 7 posts to a new topic: Ubuntu updates intefere with Docker and AUFS?

(Wayne Werner) #16

Is there discussion anywhere about improving the amount of downtime when rebuilding the image?

(Sam Saffron) #17

If you want minimal downtime you must run a separate data container, there is an advanced howto covering this.

If you want zero downtime, you must run 2 web containers and cycle them in and out using haproxy … or you could just sign up with us and get that with the standard plan :slight_smile:

Can you upgrade Discourse seamlessly if there is a breaking db change?
(Tudor Vedeanu) #19

How do I know when my Docker image needs to be updated? Do I have to check manually for updates?

(Sam Saffron) #20

I plan to inject the version of the discourse docker image into the container so we can display this in the dashboard … in the mean time, once every major release run

cd /var/discourse
git pull
./launcher rebuild app

and you should be good

(Sam Saffron) #23

I moved 7 posts to an existing topic: Can you upgrade Discourse seamlessly if there is a breaking db change?


What happens if i don’t update my docker?


Today discourse requires docker 1.2. If you were running an earlier version launcher would warn and stop a build. I imagine in the future this version requirement will get eventually bumped up, meaning if you didn’t update and meet the min requirement, you’d not be able to rebuild and upgrade.

(Adam Curtis) #27

Hi guys, I tried to update the docker image today and came across the following error:

root@ks1:/var/discourse# ./launcher rebuild app
Ensuring discourse docker is up to date
Fetching origin
fatal: ambiguous argument '@': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions
fatal: Not a valid object name @
./launcher: line 554: [: @: unary operator expected
./launcher: line 559: [: 9e83982d9b9277ca5dc99dc8f8c847e2189f3866: unary operator expected
Discourse Docker has diverged source, this is only expected in Dev mode
Stopping old container
+ /usr/bin/docker stop -t 10 app
cd /pups && git pull && /pups/bin/pups --stdin
Unable to find image '' locally
Pulling repository
FATA[0002] Error: image library/ not found
cat: cids/app_bootstrap.cid: No such file or directory
docker: "rm" requires a minimum of 1 argument. See '/usr/bin/docker rm --help'.

Can anyone help? Fortunately my original docker image is still intact, so my forum isn’t down :slight_smile:

(Kane York) #28

Wow, how’d you get that to happen?

What’s your git and docker versions?

(Adam Curtis) #29

No idea! Heres my version numbers:

root@ks1:~# git version
git version
root@ks1:~# docker version
Client version: 1.6.0
Client API version: 1.18
Go version (client): go1.4.2
Git commit (client): 4749651
OS/Arch (client): linux/amd64
Server version: 1.6.0
Server API version: 1.18
Go version (server): go1.4.2
Git commit (server): 4749651
OS/Arch (server): linux/amd64

I made sure I did a git pull before rebuilding, so not sure whats happened! Im on Debian Wheezy if thats helps?


The 10.x.x.x is a common private network range like 192.168. It’s as if this private IP somehow got placed instead of the correct discourse version. I’d suggest checking your launcher and dockerfiles in images. Something is amiss.

(Scott Pruett) #33

Thanks. I’ve got some learning to do… my dev experience is primarily on the front end :slight_smile:

(Adam Curtis) #34

I did realise shortly after that it was my local IP address. I guess something must have replace the variable in the script. I’m away for a few days now, but I’ll investigate more when I’m back :slight_smile:

(Kane York) #35

Yeah, get an update to that… Git is now on version 2.1 (my laptop has 2.1.4), but the launcher needs 1.9 to work.

(Adam Curtis) #39

Thanks for getting back to me! I’ve installed git 1.9.1 from backports but unfortunately I’m still getting the same issue :frowning:

Any other ideas? Thanks in advance! :smile:

Edit: Also tried installing git from source, v2.4 and still getting the same issue! Is there anything else I can do to try and debug the issue?

(caue rego) #42

On DigitalOcean it just took me less than 10 minutes.

Adding some positive feedback for a change. :wink: