Install Discourse Forum Software on Ubuntu 18.04 Without Docker

This tutorial is going to show you how to install Discourse on Ubuntu 18.04 server. Created by StackExchange founder Jeff Atwood, Discourse is an open source Internet forum (aka online message board) and mailing list management software, with the aim of revolutionizing forum discussion. It’s written with Ember.js and Ruby on Rails, using PostgreSQL as the back-end database management system.

Features of Discourse

  • Infinite scrolling. There’s no next page in a thread. Just scroll down to read more.
  • live updates, drag and drop attachments.
  • Forum threads can be ranked by popularity.
  • The “best of thread” view can show the best reply to a particular thread.
  • The ability to remember where you were reading in a thread.
  • Expanding URLs to provide a summary of the URL.
  • Users can reply via email.
  • The flagging system automatically hides inappropriate posts until they can be reviewed by a staff member.
  • Moderators can split, merge, local or archive any topic.
  • Based on the level of trust, a user can be promoted as moderator, or demoted as trolls, bad actors or spammers to keep the forum civilized. Builtin Akismet spam protection and heuristics including new user sandboxing, user flag blocking, and standard nofollow.
  • A badge system can show what a user has achieved.
  • Mobile-friendly, responsive web design. Users can read or post from laptop, tablet and phone.
  • 100% free open source. No paid commercial version with better or more complete features.
  • Single sign-on. Seamlessly integrate Discourse with your existing site’s login system.
  • Social login. Easily add common social logins like Google, Facebook, Twitter, etc.
  • iOS and Android app available.
  • Available in more than 30 languages.
  • Two-factor authentication to improve account security.
  • And many more.

Prerequisites of Installing Discourse on Ubuntu 18.04 Without Docker

The official method of installing Discourse is with Docker, which is great for those who want to get an application up and running quickly. But Docker is also resource hungry. Just think about it: If you have already got some components like PostgreSQL database server up and running, the Docker method will still run a separate PostgreSQL database inside the container, which is a waste of server resources. You need a 2GB RAM server to run Discourse with Docker. I’m going to show you how to run Discourse on a 1GB RAM server without docker.

To run Discourse, you need a server with at least 1GB RAM. You can click this referral link to create an account at Vultr to get $50 free credit (for new users only). Once you have an account at Vultr, install Ubuntu 18.04 on your server and follow the instructions below.

You also need a domain name. I registered my domain name at NameCheap because the price is low and they give whois privacy protection free for life.

Notice: I installed Discourse with a sudo user on Ubuntu 18.04. For best results, you should also follow this tutorial with a sudo user, not root.

To add a sudo user, simply run

sudo adduser username
sudo adduser username sudo

Then switch to the new user.

su - username

Step 1: Configure PostgreSQL Database Server

Log into your server via SSH, then run the following command to install PostgreSQL from the default Ubuntu software repository.

sudo apt install postgresql

PostgreSQL database server will automatically start and listens on 127.0.0.1:5432, as can be seen with the following command.

sudo netstat -lnpt | grep postgres

discourse postgresql

If you don’t see any output from the above command, it’s probably because PostgreSQL server isn’t running. You can start PostgreSQL server by issuing the following command.

sudo systemctl start postgresql

The postgres user will be created on the OS during the installation process. It’s the super user for PostgreSQL database server. By default, this user has no password and there’s no need to set one because you can use sudo to switch to the postgres user and log into PostgreSQL console.

sudo -u postgres psql

Create a database for Discourse.

CREATE DATABASE discourse;

Create a database user.

CREATE USER discourse_user;

Set a password for this user.

ALTER USER discourse_user WITH ENCRYPTED PASSWORD 'your_preferred_password';

Set this user as the owner of discourse database.

ALTER DATABASE discourse OWNER TO discourse_user;

Connect to the discourse database.

\c discourse;

Create the hstore and pg_trgm extension.

CREATE EXTENSION hstore;

CREATE EXTENSION pg_trgm;

Log out from the PostgreSQL console.

\q

Step 2: Install Latest Version of Ruby on Ubuntu 18.04

