August 3, 2020

Issues during Discourse Deployment

Issues during Discourse Deployment

Environment: GCP, Debian 10, Bitnami Stack, Discourse

Issue One: After creating VM instance using Bitnami Discourse stack in marketplace, everything works fine via HTTP. However, after you run bnhelper-tool to enable HTTPS via LetsEncrypt, the HTTPS links may have problems of “mixed content”, or “refused to load”, etc.

Solution: edit the .conf file

$ nano /home/<your name>/apps/discourse/conf/httpd-app.conf

add this line (in between directory):

Header always set Content-Security-Policy "upgrade-insecure-requests;"

then restart

Issue Two: In Discourse, when you first login as admin, and attempt to update your primary email (default is [email protected]) in preference, you find that not only new email (such as [email protected]) needs to be verified, but the old email ([email protected]) also needs to be verified, which is impossible.

Solution: the official document is

In short, you have to do some simple queries in PostgreSQL database:

$ cd /home/<your_name>/apps/discourse/htdocs/
$ sudo RAILS_ENV=production bundle exec rails c

A new prompt should appear, as shown below:


At the prompt, run the following commands to change the email address of the default user account to a new email address. Replace the EMAIL_ADDRESS placeholder in the commands below with your desired email address:

> u = User.find_by_username("user")
> u.email_tokens.create(email:
> u.activate

exit SQL