Official Discourse Docker installsupports one-click online upgrade right from your admin, which is not supported by Bitnami image.
Hence, we decided to go with direct Discourse install ourselves. To our surprise, it was pretty as eating a baked cake in Starbucks!
Here are the steps if you would like to move your existing Discourse website with all its data to new server:
Move your Discourse Instance to a Different Server
To create a new Google Compute VM (1 vCPU, 3.75 GB memory). We will run Discourse Docker on this machine.
- First launch a Google compute engine instance with Ubuntu. At this time, we used this one:
- Click ‘Launch on compute Engine‘.
- On the next screen under ‘Firewalls‘, do not forget to check http and https traffic options.
- Wait for your instance to be set up by Google Launcher.
- Once done, click on the ‘ssh‘ button to launch the command prompt into your newly launched Ubuntu machine.
- On the command prompt, you can just follow this guide from Discourse directly line by line. Just a few commands and your discourse forum will be up and running.
Follow the discourse install article: https://github.com/discourse/discourse/blob/master/docs/INSTALL-cloud.md
- Wasn’t that easy? Any issues? Ask us in the comments and we will try to help you.
Moving your old server’s database and all files to new server
- Use the back up utility from the discourse admin on your current install (in our case, it is Bitnami’s discourse image) to create backup and download on your local machine.
Go to your current Discourse Website->Admin->Backups->BackUp
- Then, upload this file to new install and use ‘restore’ button.
- The complete step by step process is given here by Discourse:
Error in restore
You might get this error while restoring from Bitnami install to most recent Discourse Docker install:
ERROR: unrecognized configuration parameter “idle_in_transaction_session_timeout”
This error is thrown as parameter idle_in_transaction_session_timeout was introduced in postgresql version 9.6..
The current bitnami image uses the postgresql verson 9.6.5 but the discourse docker is still on v 9.5.
- Extract your current *.tar.gz back up file to .tar file using 7 Zip.
- Extract this .tar file to normal files.
- In the extracted files, you have one dump.sql.gz file.
- Extract it further to dump.sql using 7 Zip.
At this time, you should be able to see these files:
- Open dump.sql file and find the line which has the variable ‘idle_in_transaction_session_timeout‘.
- Comment this line or delete it completely. Save and close the file.
- We now have to compress the file in reverse order of the way we extracted them.
- Make sure you keep the final *.tar.gz file name same as the original file that you downloaded from your current site’s discourse back up.
Example, if the original back up file name was
truvisa-2017-12-27-222220-v20170831180419.tar.gz, this should be same in the one you create it too.
- This file name has version number that is checked by discourse restore process. If you miss the version number in file name, restore process will fail again.
- Upload this file to your new server where you are trying to restore. Run and it should work fine now.
Changing app.yml file
app.yml file permissions by default:
To change ownership of app.yml to your own ID. This will help you modify file, if you are connecting to your compute engine VM using winscp
sudo chown USER_NAME:root -R /var/discourse/containers/app.yml
To change ownership back to root once you are done editing:
sudo chown root:root -R /var/discourse/containers/app.yml
To get into root mode in ssh shell anytime:
Then, you can run this command to re-build discourse:
./launcher rebuild app
Re-build process takes a couple of minutes (around 3-4). Once, it is done, your discourse is up and running.
To check logs after re-build has completed:
./launcher logs app
Real Demo of Discourse Docker?
You can see this official Discourse Docker install running here: https://www.truvisa.com
Benefits of using official Discourse Docker Image vs Bitnami Discourse Image?
Your preference may be different but I found these immediate pros:
- Most updated and most recent Discourse version is installed by official one. At this time, Bitnami image usually lags behind by approximately 10 minor releases.
- I am not sure but many people have have argued that Bitnami image actually carries development version code of Discourse. If this is true, it straight-away makes it a slower proposition.
- I have explicitly observed that Bitnami’s version does NOT set ‘cache-control’ headers for static files. This is one of the biggest factor that will SLOW down your discourse install. My FIRST page load time was about 4.6 seconds with this image.
After moving to Official Discourse Image, i have seen a direct reduction of about 2 seconds in FIRST page load time. That’s HUGE difference. This is due to that fact that I am using Google CDN with Load balancer and it automatically caches files with Cache-control header.
With Bitnami image, nothing was getting cached. Neither at client browser nor at CDN level.
- You get Discourse one click upgrade option right in the Admin section for Discourse. With Bitnami, the upgrade process involves extensive back up, creating a NEW server and copying over all data to NEW server. That’s really a hell lot of work every-time you need to upgrade.