discourse #7

Supports: bionic xenial
Add to new model

Description

Discourse is a from-scratch reboot, an attempt to reimagine what a
modern Internet discussion platform should be today, in a world of
ubiquitous smartphones, tablets, Facebook, and Twitter.


Overview

This charm provides a simple way to deploy a basic Discourse install with sane defaults that is able to scale horizontally.

Requirements

Discourse requires a Postgres database and some form of frontend web server. It requires outbound access to rubygems.org, cache.ruby-lang.org and github.com to fetch the Discourse code itself and ruby dependencies. Outbound access to Amazon S3 is required for various components of Discourse itself to work properly, i.e. user icons and backups to S3. Outbound SMTP access on port 25 must be open to allow Discourse to send registration mail to new users, including administrators during the setup process.

Example Usage

Assuming the above requirements are met, deployment is straightforward:

juju deploy cs:~discourse-charmers/discourse
juju deploy cs:apache2
juju deploy cs:postgresql
juju config discourse hostname="discourse.example.com"
juju config discourse admin-users="me@example.com"
juju add-relation discourse:website apache2:balancer
juju add-relation discourse:db postgresql:db

The apache2 charm does require some configuration to take advantage of the balancer the Discourse charm provides, at minimum it will require enabling the apache modules and a virtual host template configured for the balancer:

juju config apache2 enable_modules="headers,proxy"
juju config apache2 vhost_http_template=$(base64 -w0 ./apache2-template)

Where the file ./apache2-template contains something like this:

<VirtualHost *:80>

ServerName {{ servername }}
CustomLog /var/log/apache2/{{ servername }}-access.log combined
ErrorLog /var/log/apache2/{{ servername }}-error.log
ProxyRequests off
<Proxy *>
    Order Allow,Deny
    Allow from All
</Proxy>

ProxyPreserveHost on
ProxyPass / balancer://discourse/
ProxyPassReverse / balancer://discourse/

</VirtualHost>

This will make Discourse available via HTTP at the hostname discourse.example.com and send a registration mail to me@example.com with a link allowing that user to log in and set up the Discourse software via the web UI.


Configuration

admin-users
(string) Comma separated list of email addresses for admin users of Discourse.
app-path
(string) Path to the root of the ruby app.
/srv/discourse/current
commit-or-branch
(string) Commit hash or branch tag of the source repo to clone.
stable
deploy-key
(string) A deploy key is an SSH key that is stored on the server and grants access to a repository.
hostname
(string) Hostname for your forum
example.com
http-proxy
(string) Proxy server to use for downloading gems/sources.
key-required
(boolean) This should be set to true to ensure that a deploy key is deployed if necessary
nagios_context
(string) A string that will be prepended to instance name to set the host name in nagios. So for instance the hostname would be something like: juju-myservice-0 If you're running multiple environments with the same services in them this allows you to differentiate between them.
juju
nagios_servicegroups
(string) Comma separated list of nagios servicegroups for the Nagios checks.
juju
plugins
(string) Comma separated list of git URLs for Discourse plugins.
repo
(string) Repository to fetch Discourse codebase from
https://github.com/discourse/discourse.git
ruby-mirror
(string) Default mirror to pull Ruby from, choose one closest to your datacenter.
http://cache.ruby-lang.org/pub/ruby
ruby-version
(string) Default Ruby version to install. Choose a version sufficiently new for Discourse.
2.4.4