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, you will need to type in following commands 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 easiest step. Keep Calm.
Create a /var/docker
folder where all the docker related stuff will reside, using following command:
mkdir /var/docker
Now we will clone the Official Discourse Docker Image using following command:
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.
The above command copies all the Docker Image content inside /var/docker
directory.
Let's switch to /var/docker
directory using:
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. Type in:
vim containers/app.yml
I am using Vim to modify the file, you may use any editor of your choice.
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 your instance of 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, Accessing Admin Section, Tweaking Admin Section, etc.
Please provide your feedback, if anything needs to be improved, or you want to see any section in more detail. Don't hesitate. Also the fine folks here at Discourse are always ready to help you, if you face any problem.
I'll try to update this guide as frequently as possible.