Setting up Discourse Community Platform in Development mode

Engaging with the community by means of community, for the community is a kind of hackable though process. With the development of open-source projects and contributions engaging with the community has been made easier and affordable. We have Discourse for serving that purpose.

Let’s know about Discourse. Discourse is a 100% open-source community platform setup that is written in Ruby programming language. In this post, we are going to see on how to setup Discourse in our local development environment.

Install the Dependencies

$ bash <(wget -qO- https://raw.githubusercontent.com/techAPJ/install-rails/master/linux)

This will install,

  • Ruby
  • Postgres
  • Rails
  • Git and more dependencies

Install PhantomJs

$ cd /usr/local/share
$ sudo wget https://bitbucket.org/ariya/phantomjs/downloads/phantomjs-1.9.8-linux-x86_64.tar.bz2
$ sudo tar xvf phantomjs-1.9.8-linux-x86_64.tar.bz2
$ sudo rm phantomjs-1.9.8-linux-x86_64.tar.bz2
$ sudo ln -s /usr/local/share/phantomjs-1.9.8-linux-x86_6 /bin/phantomjs /usr/local/bin/phantomjs
$ cd

Clone Discourse locally

Copy the discourse project from Github to your local environment.

$ git clone https://github.com/discourse/discourse.git

Setup the Database

First, Install postgres in Ubuntu by following the instructions here

Create a role and Database for Discourse

$ sudo -u postgres psql postgres
CREATE ROLE username WITH LOGIN ENCRYPTED PASSWORD 'password' CREATEDB SUPERUSER;
CREATE DATABASE discourse_development WITH OWNER username ENCODING 'UTF8' TEMPLATE template0;
CREATE DATABASE discourse_test WITH OWNER username ENCODING 'UTF8' TEMPLATE template0;

Ctrl+d to exit the prompt.

Access the database from psql prompt

$ psql -d discourse_development -U username -h localhost
CREATE EXTENSION pg_trgm;
CREATE EXTENSION hstore;

Repeat the above steps for discourse_test database also.

Ctrl+d to exit the prompt.

Start the Discourse server

Navigate to the cloned discourse directory

$ cd /path/to/discourse
$ bundle install
$ bundle exec rake db:migrate db:test:prepare db:seed_fu
$ bundle exec rails server
Discourse Homepage

Now, Discourse will be accessible at http://localhost:3000

Setup Admin Users

Create new admin users

$ bundle exec rake admin:create RAILS_ENV=development

Just follow the steps and enter the information needed.

Discourse Admin Settings

Hurray ! Discourse is up and running in your local development environment. Setup Discourse for your community and engage yourselves into the new era of discussion. :-)

Like what you read? Give Balaji a round of applause.

From a quick cheer to a standing ovation, clap to show how much you enjoyed this story.