Simple Discourse Deployment with Rubber

(Scott Carleton) #1

I’ve put together what I believe to be the simplest way of deploying Discourse yet using Rubber.

First, some background on Rubber. Rubber is a capistrano extension that keeps all configuration within your codebase and manages tasks by what roles a server has similar to Chef/Puppet etc.

It’s advantages are:

  1. All config is within your codebase and configurable using ERB within the configs
  2. It’s abstraction simplifies the process enough so that you get down to two commands to setup and one command to update.
    rubber vulcanize discourse and cap rubber:create_staging to start
    cap deploy to update
    But it also allows complete configurablility to scale to a full production architecture
  3. Utilizes cloud providers such as AWS, Rackspace, Digital Ocean or your own generic ubuntu box
  4. Been used in production by many companies for years

Advantages for Discourse:

  1. Separates application code and ops code
  2. The Discourse team can update the Rubber template with the best
    options and rubber will handle the upgrading without having to check
    file diffs
  3. Replaces BluePill for process management
  4. Custom Discourse infrastructure tasks can be written into Rubber for easy customer use

I’ve written up a Gist for using Rubber with Discourse (PR here)

I’m hoping to get it down to 3 lines:

  1. gem install rubber
  2. rubber vulcanize discourse
  3. edit minimal config for your provider
  4. cap rubber:create_staging

It’s still a little rough so I’d appreciate some feedback.

Edit: Adding the contents of the gist to be discussed here.

Long Version:


git clone
cd discourse
echo "gem 'rubber', github: 'ScotterC/rubber', branch: 'discourse'" >> Gemfile
rubber vulcanize discourse reply with n to overwrite questions

Edit config/rubber/rubber.yml

app_name: discourse

For EC2:

key_name and key_file # => Requires EC2 keypair
access_key: AWS_KEY
secret_access_key: AWS_SECRET
account: AWS_ACCOUNT
image_type: m1.small
staging_roles: "web,app,db:primary=true,redis_master,sidekiq,discourse"

Other Providers see:

#####Edit config/rubber/rubber-ruby.yml
ruby_version: 2.0.0-p247

Discourse config:

Remove duplicate ‘rubber’ line from Gemfile
cd config/
cp redis.yml.sample redis.yml
cp environments/production.rb.sample environments/production.rb
cd ../


cap rubber:create_staging

hit return for hostname prompt
hit return for roles if they mimic above staging roles
computer password for access to /etc/hosts

if it fails with vboxadd: unrecognized service. Make sure you’re not using Capistrano 2.15.5. Comment out reinstall_virtualbox_additions task in rubber/deploy-setup.rb and run cap rubber:bootstrap && cap deploy:migrations

When create_staging finishes. In your browser should be a discourse site

Discourse in a Docker container
(Jeff Atwood) #2

Interesting, thanks for this – @supermathie can you have a look?

(happycollision) #3

It seems like this could bring Discourse ever closer to the ease that (spirit animal) WordPress has in updating.

(Nate Finch) #4

I use juju to deploy discourse. It’s as easy as

juju deploy postgresql
juju deploy cs:~marcoceppi/discourse
juju add-relation discourse postgresql:db-admin
juju expose discourse

Juju takes care of everything.

Marco Ceppi is a developer at Canonical working on the Discourse charm, which is currently used to deploy

(disclaimer: I’m a developer on Juju)

(Scott Carleton) #5


Can you fill me in a bit on what you’re left with after setting up with Juju? Is the configuration part of the codebase? How do future deploys work? (Directing me to existing resources is good too). I haven’t seen juju as an option for deploying rails apps in the past so it appears quite new.

(Erlend Sogge Heggen) #6

So is Rubber specific to EC2 or can it work in other hosting environments as well?

(Scott Carleton) #7

It can handle quite a few providers. Even a generic vps if you like.

(Scott Carleton) #8

As of Rubber 2.7, the discourse template is now merged and released. So there’s no need to use my fork.

(Jeff Atwood) #9

@ScotterC is this still relevant in our current, heavily Docker centric view of the world?

(Scott Carleton) #10

I haven’t been following too closely on the Docker front but if Discourse is now heavily in favor of Docker I believe Rubber is no longer relevant.

However, as long as Discourse is a rails app with rails-world dependencies that the Rubber template should still work with a bit of tweaking.

(Erlend Sogge Heggen) #11