Hosting Discourse on VPS

install discourse on vps

I have been using GoDaddy to host my discourse forum muhendisler.org. For some reason, GoDaddy decided to stop hosting discourse by the end of 2017. So I needed to find another way to host my discourse forum. Here is what I did briefly. No details, just the steps you should follow to move your discourse forum to your own VPS. As long as you can do the installation of docker and discourse yourself, considering the price and performance, having your own VPS seems to be the better way compared to DigitalOcean and others.

Setup Discourse on VPS – Main Steps

1- Backup your forum (You can find it in the admin panel)

2- ssh to your VPS (ssh credentials will be provided to you by the VPS provider company)

3- Install docker (https://docs.docker.com/engine/installation/linux/docker-ce/ubuntu/)

4- Install discourse docker image (https://www.vultr.com/docs/install-discourse-on-centos-7)

Correct configuration of the SMTP settings and a valid admin email is very important. You need to register an admin account once your discourse is up and running, and an email will be sent to the configured admin account.

5- Once the installation is completed and you can browse your discourse forum using the IP of your VPS go to your domain registrar’s admin panel and set the A record of your domain to the IP of your VPS server.

6- If you have a backup, you can restore it using the admin panel of your discourse forum. You will need to copy the backup file from your development machine to your VPS, and then from your VPS to the docker container’s file system (your running Discourse instance). See this link.

You can use the following command to copy files from your dev machine to your remote VPS: scp <local file> <remote user>@<remote machine>:<remote path>

To be able to restore a discourse backup, you must enable restoring on the admin panel.

Connecting to Running Container on Docker

While managing your Discourse forum on your own VPS, you will need to connect to the running container instance (Discourse container) on Docker. First, find the id of the running container. There are 2 ways you can do this:

  • docker ps
  • docker container list

Once you get the container id you can use the command below to connect to the container:

docker exec -it container_id bash

This will open a bash shell for you in the running discourse container. Once you are finished in there, use “CTRL + d” to exit the container.

Hope this helps.
Good Luck,
Serdar