CNK's Blog

Installing Discourse

Discourse installed with Vagrant and Docker

I guess I am old school but I prefer mailing lists to web forums - probably because I vastly prefer mutt to any forum web site I have seen. But if I have to use a discussion board, then by far the best one I have seen is Discourse. I first heard about it in a couple of episodes of the Ruby Rogues podcast.1 2 When the Rogues moved their mailing list from Google Groups to Discourse, I was a little annoyed because Discourse didn’t support ‘just email it all to me’ and I just never get around to checking web sites. Fortunately the good folks at Discourse added setting that allow folks like me to get all our Ruby Parley goodness by email. But for those who like web forums, Discourse has some really nice features - keeping track of what is new, likes, bookmarks, follow individual posts, private messages and a really nice reputation system.

At work we are looking for a discussion board for a project we are doing and I suggested Discourse. In addition to the hosted discussions, there is an open source version of the same code available on GitHub. The recommended way to install Discourse is to use the supplied Docker images.

Setting up my Vagrant

To get started I needed an Ubuntu 14 LTS disk image. The one distributed by Hashicorp labeled “lattice/ubuntu-trusty-64” is configured to use 4G memory and isn’t running chef or puppet (so nothing to interfer with the Docker stuff from Discourse).

    vagrant init lattice/ubuntu-trusty-64
    vagrant up
    # first thing it did was download the vbox image
    vagrant ssh
    wget -qO- https://get.docker.com/ | sh

    ... lots of output about updating packages and installing docker

    If you would like to use Docker as a non-root user, you should now consider
    adding your user to the "docker" group with something like:

      sudo usermod -aG docker vagrant

Installing Discourse

    mkdir /var/discourse
    git clone https://github.com/discourse/discourse_docker.git /var/discourse
    cd /var/discourse
    cp samples/standalone.yml containers/app.yml
    # edited email settings in app.yml per instructions

I misread the instructions and instead of typing ./launcher bootstrap app, I did ./launcher start app. That gave some reasonable looking output before it bailed out complaining:

    Unable to find image 'local_discourse/app:latest' locally
    Pulling repository local_discourse/app
    FATA[0002] Error: image local_discourse/app:latest not found

Doing ./launcher rebuild app did reasonable looking things like starting databases, checking out code from git, running database migrations, and compiling assets.

I tried modifying my /etc/hosts file to include discourse.example.com but no dice - I think because my Vagrant isn’t exposing port 80. So I shut down the vagrant box and edited the Vagrant file to uncomment

    config.vm.network "forwarded_port", guest: 80, host: 8080

Now http://discourse.example.com:8080 works. Since I can don’t really need this to answer to a specific name, I took the modification back out of /etc/hosts and will just use http://localhost:8080 to play with configuring and testing Discourse.