Discourse requires Ruby 2.5.2 or up. However, Ubuntu 18.04 comes with Ruby 2.5.1. We can install the latest version of Ruby via the Ruby version manager (RVM). First, install GNU privacy guard.

sudo apt install gnupg2

Import the public of Ruby version manager.

gpg2 --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB

Then install RVM with default Ruby and Rails.

\curl -sSL https://get.rvm.io | bash -s stable --rails

Once the installation is complete, run the following command to source RVM scripts.

source ~/.rvm/scripts/rvm

List the available Ruby versions installed by RVM.

rvm list

Sample Output:

=* ruby-2.6.3 [ x86_64 ]

# => - current
# =* - current && default
# * - default

As you can see, ruby 2.6.3 is installed on my server.

Step 3: Download and Configure Discourse

Install the git tool.

sudo apt install git

Assuming you are at your home directory, run the following command to clone the Discourse code repository from Github.

git clone https://github.com/discourse/discourse.git

Move the directory to /var/www/.

sudo mv discourse/ /var/www/

Change directory and use the latest stable release of Discourse. You can go to the Github releases page to see the latest stable version. I’m now using v2.3.4.

cd /var/www/discourse/

git checkout v2.3.4

Install bundler: the Ruby dependency manager.

~/.rvm/rubies/ruby-2.6.3/bin/gem install bundler -v '1.17.3'

Install the following packages to compile source code.

sudo apt-get install gcc ruby-dev libxslt-dev libxml2-dev zlib1g-dev libpq-dev imagemagick

Then install dependencies of Discourse. This process could use a lot of RAM.

RAILS_ENV=production bundle install --path vendor/bundle/

Copy the default configuration file to a new file.

cp config/discourse_defaults.conf config/discourse.conf

Edit the new file.

nano config/discourse.conf

Configure the database connection.

# host address for db server
# This is set to blank so it tries to use sockets first
db_host = localhost

# port running db server, no need to set it
db_port = 5432

# database name running discourse
db_name = discourse

# username accessing database
db_username = discourse_user

# password used to access the db
db_password = your_password

Change the domain name used with your Discourse forum.

# hostname running the forum
hostname = "community.example.com"

Save and close the file.

Step 4: Start Discourse

Install required packages.

sudo apt install redis-server optipng pngquant jhead jpegoptim gifsicle

Edit the production environment config file.

nano /var/www/discourse/config/environments/production.rb

Add the following code as the fifth line.

require 'uglifier'

Then find the following line.

config.assets.js_compressor = :uglifier

Replace it with:

config.assets.js_compressor = Uglifier.new(harmony: true)

Save and close the file. Then run the following command to initialize the database. If you see any errors during this step, simply run the command again.

RAILS_ENV=production bundle exec rake db:migrate

Next, we are going to compile static assets such as JavaScript, but before doing that, we need to edit a file.

nano /var/www/discourse/lib/tasks/assets.rake

We need to find the lines that contains brotli and comment them out to disable Brotili compression, because the JavaScript files will be compressed with Gzip. If Gzip and Brotili compression are both enabled, there will be some annoying errors when we compile the assets. Find the following line (line 269) and comment it out.

brotli(path, max_compress)

Save and close the file. Next, run the following command to compile assets.

RAILS_ENV=production bundle exec rake assets:precompile

Next, edit the puma.rb file

nano /var/www/discourse/config/puma.rb

Find the following lines.

APP_ROOT = '/home/discourse/discourse'

Change the application path to

APP_ROOT = '/var/www/discourse'

Save and close the file. Then create the sockets and process ID directory.

mkdir /var/www/discourse/tmp/sockets/
mkdir /var/www/discourse/tmp/pids/

Start Discourse.

RAILS_ENV=production bundle exec puma -C /var/www/discourse/config/puma.rb

Sample output:

