Recently I stumbled upon Discourse. Finally someone tackled that problem. Forums, while rich in content, have been so dull and unfriendly for so long. Anyway, I wanted to get it up and running for myself, preferably on some cloud infrastructure, to play around. I’ve had previous experience with Heroku, so chose that setup, for no other reason. The Discourse’s own forum has plenty of other options so feel free to investigate.
As for the Heroku setup, there are existing guides, see  and . The difference between them is that when using Discourse’s default configuration samples, you get Open Redis support, while I wanted to use Redis Cloud add-on, similar to Swrobel’s take on it. Also, I wanted to use Autoscaler for Sidekiq to reduce total cost on Heroku, as noted in Discourse’s document. All in all, I ended up with a mix of ideas from both sources. Add-ons used on Heroku:
- PostgreSQL as main storage
- Redis Cloud for Redis, Sidekiq etc.
- Mandrill by MailChimp for email notifications
Currently free plans are used for all of them as you can see below.
To be able to repeat the process and easily deploy updates using Discourse’s Github repo, I’ve created a small Bash script for this. It basically performs the following tasks:
- goes into your local Discourse git repo
- creates a new branch, based on the current branch you’re on (all changes must be committed)
- creates Redis configuration using provided sample and tweaked for Redis Cloud
- adds mail configuration to production environment
- removes clockwork from Procfile
- set’s ruby version to 2.0 in Gemfile
- configures Sidekiq for Autoscaler
- creates temporary database and migrates it
- precompiles assets using the above database
- drops the temporary database
- commits all configuration changes along with precompiled assets
- pushes it all to Heroku
- migrates the database on Heroku
- and finally deletes the deployment branch
You can find the script here, feel free to use it, change it, do things to it you see fit The main idea was to do as minimum manual work as possible, at least for this phase where I follow the default instructions closely. This of course might change, but for now is quite all right.
Prerequisites for executing the script:
- You need to be able to run Discourse locally or at least to be able to precompile assets
- This means you need:
- Ruby 2.0
- Cloned Discourse Github repo
Also, you need to replace the SECRET_TOKEN within the script and match it to your own setup. I took care to match it to the one set for the Heroku instance (heroku config:get SECRET_TOKEN).
Aside from the script, you should still follow the instructions on mentioned documents to e.g. create initial user, setup Amazon S3 upload etc.
Finally, the forum is up: