How to customize your own discourse and deploy it to production on Ubuntu for beginners

(Love Chopra ) #1

Discourse is incredibly awesome!! The team behind has done an amazing work to make its underline architecture very strong, this brings me an idea why not use discourse’s solid architecture for my community engagement and as well as for my main website, so I went ahead and done some customization like adding new custom pages and deployed it to my production environment.

In this process I went through many discussions over, talked to some amazing community members and faced certain challenges so I thought let’s summarize what I have learned so far and what all references I have used in one single place in a systematic manner:-

Step 1:- Make your own discourse repo on github
Go to and create your customize repo, there are two ways to do it:-

  • First fork discourse official repo, please note your repo will be public as github don’t allow forked repos to upgrade to private repo, so if you want to make your repo private read the next method

  • Or create a new repo on and then push your code to this repo, this way you can upgrade github account and can make your repo private

Step 2:- Setup your development environment
The first step to do any customization to discourse is to have discourse configured on your local machine, there is an amazing article written by Arpit and in fact this article opens up his way for internship with discourse too :slight_smile:

Step 3:- Setup your customized repo in a way so that you can keep updated with latest discourse upgrades
Good, I believe by now you have configured your development environment and already running discourse in your local machine great! Now it’s time to setup your discourse in a way so that along with your customize changes you will always get up to date with latest shinny discourse, please read this topic by @jamesmarkcook

Step 4:- Now it’s time to do your own discourse customization
As every website require to have a custom home page and few other custom pages, so let’s say you want to add a simple custom page to your own discourse, @bunjee has done a great job here, please go through it and enjoy adding custom pages to your discourse repo:
Custom home page to discourse

Step 5:- Push your code changes to your github repository
So you done with your custom changes with discourse! Now it’s time to push your code to you customize discourse repo.
If you are new to git and using it for the first time you can go through this cheat sheet for a quick reference of git commands

Step 6:- Deploy your customized repo on your production environment
Now here come to the final stage which will make your custom discourse infront of world, there are two ways to do it:

  1. Docker way of deployment which is officially supported
    Docker way of deployment is really amazing you just need to do changes in app.yml and web.template.yml file and you can simply deploy your discourse. But I have found certain challenges with docker approach while deploying my customize repo:-
    i. It is very tough or you can say it became hardly impossible for me to publish my customize repo, I just added few static pages but while rebooting the container every time I was getting rake: assest recompile error
    ii. I installed a tagger plugin which require doing db:migrate from inside the container after installation, plugins installed successfully and worked fine but later when I rebuild the container it was not getting rebuild because of db:migrate error
    iii. If you somehow manage to deploy it using docker or have done customization which has no impact for docker installation and using standalone installation template then you have to face around 10-15 mins of downtime every time you push your new changes while rebuilding the container
    iv. While rebuilding the container if your rebuild fails then your site will go down until you troubleshot the problem

However docker installation method work magically for default standard discourse install

  1. Deploy without docker
    Disclaimer: This method is officially not supported, I have used it because I was facing issues with docker installation for my customize repo and I believe if you customizing discourse then you should deploy it using this method only
    Follow this guide for step by step installation of discourse on your production server and after the successful install map your sub-domain or main-domain with your server’s ip.
    GitHub - baus/install-discourse: Installation instructions for the Discourse project.

That’s it, we are done!! :smile:

Please feel free to suggest if you have any better way to do this entire cycle more efficiently I’ll edit the guide ASAP. Thanks!

Developing with Discourse
Integrating a customized highlight.js into my forum
(Jeff Atwood) #2

This kind of non Docker setup is fragile and unsupported. Questions asked about it here will be closed or deleted, as we unfortunately do not have the time necessary to support it.

(Nikita Zonov) #3

Hello, thanks for this topic. Could you please clarify the moment with

[quote=“lovechopra1, post:1, topic:23475”]
you just need to do changes in app.yml and web.template.yml file and you can simply deploy your discourse.[/quote]
What parameters exactly should I change?