[28389] Puma starting in cluster mode...
[28389] * Version 3.12.1 (ruby 2.6.3-p62), codename: Llamas in Pajamas
[28389] * Min threads: 8, max threads: 32
[28389] * Environment: development
[28389] * Process workers: 4
[28389] * Preloading application
[28389] * Listening on unix:///var/www/discourse/tmp/sockets/puma.sock
[28389] ! WARNING: Detected 3 Thread(s) started in app boot:
[28389] ! #<Thread:[email protected]/var/www/discourse/vendor/bundle/ruby/2.6.0/gems/message_bus-2.2.0/lib/message_bus.rb:667 sleep> - /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/hiredis-0.6.3/lib/hiredis/ext/connection.rb:19:in `read'
[28389] ! #<Thread:[email protected]/var/www/discourse/vendor/bundle/ruby/2.6.0/gems/message_bus-2.2.0/lib/message_bus/timer_thread.rb:38 sleep> - /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/message_bus-2.2.0/lib/message_bus/timer_thread.rb:123:in `sleep'
[28389] ! #<Thread:[email protected]/var/www/discourse/lib/discourse.rb:616 sleep> - /var/www/discourse/lib/discourse.rb:619:in `sleep'
[28389] * Daemonizing...

Discourse is listening on Unix socket: /var/www/discourse/tmp/sockets/puma.sock.

Step 5: Configure Nginx Reverse Proxy

Install Nginx web server from the default Ubuntu 18.04 software repository.

sudo apt install nginx

Copy the sample Nginx virtual host configuration file.

sudo cp /var/www/discourse/config/nginx.sample.conf /etc/nginx/conf.d/discourse.conf

Edit the new file.

sudo nano /etc/nginx/conf.d/discourse.conf

Find the following lines and comment them out because we are going to use puma.

upstream discourse {
    server unix:/var/www/discourse/tmp/sockets/thin.0.sock;
    server unix:/var/www/discourse/tmp/sockets/thin.1.sock;
    server unix:/var/www/discourse/tmp/sockets/thin.2.sock;
    server unix:/var/www/discourse/tmp/sockets/thin.3.sock;
}

Find the following lines and uncomment them.

# upstream discourse {
#       server unix:/var/www/discourse/tmp/sockets/puma.sock;
# }

Find the following line.

server_name enter.your.web.hostname.here;

Change the server name. Don’t forget to add DNS A record for the domain name.

server_name community.example.com;

Nginx by default doesn’t support Brotli compression, so comment out the following line.

brotli_static on;

Save and close the file. Create the cache directory.

sudo mkdir -p /var/nginx/cache/

Then test nginx configuration.

sudo nginx -t

If the test is successful, reload Nginx for the changes to take effect.

sudo systemctl reload nginx

Now you should be able to see the Discourse forum at http://community.example.com.

Step 6: Enable HTTPS

To encrypt HTTP traffic, we can enable HTTPS by installing a free TLS certificate issued from Let’s Encrypt. Run the following command to install Let’s Encrypt client (certbot) on Ubuntu 18.04 server.

sudo apt install certbot python3-certbot-nginx

Next, run the following command to obtain and install TLS certificate.

sudo certbot --nginx --agree-tos --redirect --hsts --staple-ocsp --email [email protected] -d community.example.com

Where

  • --nginx: Use the nginx plugin.
  • --agree-tos: Agree to terms of service.
  • --redirect: Force HTTPS by 301 redirect.
  • --hsts: Add the Strict-Transport-Security header to every HTTP response. Forcing browser to always use TLS for the domain. Defends against SSL/TLS Stripping.
  • --staple-ocsp: Enables OCSP Stapling. A valid OCSP response is stapled to the certificate that the server offers during TLS.

The certificate should now be obtained and automatically installed.

install discourse ubuntu 18.04 without docker

