Altoros is a big data and Platform-as-a-Service specialist that provides system integration for IaaS/cloud providers, software companies, and information-driven enterprises. Areas of expertise include Cloud Foundry, Hadoop, and NoSQL solutions, as well as Microsoft .NET, Java, Ruby on Rails, and mobile technologies.

Written by altoros
RSS Subscribe

Discourse is the 100% open source, next-generation discussion platform built for the next decade of the Internet.

Juju is a service orchestration management tool developed by Canonical. This guide requires configured and successfully bootstrapped Juju environment. Please walk through getting started with Juju guide if you are not familiar with Juju yet.

Configure Discourse

First you have to fork Discourse and prepare it for deployment with Juju

Add Redis config

config/redis.yml:

<%= ENV[‘RAILS_ENV’] %>:
  uri: <%= uri = URI.parse(ENV[‘REDIS_URL’]) %>
  host: <%= uri.host %>
  port: <%= uri.port %>
  password: <%= uri.password %>

Copy config/environments/production.rb.sample to config/environments/production.rb

cp config/environments/production.rb.sample config/environments/production.rb

Add new files to git:

git add –force config/environments/production.rb config/redis.yml

Update your repository:

git add .
git commit -m ‘prepare to deploy with juju’
git push origin master

Now discourse is ready for the deployment with JuJu.

Configure Juju

Create Rack charm config:

discourse.yml

discourse:
  repo: <repo_url>
  env: SECRET_TOKEN=ssEnesNG3f3jAhgJgSlWDLUi0U3cUrUhrTBwwancUKL91hX7ClKAgKl0Ofpv

Important: Discourse requires SECRET_TOKEN to be defined for sessions storage.

More configuration and deployment options available on Rack charm page.

Deployment

Deploy Discourse with Rack charm:

juju deploy rack –config discourse.yml discourse

Deploy and relate Redis:

juju deploy redis-master
juju add-relation redis-master:redis-master discourse

Deploy and relate PostgreSQL

juju deploy postgresql
juju add-relation postgresql:db-admin discourse

Generally you should use db relation for postgresql but Discourse creates hstore extension in migrations that’s why you have to use db-admin instead.

Finally expose the Discourse:

juju expose discourse

Use juju status or juju debug-log to watch for deployment progress.

When discourse is deployed create, migrate and seed database:

juju ssh discourse/0 run rake db:create
juju ssh discourse/0 run rake db:migrate
juju ssh discourse/0 run rake db:seed_fu

Compile assets:

juju ssh discourse/0 run rake assets:precompile

Restart Discourse:

juju ssh discourse/0 sudo restart rack

Navigate to discourse and create your account. When you are done promote your account to admin in the Rails console:

juju ssh discourse/0 run rails c

me = User.find_by_username_or_email(myemailaddress@me.com)
me.activate
me.admin = true
me.save

Now you can configure discourse from /admin console. More info on the The Discourse Admin Quick Start Guide page.