Ok, so you want to deploy your own instance of Discourse, and looking from where to start? You've come to the right place, here I'll walk you through the installation steps with the help of screenshots, so you won't find yourself lost, let's begin this wonderful journey.
Unlike many other Rails Apps the deployment of Discourse is extremely simple thanks to awesome Docker Image by @sam, all you need is a ssh access to cloud server. In this guide I'll assume that you are using Digital Ocean, while the steps will work fine on other cloud servers as well.
The below guide assumes that you have no knowledge of Ruby/Rails, Shell, so it will be detailed. Feel free to skip steps which you think, you are comfortable with.
Create new Digital Ocean Droplet
Discourse Team recommends a minimum of 1 GB Ram, so that's what we are gonna go with. For the sake of simplicity we will name the Hostname as discourse.
We will install Discourse on Ubuntu 12.04.3 x64 as this is recommended in Official Documentation.
Once you will complete with above steps you will receive a mail from Digital Ocean, providing root users password. (In case you have entered your SSH keys, then you don't require password to login).
Access your newly created Droplet
To access the droplet, type in following command in your terminal:
ssh root@162.243.201.40
Replace 162.243.201.40
with the IP address you got from Digital Ocean.
It will ask your permission to connect, type yes
, and then it will ask you for root's password. The root's password is in your mail which Digital Ocean sent you. Type in the password and you will be welcomed by newly installed Ubuntu Server.
Install Git
To install Git, you just need to type in the command:
sudo apt-get install git
and you are good to go.
Install Docker
Run following commands:
sudo apt-get update
sudo apt-get install linux-image-generic-lts-raring linux-headers-generic-lts-raring
Now we will perform a system reboot:
sudo reboot
Above command will log you out from ssh session, ssh in again:
ssh root@IP_ADDRESS
replace IP_ADDRESS
with your IP Address.
Type in following commands:
sudo sh -c "wget -qO- https://get.docker.io/gpg | apt-key add -"
sudo sh -c "echo deb http://get.docker.io/ubuntu docker main\
> /etc/apt/sources.list.d/docker.list"
sudo apt-get update
sudo apt-get install lxc-docker
Install Discourse
If you have reached to this step, Congratulations! You have already done all the hard work, now you have a brand new Ubuntu Server with Docker installed. All you need to do now is install Discourse itself, which is the most easy step. Keep Calm.
Create a /var/docker
folder where all the docker related stuff will reside:
mkdir /var/docker
Now we will clone the Official Discourse Docker Image in /var/docker
folder:
git clone https://github.com/SamSaffron/discourse_docker.git /var/docker
Make sure to copy and run the above command as is, otherwise you will face problem which I faced.
Let's switch to /var/docker
directory:
cd /var/docker
Now we will copy the samples/standalone.yml
file and place it inside containers
folder by name app.yml
, so the path will become containers/app.yml
, type in command:
cp samples/standalone.yml containers/app.yml
Now we need modify the newly copied app.yml
with our default variables:
nano containers/app.yml
Nano is suggested by @riking because it works like a text editor, just use your arrow keys. Hit Ctrl-O
to save and Ctrl-X
to exit. In below screenshot I am using Vim.
You will see something like:
You may modify the file as per your requirement, but for the sake of simplicity I will only modify two variables DISCOURSE_DEVELOPER_EMAILS
and DISCOURSE_HOSTNAME
.
Notice that I renamed the DISCOURSE_HOSTNAME
to discourse.techapj.com
, this means that I want to host my instance of Discourse on http://discourse.techapj.com/, for this to work properly you will need to modify DNS Records (I will post a separate guide to configure DNS Records).
Save the file, and run following command:
sudo ./launcher bootstrap app
This command may take some time, but it's doing all the hard work for you. Go drink some coffee, while this command is automagically configuring the Discourse environment for you.
When this command executes, type in the following command to start instance of your Discourse app:
sudo ./launcher start app
Congratulations! You have your own live instance of Discourse running on the host you provided in app.yml
file at the time of setup.
You can also access your instance of Discourse by visiting your IP_ADDRESS
.
Okay, that's it for this guide. In my next post I'll talk about more advanced topics like Configuring mail, Tweaking admin, SSH access to running containers, etc.
Please provide your feedback, if anything needs to be improved, don't hesitate. Also the fine folks here at Discourse are always ready to help you, in case you face any problem.
I'll try to update this guide as frequently as possible.
[Last Update: January 24, 2014]