And you can access Discourse forum via HTTPS (https://community.example.com).

install discourse forum on ubuntu 18.04

If Firefox shows a yellow triangle in the browser address bar, that’s because some images are still served on HTTP protocol. To solve this problem, you can edit the Discourse Nginx configuration file.

sudo nano /etc/nginx/conf.d/discourse.conf

Add the following line in the SSL server block to upgrade insecure requests.

add_header Content-Security-Policy upgrade-insecure-requests;

discourse https upgrade insecure requests

Save and close the file. And reload Nginx.

sudo nginx -t
sudo systemctl reload nginx

Step 7: Create Admin Account

Go to the discourse directory (/var/www/discourse/) and run the following command to create an admin account.

RAILS_ENV=production bundle exec rake admin:create

You will be asked to enter an email address and password for the admin account.

discourse create admin account from console

After that, restart Discourse.

RAILS_ENV=production bundle exec pumactl -P /var/www/discourse/tmp/pids/puma.pid restart

Now refresh the Discourse web page and you will be able to login.

restart discourse

Once logged in, you can start the setup wizard. (https://community.example.com/wizard) and follow the instructions to finish installation. If you use Cloudflare CDN, then you need to go to settings -> security -> content security policy src and add this URL: https://community.example.com/cdn-cgi/

Step 8: Configure background Processing Service: Sidekiq

Sidekiq is an open source job scheduler. Many tasks, like sending emails, are executed asynchronously by sidekiq. Edit the sidekiq.yml file.

nano /var/www/discourse/config/sidekiq.yml

Add the following lines to the end of the file. This configuration is suitable for a Discourse forum with low user activity and RAM. If there are lots of users activities, consider doubling the concurrency and number of queues.

production:
  :concurrency: 2
  :queues:
    - [critical, 4]
    - [default, 2]
    - [low]
    - [ultra_low]

Save and close the file. Then create a Systemd service for sidekiq.

sudo nano /etc/systemd/system/discourse-sidekiq.service

Add the following lines in the file. Replace username with your real username.

[Unit]
Description=Discourse sidekiq background processing service
After=multi-user.target

[Service]
Type=simple
User=username
PIDFile=/var/www/discourse/tmp/pids/sidekiq.pid
WorkingDirectory=/var/www/discourse
Environment=RAILS_ENV=production
ExecStart=/home/username/.rvm/gems/ruby-2.6.3/wrappers/bundle exec sidekiq -C config/sidekiq.yml
Restart=on-failure
RestartSec=5

[Install]
WantedBy=multi-user.target

Save and close the file. Then start and enable this service.

sudo systemctl start discourse-sidekiq
sudo systemctl enable discourse-sidekiq

Check the status. Make sure it’s runing.

sudo systemctl status discourse-sidekiq

Step 9: Create Systemd Service for Discourse

First, stop the current Discourse process with

cd /var/www/discourse/
RAILS_ENV=production bundle exec pumactl -P /var/www/discourse/tmp/pids/puma.pid stop

Then edit the puma.rb file.

nano /var/www/discourse/config/puma.rb

Comment out the following two lines (Add the # symbol at the beginning of each line) because Systemd will handle process ID and daemonization.

pidfile "#{APP_ROOT}/tmp/pids/puma.pid"

daemonize true

Next, create a Systemd service for Discourse.

sudo nano /etc/systemd/system/discourse.service

Add the following lines in the file.  Replace username with your real username.

[Unit]
Description=Discourse service

[Service]
Type=simple
User=username
PIDFile=/var/www/discourse/tmp/pids/puma.pid
WorkingDirectory=/var/www/discourse
Environment=RAILS_ENV=production
ExecStart=/home/username/.rvm/gems/ruby-2.6.3/wrappers/bundle exec puma -C config/puma.rb
Restart=on-failure
RestartSec=5

[Install]
WantedBy=multi-user.target

Save and close the file. Then start and enable this service.

sudo systemctl start discourse
sudo systemctl enable discourse

Check the status. Make sure it’s runing.

sudo systemctl status discourse

Step 10: Configure SMTP

Discourse needs to send emails so that visitors can register account on your forum and receive notifications. To edit SMTP settings, open the discourse.conf file.

nano /var/www/discourse/config/discourse.conf

You can find the following lines to configure SMTP server. Normally you would want to use 587 as the SMTP port.

# address of smtp server used to send emails
smtp_address =
# port of smtp server used to send emails
smtp_port = 25

# domain passed to smtp server
smtp_domain =

# username for smtp server
smtp_user_name =

# password for smtp server
smtp_password =

# smtp authentication mechanism
smtp_authentication = plain

# enable TLS encryption for smtp connections
smtp_enable_start_tls = true

You may also want to add the From: address in this file like below.

# From: address
notification_email = [email protected]

For how to set up your own mail server, please check out the following tutorial:

If you prefer to use a third party SMTP relay service, then I recommend Mailjet, which allows you to send 6000 emails per month for free.

After saving the SMTP settings, restart Discourse service.

sudo systemctl restart discourse

Then you can test email sending in your Discourse admin dashboard. You can go to mail-tester.com, which will give you a unique email address. Send a test email from your Discourse to this email address to know your sender score.

Optimize RAM Usage

The default puma configuration makes Discourse use a lot of RAM. By default, my Discourse uses 4 workers, 8 minimal threads, 32 maximal threads. If your RAM isn’t enough, the redis server will be stopped. To reduce RAM usage, you can decrease the number of workers and threads in puma.rb file.

nano /var/www/discourse/config/puma.rb

Find the following two lines.

workers "#{num_workers}"
threads 8, 32

You can change the values like below, which tells puma to use 2 workers, 4 minimal threads and 16 maximal threads. This setting is suitable for servers with only 1GB RAM.

workers 2
threads 4, 16

Save and close the file. Then restart the Discourse service.

sudo systemctl restart discourse

Upgrade Discourse

You can subscribe to the RSS feed of Discourse releases to stay informed with the latest version. Before upgrading Discourse, I strongly recommend doing a manual database backup in the Discourse admin dashboard and download it to your hard disk.

Note: The one-click browser upgrade (https://community.yourdomain.com/admin/upgrade) doesn’t work if you installed Discourse without Docker. You need to follow the instructions below.

To upgrade Discourse, first stop the service.

sudo systemctl stop discourse

Go to the Discourse installation directory.

cd /var/www/discourse/

Get new tags from the Github repository.

git fetch --tags

Before checking out the latest stable version, I recommend backing up the configuration file to your home directory.

cp config/puma.rb ~
cp config/environments/production.rb ~
cp config/sidekiq.yml ~

Then delete the Gemfile.lock file.

rm Gemfile.lock

And check out the latest stable version. For instance,

git checkout v2.3.4

Install dependencies for the new Discourse version. This process could use a lot of RAM.

RAILS_ENV=production bundle install --path vendor/bundle/

Prepare for production.

RAILS_ENV=production bundle exec rake db:migrate
RAILS_ENV=production bundle exec rake assets:precompile

Next, you can see if the new puma.rb configuration file has added some new lines, compared to the original file. If there’s nothing new, then you can simply replace the file with the original one.

mv ~/puma.rb /var/www/discourse/config/puma.rb
mv ~/production.rb /var/www/discourse/config/environments/production.rb
mv ~/sidekiq.yml /var/www/discourse/config/sidekiq.yml

Finally, start Discourse.

sudo systemctl start discourse

Now you can check Discourse version from the admin dashboard.

upgrade discourse without docker ubuntu

Conclusion

I hope this article helped you install Discourse forum software on Ubuntu 18.04 without using Docker. As always, if you found this post useful, then subscribe to our free newsletter to get more tips and tricks. Take care 🙂

Rate this tutorial
[Total: 6 Average: 5]

28 Responses to “Install Discourse Forum Software on Ubuntu 18.04 Without Docker

  • Brilliant article thanks for sharing

  • vanhussen
    1 month ago

    ~/.rvm/rubies/ruby-2.6.3/bin/gem install bundler -v ‘1.17.3’

    -bash: /root/.rvm/rubies/ruby-2.6.3/bin/gem: No such file or directory

    “No such file or directory”
    Why?

    • I installed Discourse with a sudo user on Ubuntu 18.04. For best results, you should also follow this tutorial with a sudo user, not root.

      To add a sudo user, simply run

      sudo adduser username
      sudo adduser username sudo
      • vanhussen
        1 month ago

        [email protected]:/var/www/discourse$ RAILS_ENV=production bundle exec rake db:migrate
        Could not find rake-12.3.3 in any of the sources
        Run `bundle install` to install missing gems.
        [email protected]:/var/www/discourse$ sudo RAILS_ENV=production bundle exec rake db:migrate
        Discourse requires Ruby 2.5.2 or up
        [email protected]:/var/www/discourse$

        Why sir?

    • Because you didn’t install Ruby correctly.

  • vanhussen
    1 month ago

    [28400] ! WARNING: Detected 3 Thread(s) started in app boot:

    [28400] ! # – /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/hiredis-0.6.1/lib/hiredis/ext/connection.rb:19:in `read’
    [28400] ! # – /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/message_bus-2.2.0.pre.1/lib/message_bus/timer_thread.rb:123:in `sleep’
    [28400] ! # – /var/www/discourse/lib/discourse.rb:587:in `sleep’
    [28400] Use Ctrl-C to stop

    Why? please help

  • vanhussen
    1 month ago

    NUMBER 1st:
    Please update your tutorial, becouse you are not using ‘sudo’ on:
    sudo git checkout v2.3.4
    sudo git clone https://github.com/discourse/discourse.git

    NUMBER two:
    [email protected]:~$ RAILS_ENV=production bundle install –path vendor/bundle/
    Could not locate Gemfile
    [email protected]:~$ sudo RAILS_ENV=production bundle install –path vendor/bundle/
    sudo: bundle: command not found
    [email protected]:~$

    Now what? Thank you sir

    • Not every command needs sudo privilege. Your problem is that you used root account to follow this tutorial before and now you are using a sudo user. I recommend deleting the /var/www/discourse/ directory and start over.

      sudo rm /var/www/discourse/ -rf
      • vanhussen
        1 month ago

        Ok, I think you forget to type ‘sudo’ on:

        sudo git clone https://github.com/discourse/discourse.git
        sudo git checkout v2.3.4

      • vanhussen
        1 month ago

        Ok, well Done! Now everything is good. Thank you so much !

    • Nope.

      I ran the git clone command under my home directory without “sudo”.

    • It’s super easy.

      • vanhussen
        1 month ago

        Ohh I see. I think becouse I install docker from new Droplet on digital ocean. So I don’t have directory ‘www’ before

      • vanhussen
        1 month ago

        https://diskusi.rsudpalembangbari.online/

        Already installed on my server, with user username. not root

        but my website https is incorrect.

        I already did the steps you made:
        sudo apt install certbot python3-certbot-nginx
        sudo certbot –nginx –agree-tos –redirect –hsts –staple-ocsp –email [email protected] -d diskusi.rsudpalembangbari.online

        You can try to access my sites or click some link on there.
        Please help me again, thank you

    • Edit the Discourse Nginx configuration file.

      sudo nano /etc/nginx/conf.d/discourse.conf

      Add the following line in the SSL server block to upgrade insecure requests.

      add_header Content-Security-Policy upgrade-insecure-requests;

      discourse https upgrade insecure requests
      Save and close the file. And reload Nginx.

      sudo nginx -t
      sudo systemctl reload nginx
      • vanhussen
        1 month ago

        Ok, thank you. Now everything is OK.
        https://help.rsudpbari.com

        Thank you brother.

  • vanhussen
    1 month ago

    Hello friend, do you have tutorial:
    How can I run both nginx and Apache together on Ubuntu?

    Please share it. Thank you..

    • Please see the comment policy.

      • vanhussen
        1 month ago

        Ok, done.

      • vanhussen
        4 weeks ago

        [email protected]:/var/www/discourse$ mv ~/puma.rb /var/www/discourse/config/puma.rb
        [email protected]:/var/www/discourse$ mv ~/production.rb /var/www/discourse/config/environments/production.rb
        [email protected]:/var/www/discourse$ mv ~/sidekiq.yml /var/www/discourse/config/sidekiq.yml
        [email protected]:/var/www/discourse$ sudo systemctl start discourse
        [email protected]:/var/www/discourse$ RAILS_ENV=production bundle exec rake db:migrate
        rake aborted!
        NameError: uninitialized constant Sprockets::Engines
        /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/ember-rails-0.18.5/lib/ember/rails/engine.rb:19:in `block in ‘
        /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/lazy_load_hooks.rb:69:in `block in execute_hook’
        /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/lazy_load_hooks.rb:62:in `with_execution_control’
        /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/lazy_load_hooks.rb:67:in `execute_hook’
        /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/lazy_load_hooks.rb:52:in `block in run_load_hooks’
        /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/lazy_load_hooks.rb:51:in `each’
        /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/lazy_load_hooks.rb:51:in `run_load_hooks’
        /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/railties-5.2.3/lib/rails/application/bootstrap.rb:81:in `block in ‘
        /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/railties-5.2.3/lib/rails/initializable.rb:32:in `instance_exec’
        /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/railties-5.2.3/lib/rails/initializable.rb:32:in `run’
        /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/railties-5.2.3/lib/rails/initializable.rb:61:in `block in run_initializers’
        /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/railties-5.2.3/lib/rails/initializable.rb:60:in `run_initializers’
        /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/railties-5.2.3/lib/rails/application.rb:361:in `initialize!’
        /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/railties-5.2.3/lib/rails/railtie.rb:190:in `public_send’
        /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/railties-5.2.3/lib/rails/railtie.rb:190:in `method_missing’
        /var/www/discourse/config/environment.rb:7:in `’
        /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/railties-5.2.3/lib/rails/application.rb:337:in `require_environment!’
        /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/railties-5.2.3/lib/rails/application.rb:520:in `block in run_tasks_blocks’
        /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/rake-12.3.3/exe/rake:27:in `’
        /var/www/discourse/vendor/bundle/ruby/2.6.0/bin/ruby_executable_hooks:24:in `eval’
        /var/www/discourse/vendor/bundle/ruby/2.6.0/bin/ruby_executable_hooks:24:in `’
        Tasks: TOP => db:migrate => db:load_config => environment
        (See full trace by running task with –trace)

        Error after update Xiao Guoan, please help

    • This article didn’t say you should run the following command after upgrading Discourse.

      RAILS_ENV=production bundle exec rake db:migrate

      And why do you think you give a person 1 dollar and expect him to answer your every question?

  • Hi. I successfully got to the point of displaying site with SSL. After adding admin with “RAILS_ENV=production bundle exec rake user:create” the website went blank, white screen. When I navigated to Domain.tld/admin the site showed this message “Oops! That page doesn’t exist or is private.” Do you know why this is happening?

    Also, I noticed it shows development environment when starting, could this be related? Please see below:

    [email protected]:/var/www/html/discourse$ RAILS_ENV=production bundle exec pumactl -P /var/www/html/discourse/tmp/pids/puma.pid start
    [8759] Puma starting in cluster mode…
    [8759] * Version 3.12.1 (ruby 2.6.3-p62), codename: Llamas in Pajamas
    [8759] * Min threads: 8, max threads: 32
    [8759] * Environment: development
    [8759] * Process workers: 4
    [8759] * Preloading application
    [8759] * Listening on unix:///var/www/html/discourse/tmp/sockets/puma.sock
    [8759] ! WARNING: Detected 3 Thread(s) started in app boot:
    [8759] ! # – /var/www/html/discourse/vendor/bundle/ruby/2.6.0/gems/hiredis-0.6.3/lib/hiredis/ext/connection.rb:19:in `read’
    [8759] ! # – /var/www/html/discourse/vendor/bundle/ruby/2.6.0/gems/message_bus-2.2.0/lib/message_bus/timer_thread.rb:123:in `sleep’
    [8759] ! # – /var/www/html/discourse/lib/discourse.rb:619:in `sleep’
    [8759] * Daemonizing…

    • Resolved the issue. The main .js file was somehow renamed with an added under slash (why?) I renamed public/assets/_vendor-25f91d66eba869fbd399d751711e74544b6d60bf034a5350b61c6c12caad0e2a.js to public/assets/vendor-25f91d66eba869fbd399d751711e74544b6d60bf034a5350b61c6c12caad0e2a.js and it started working

Leave a Comment

  • Comments with links are moderated by admin before published.
  • Your email address will not be published.
  • Use <pre> ... </pre> HTML tag to quote the output from your terminal/console.
  • Please use the community (https://community.linuxbabe.com) for questions unrelated to this article.
  • If you ask me more than 5 questions, I expect you to make a donation, or I would stop answering your questions.