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. (If your Ubuntu server doesn’t have the netstat command, you can run sudo apt install net-tools command to install it.)

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 Ruby on Ubuntu 18.04

Discourse requires Ruby 2.6 or up. However, Ubuntu 18.04 repository comes with Ruby 2.5.1. The latest version of Ruby is 2.7.1. However, I don’t recommend using the latest version, because it might not be compatible with Discourse. For best compatibility, I recommend installing Ruby 2.6 from a PPA.

sudo apt install software-properties-common

sudo apt-add-repository ppa:brightbox/ruby-ng

sudo apt install ruby2.6

To check your Ruby version number, run

ruby -v

Output:

ruby 2.6.6p146 (2020-03-31 revision 67876) [x86_64-linux]

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

Create the /var/www/ directory, if it’s not already created.

sudo mkdir /var/www/

Move the discourse 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.5.0.

cd /var/www/discourse/

git checkout v2.5.0

Install bundler: the Ruby dependency manager.

sudo /usr/bin/gem install bundler

Install the following packages to compile source code.

sudo apt-get install gcc build-essential ruby2.6-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 /usr/local/bin/bundle config set path '/var/www/discourse/vendor/bundle/'
RAILS_ENV=production /usr/local/bin/bundle install

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: Obtain a Free MaxMind Licence Key

Discourse comes with a built-in web analytics tool. If you want to know the geographic information of your visitors, you need a MaxMind licence key.

Create an account at MaxMind. Maxmind will send you an email. Click the link in the email to set a password, then log in to your MaxMind account.  Next, select My License Key on the left bar.

maxmind license key

Click the Generate New License Key button.

maxmind generate new license key

Give your license key a name. Then choose No, because we don’t need to use the geoipupdate program. Then click the Confirm button.

geoipupdate

Once the license key is created, copy the license key. Open the Discourse configuration file.

nano config/discourse.conf

Find the following line and add your license key here.

maxmind_license_key=

Save and close the file.

Step 5: Start Discourse

Install required packages.

sudo apt install redis-server optipng pngquant jhead jpegoptim gifsicle nodejs npm

sudo npm install -g svgo

Edit the production environment config file.

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

Add the following code as the fifth line.

require 'uglifier'

discourse production configuration

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 /usr/local/bin/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 contain 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 281) and comment it out.

brotli(path, max_compress)

Save and close the file. Next, run the following command to compile assets. This process can use lots of RAM like 1GB.

RAILS_ENV=production /usr/local/bin/bundle exec rake assets:precompile

Next, edit the puma.rb file

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

Find the following line.

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/ /var/www/discourse/tmp/pids/

Start Discourse.

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

Sample output:

[24161] Puma starting in cluster mode...
[24161] * Version 4.3.1 (ruby 2.6.6-p146), codename: Mysterious Traveller
[24161] * Min threads: 8, max threads: 32
[24161] * Environment: development
[24161] * Process workers: 4
[24161] * Preloading application
[24161] * Listening on unix:///var/www/discourse/tmp/sockets/puma.sock
[24161] ! WARNING: Detected 4 Thread(s) started in app boot:
[24161] ! #<Thread:0x000055c7d2b72d08@/var/www/discourse/vendor/bundle/ruby/2.6.0/gems/concurrent-ruby-1.1.6/lib/concurrent-ruby/concurrent/atomic/ruby_thread_local_var.rb:38 sleep_forever> - /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/concurrent-ruby-1.1.6/lib/concurrent-ruby/concurrent/atomic/ruby_thread_local_var.rb:40:in `pop'
[24161] ! #<Thread:0x000055c7d543cfb8@/var/www/discourse/vendor/bundle/ruby/2.6.0/gems/message_bus-2.2.3/lib/message_bus.rb:667 sleep> - /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/redis-4.1.3/lib/redis/connection/ruby.rb:68:in `select'
[24161] ! #<Thread:0x000055c7d543cd88@/var/www/discourse/vendor/bundle/ruby/2.6.0/gems/message_bus-2.2.3/lib/message_bus/timer_thread.rb:38 sleep> - /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/message_bus-2.2.3/lib/message_bus/timer_thread.rb:123:in `sleep'
[24161] ! #<Thread:0x000055c7d5f04680@lib/discourse.rb:708 sleep> - lib/discourse.rb:711:in `sleep'
[24161] * Daemonizing...

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

Step 6: 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/nginx.http.sock;
  server unix:/var/www/discourse/tmp/sockets/nginx.https.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 7: 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 you@example.com -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 8: Create Admin Account

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

RAILS_ENV=production /usr/local/bin/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 /usr/local/bin/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

If you see the 502 bad gateway error, then the restart command wasn’t successful, you need to start Discourse with:

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

Once logged in, you can start the setup wizard. (https://community.example.com/wizard) and follow the instructions to finish the 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 9: 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 user 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=/usr/local/bin/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 running.

sudo systemctl status discourse-sidekiq

Step 10: Create Systemd Service for Discourse

First, stop the current Discourse process with

cd /var/www/discourse/
RAILS_ENV=production /usr/local/bin/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=/usr/local/bin/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 running.

sudo systemctl status discourse

Step 11: 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 = notifications@community.linuxbabe.com

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.

discourse send test email

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.

Unable to Send Email

If your Discourse instance doesn’t send emails and you see the following message on the Discourse web page,

All outgoing email has been globally disabled by an administrator. No email notifications of any kind will be sent.

you need to go to Settings -> Email (not Emails), set disable emails to no. Save the setting and restart Discourse.

sudo systemctl restart discourse discourse-sidekiq

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 ~
cp config/discourse.conf ~

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 /usr/local/bin/bundle install --path vendor/bundle/

Edit the assets.rake file.

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

Find the following line (line 273) and comment it out.

brotli(path, max_compress)

Save and close the file. Next, run the following commands to prepare for production.

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

Then you can check 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

Discourse Theme Customization

If you don’t like the default white theme, you can customize it via Admin dashboard -> Customize -> Themes. There are 3 themes installed by default.

  • Shades of Blue
  • Dark
  • Light

I selected the Shades of Blue theme. You can also add customize CSS by clicking the Edit CSS/HTML button. Below are the CSS I added for my Discourse.

html {
    background-color:#ececec;
}

#main-outlet {
    background-color: #fff;
    padding-left: 20px;
}

.d-header {
    background-color:rgb(45, 45, 45);
}


a:visited {
    color: blueviolet;
}

a {
    color: blueviolet;
}

How to Move Discourse to A New Server

First, make a backup of your original Discourse forum, and download the tar.gz file. (Do not change the filename.)

discourse backup

Then you need to install Discourse on the new server by following step 1 to step 11. Next, upload the backup file to /var/www/discourse/public/backups/default/ directory on the new server.

Go to the /var/www/discourse/ directory on the new server.

cd /var/www/discourse/

Install dependencies.

sudo gem install thor

Go to Discourse Admin dashboard -> Settings -> Backups, tick on allow restore.

discourse restore from backup command line

Next, run the following command to restore the site from backup.

RAILS_ENV=production script/discourse restore file-name-of-the-backup-file.tar.gz

Once the restore is finished, restart Discourse.

sudo systemctl restart discourse discourse-sidekiq

Refresh the Discourse web page, and you will see your original Discourse forum back online.

If you see the following error,

You must use Bundler 2 or greater with this lockfile.

Then you need to update bundler.

gem install bundler

Update gemfile.lock

RAILS_ENV=production bundle update --bundler

You can also remove the Gemfile.lock file so you won’t see this error.

How to Uninstall Discourse

Remove PostgreSQL database server.

sudo apt remove postgresql

Remove the webroot directory.

sudo rm /var/www/discourse/ -rf

Remove the Nginx config file.

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

Remove Let’s Encrypt SSL certificate.

sudo certbot revoke --cert-name community.example.com

Remove SystemD service.

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

Monitoring the Health Your Discourse Instance

You should keep an eye on the discourse error log, which you can find via Admin dashboard -> Logs -> Error Logs. If your server gets a lot of traffic, you might need more RAM to run Discourse. The following log shows my server was out of memory.

discourse error log

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]

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

  • Venz.ai
    1 year ago

    Brilliant article thanks for sharing

  • 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:

    supp@mrde:/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

  • Like to see an updated install guide of a usenet indexer, nzebd or nnplus , nnTmux or something different Might even be better..if you get bore$ that is :}

  • Hi! I used this tutorial in January to successfully install Discourse for one group of people.

    I was asked to install another Discourse for a different group, but this time it seems like there’s some updates (versions have changed etc) and I have a lot of deprecated commentary etc such as

    $ RAILS_ENV=production bundle exec rake admin:create
    /var/www/discourse/vendor/bundle/ruby/2.7.0/gems/activerecord-6.0.1/lib/active_record/type.rb:27: warning: Using the last argument as keyword parameters is deprecated; maybe ** should be added to the call
    /var/www/discourse/vendor/bundle/ruby/2.7.0/gems/activerecord-6.0.1/lib/active_record/type/adapter_specific_registry.rb:9: warning: The called method `add_modifier' is defined here
    /var/www/discourse/vendor/bundle/ruby/2.7.0/gems/activemodel-6.0.1/lib/active_model/type/integer.rb:13: warning: Using the last argument as keyword parameters is deprecated; maybe ** should be added to the call
    /var/www/discourse/vendor/bundle/ruby/2.7.0/gems/activemodel-6.0.1/lib/active_model/type/value.rb:8: warning: The called method `initialize' is defined here
    /var/www/discourse/vendor/bundle/ruby/2.7.0/gems/activerecord-6.0.1/lib/active_record/connection_adapters/postgresql/oid/specialized_string.rb:12: warning: Using the last argument as keyword parameters is deprecated; maybe ** should be added to the call
    /var/www/discourse/vendor/bundle/ruby/2.7.0/gems/activemodel-6.0.1/lib/active_model/type/value.rb:8: warning: The called method `initialize' is defined here
    /var/www/discourse/vendor/bundle/ruby/2.7.0/gems/activerecord-6.0.1/lib/active_record/relation/delegation.rb:115: warning: Using the last argument as keyword parameters is deprecated; maybe ** should be added to the call
    ...
    

    I got the initial discourse page up with the tada confetti but when I logged in, it just shows a blank page now. I don’t see anything showing up in /var/log/nginx/error.log when I navigate to , and the access log shows two pretty normal looking GET:

    "GET / HTTP/1.1" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.149 Safari/537.36" "list/latest" 200 11882 "-" 0.044 0.041 "-"
    "GET /manifest.webmanifest HTTP/1.1" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.149 Safari/537.36" "metadata/manifest" 200 1281 "https:///" 0.228 0.228 "-"
    

    (I have elided the dates and identifying domain/ip address)

    Hm, I may have a similar problem as Alex does above, am going to check that. But if there’s been some changes b/c of new versions coming out in the last few months…

    • Perhaps Ruby 2.7 isn’t compatible with the current version of Discourse. You can install Ruby 2.6 instead. I just updated this article to include instructions on installing Ruby 2.6 from the Snap store.

  • I notice that the default logrotate.rb assumes the log directory is still under the default /home/discourse/discourse .

    Should this be changed to /var/www/discourse?

  • Thanks for the tut, but i have a small issue i hope you can help with.

    I am currently running unraid with Nginx reverse proxy manager on it and of course everything in the network goes through it since undraid requires ports 80 and 443. everything on this side works fine.

    Here is my set up and problem. I have another separate hardware device that i want to run this on. I get all the way to the end of step 5 but I’m getting a bad gateway error. This is the same issue i had with apache on another machine and it was easily fixed by telling apache to listen on the needed port, lets just say port 86.

    Where do i find nginx’s config file so i can change the port the server listens on?

    Thanks

  • I figured it out but now all i have is the default nginx site. i dont see the discorse it says i should now see at the end of step 5

  • OK i figured it all out. It all related to port issues going through the reverse proxy on the unraid server

  • Hello, many thanks for this detailed tutorial!

    Ubuntu 18.04.4 LTS
    postgres (PostgreSQL) 10.12 (Ubuntu 10.12-0ubuntu0.18.04.1)
    Ruby 2.6/stable: 2.6.6 2020-04-01 (180) 26MB classic
    Discourse v2.4.2
    bundler -v ‘1.17.3’

    When I get to Step 4 and want to initialize the database, I run into trouble though:

    sudo RAILS_ENV=production bundle exec rake db:migrate --trace
    ** Invoke db:migrate (first_time)
    ** Invoke db:load_config (first_time)
    ** Invoke environment (first_time)
    ** Execute environment
    rake aborted!
    ActiveRecord::NoDatabaseError: FATAL:  Peer authentication failed for user "discourse_user"
    

    As mentioned in this tutorial, I repeated this step to solve the error, but that didn’t work…

    • I don’t think you need to add sudo at the beginning.

      • Thanks Xiao, tried both, with and without sudo, didn’t help.

        I decided to change my db_password to a simpler password without special characters and brackets, now all works fine 🙂
        If this is an issue with the machine’s locals or with Postgres, I will have to investigate.

        Thank you again, glad to see that someone puts so much effort in a public tutorial!!

    • It also could be that Discourse is trying to connect to the PostgreSQL database via Unix domain socket, which requires peer authentication. There’s no discourse_user user on the underlying OS, so peer authentication would fail.

      To force password authentication on the Unix socket, edit /etc/postgresql/10/main/pg_hba.conf file, change

      local   all             all                                     peer

      to

      local   all             all                                     md5

      Save and close the file. Then restart PostgreSQL.

      sudo systemctl restart postgresql
  • Hello, I got a problem at step 3:

    Using bundler 2.1.4
    Using byebug 11.1.1
    Fetching cbor 0.5.9.6
    Installing cbor 0.5.9.6 with native extensions
    Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
    
        current directory: /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/cbor-0.5.9.6/ext/cbor
    /snap/ruby/180/bin/ruby -I /snap/ruby/180/lib/ruby/2.6.0 -r ./siteconf20200629-20160-1fdwkpl.rb extconf.rb
    checking for ruby/st.h... yes
    checking for st.h... yes
    checking for rb_str_replace() in ruby.h... no
    checking for rb_big_new() in ruby.h... no
    checking for rb_intern_str() in ruby.h... no
    checking for rb_sym2str() in ruby.h... no
    checking for rb_str_intern() in ruby.h... no
    checking for rb_integer_unpack() in ruby.h... no
    creating Makefile
    
    current directory: /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/cbor-0.5.9.6/ext/cbor
    make "DESTDIR=" clean
    
    current directory: /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/cbor-0.5.9.6/ext/cbor
    make "DESTDIR="
    compiling buffer.c
    In file included from buffer.h:33,
                     from buffer.c:28:
    sysdep.h:133:2: error: #error this size of bignum digits SIZEOF_BDIGITS not implemented
      133 | #error this size of bignum digits SIZEOF_BDIGITS not implemented
          |  ^~~~~
    cc1: warning: unrecognized command line option ‘-Wno-self-assign’
    cc1: warning: unrecognized command line option ‘-Wno-parentheses-equality’
    cc1: warning: unrecognized command line option ‘-Wno-constant-logical-operand’
    make: *** [Makefile:245: buffer.o] Error 1
    
    make failed, exit code 2
    
    Gem files will remain installed in /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/cbor-0.5.9.6 for inspection.
    Results logged to /var/www/discourse/vendor/bundle/ruby/2.6.0/extensions/x86_64-linux/2.6.0/cbor-0.5.9.6/gem_make.out
    
    An error occurred while installing cbor (0.5.9.6), and Bundler cannot continue.
    Make sure that `gem install cbor -v '0.5.9.6' --source 'https://rubygems.org/'` succeeds before bundling.
    
    In Gemfile:
      cose was resolved to 0.11.0, which depends on
        cbor
    ugda@discource:/var/www/discourse$
    

    I execute a command:

    ugda@discource:/var/www/discourse$ sudo gem install cbor -v '0.5.9.6' --source 'https://rubygems.org/'
    [sudo] password for ugda:
    Building native extensions. This could take a while...
    Successfully installed cbor-0.5.9.6
    Parsing documentation for cbor-0.5.9.6
    Done installing documentation for cbor after 0 seconds
    1 gem installed
    

    Then again:

     RAILS_ENV=production /snap/bin/bundle install 

    And the error repeats itself again.

    Where am I wrong? Thank you for answering.

    • Ubuntu 20.04 is currently not supported.

    • 香菇肥牛
      3 months ago

      I got the same problem when I tried to install it on Ubuntu 20.04. Manually compile-install Ruby instead of using the Snapd version solved it. No idea why though.

      wget https://cache.ruby-lang.org/pub/ruby/2.6/ruby-2.6.6.tar.gz
      tar zxvf ruby-2.6.6.tar.gz
      cd ruby-2.6.6
      ./configure
      make
      make install

      Then

      apt-get install bundler
  • Thank you for your help!

  • Hello. I’m stuck on step 7.
    1. Didn’t use the domain name. Used the IP address of the server.(Is the domain name critical for the local network?)
    2. Before creating the administrator account, the start page was opened (as in step 6).
    3. After creating an administrator account, an empty page opens.

    Where am I wrong? Thank you for answering.

  • Hi! Faced with a problem – a test message to the e-mail comes, but the letter with an invitation to register the form – no. You do not know what the problem may be?

  • Jay Pfaffman
    3 months ago

    This is a clever hack, but if you follow these instructions, this will be your sole place for getting support. If you want to use Discourse, follow the official install guide: https://github.com/discourse/discourse/blob/master/docs/INSTALL-cloud.md

    Here’s a comment from one of the developers: https://meta.discourse.org/t/install-going-well-but-now-blank-white-page/157833/2?u=pfaffman

  • Hi there, thank you very much for the tutorial.
    As with a couple of people above, I have a blank white page.
    I used Ruby via snap.

    Here is a repeating error from the log file

    2020/07/15 17:49:42 [error] 11288#11288: *583 connect() to unix:/var/www/discourse/tmp/sockets/puma.sock failed (111: Connection refused) while connecting to upstream, client: 45.152.183.53, server: subdir.mydomain.com, $$.net, request: “GET / HTTP/1.1”, upstream: “http://unix:/var/www/discourse/tmp/sockets/puma.sock:/”, host: “www.mydomain.com”

    Any advise please?
    Thanks.

    • Hello Kai,

      I just updated this article to make it less error-prone. Instead of installing ruby from Snap store, we install it from a PPA.

  • IMRON HS
    3 months ago

    WORK! Everything is good. I will make donation for you on Jun 2020. Thank you Guoan! Sorry for my my comment before

  • IMRON HS
    3 months ago

    I try to restore my server, but got this error Xiao. What’s wrong?

    username@xen:~$ cd /var/www/discourse/
    username@xen:/var/www/discourse$ /snap/bin/gem install thor
    Traceback (most recent call last):
            5: from :2:in `'
            4: from :2:in `require'
            3: from /snap/ruby/180/lib/ruby/2.6.0/rubygems.rb:9:in `'
            2: from /snap/ruby/180/lib/ruby/2.6.0/rubygems.rb:9:in `require'
            1: from /snap/ruby/180/lib/ruby/2.6.0/x86_64-linux/rbconfig.rb:11:in `'
    /snap/ruby/180/lib/ruby/2.6.0/x86_64-linux/rbconfig.rb:13:in `': ruby lib version (2.6.6) doesn't match executable version (2.5.1) (RuntimeError)
    username@xen:/var/www/discourse$
    
    • Remove ruby2.5-dev.

      sudo apt remove ruby2.5-dev

      Install ruby2.6-dev from a PPA.

      sudo apt install software-properties-common
      
      sudo apt-add-repository ppa:brightbox/ruby-ng
      
      sudo apt install ruby2.6-dev
      
      • IMRON HS
        3 months ago

        I try to install my Discourse with your new update, now everything work fine. I can restore my backup! Thank you so much Xiao!

      • IMRON HS
        2 months ago

        What happen with my discourse Xiao? When I enter this command:

        vanhussen@xen:/var/www/discourse$ RAILS_ENV=production bundle exec puma -C /var/www/discourse/config/puma.rb
        

        I got the error:

        [6387] Puma starting in cluster mode...
        [6387] * Version 4.3.5 (ruby 2.6.6-p146), codename: Mysterious Traveller
        [6387] * Min threads: 8, max threads: 32
        [6387] * Environment: development
        [6387] * Process workers: 4
        [6387] * Preloading application
        Failed to report error: Error connecting to Redis on localhost:6379 (Errno::ECONNREFUSED) 2 Error connecting to Redis on localhost:6379 (Errno::ECONNREFUSED) subscribe failed, reconnecting in 1 second. Call stack ["/var/www/discourse/vendor/bundle/ruby/2.6.0/gems/redis-4.2.1/lib/redis/client.rb:362
        

        I hope you can answer my question please, Thank you..

    • Check if your redis-server is running.

      systemctl status redis-server

      Check if Redis is listening on 127.0.0.1:6379.

      sudo ss -lnpt | grep redis
    • Your Redis server can’t start. Check the log (/var/log/redis/redis-server.log) to see what’s wrong.

      • IMRON HS
        2 months ago
        username@xen:/var/www/discourse$ sudo tail -f /var/log/redis/redis-server.log
        [sudo] password for username: 
        78806:C 18 Aug 09:09:59.037 # Configuration loaded
        78821:M 18 Aug 09:09:59.042 # Creating Server TCP listening socket ::1:6379: bind: Cannot assign requested address
        79848:C 18 Aug 09:11:29.610 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
        79848:C 18 Aug 09:11:29.618 # Redis version=4.0.9, bits=64, commit=00000000, modified=0, pid=79848, just started
        79848:C 18 Aug 09:11:29.618 # Configuration loaded
        79865:M 18 Aug 09:11:29.622 # Creating Server TCP listening socket ::1:6379: bind: Cannot assign requested address
        1031:C 18 Aug 14:19:28.188 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
        1031:C 18 Aug 14:19:28.496 # Redis version=4.0.9, bits=64, commit=00000000, modified=0, pid=1031, just started
        1031:C 18 Aug 14:19:28.496 # Configuration loaded
        1192:M 18 Aug 14:19:28.503 # Creating Server TCP listening socket ::1:6379: bind: Cannot assign requested address
        
        
        2304:C 18 Aug 14:20:55.731 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
        2304:C 18 Aug 14:20:55.738 # Redis version=4.0.9, bits=64, commit=00000000, modified=0, pid=2304, just started
        2304:C 18 Aug 14:20:55.738 # Configuration loaded
        2320:M 18 Aug 14:20:55.746 # Creating Server TCP listening socket ::1:6379: bind: Cannot assign requested address
        

        This my log Xiao. Any Ideas?

      • IMRON HS
        2 months ago

        Sorry Xiao Guoan, now everything work fine. I thing becouse I try to disable IP v6 before. So I try to enable again IP v6. Now I can run my discourse again. Thank you

  • Thanks a lot for this very helpful manual. The installation worked perfectly! However, even if sending test emails from discourse settings works well, sending invitation emails doesn’t and they get stuck in sidekiq with the following error message: Jobs::HandledExceptionWrapper: Wrapped Net::SMTPAuthenticationError: 535 5.7.8 Authentication failed: wrong user/password

    Any idea what went wrong?

    Many thanks in advance!

    • I think the error message is self-explanatory. Either the username or password is wrong, or there’s a special character in the password that is integrated as a meta-character.

  • How would I enter the rails console from this installation?
    Talking about (./launcher enter app then rails c)

  • Gianvito
    3 weeks ago

    Thanks for the guide!! I got a problem at step 5, when I “Start Discourse.” whit the command : RAILS_ENV=production bundle exec puma -C /var/www/discourse/config/puma.rb:
    Appeare:

    @server:/var/www/discourse$ RAILS_ENV=production bundle exec puma -C /var/www/discourse/config/puma.rb
    
    [1681] Puma starting in cluster mode...
    [1681] * Version 4.3.5 (ruby 2.6.6-p146), codename: Mysterious Traveller
    [1681] * Min threads: 8, max threads: 32
    [1681] * Environment: development
    [1681] * Process workers: 4
    [1681] * Preloading application
    [1681] ! Unable to load application: ActiveRecord::StatementInvalid: PG::UndefinedTable: ERROR:  relation "theme_fields" does not exist
    LINE 8:  WHERE a.attrelid = '"theme_fields"'::regclass
                                ^
    Traceback (most recent call last):
    	85: from /var/www/discourse/vendor/bundle/ruby/2.6.0/bin/puma:23:in `'
    	84: from /var/www/discourse/vendor/bundle/ruby/2.6.0/bin/puma:23:in `load'
    	83: from /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/puma-4.3.5/bin/puma:10:in `'
    	82: from /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/puma-4.3.5/lib/puma/cli.rb:80:in `run'
    	81: from /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/puma-4.3.5/lib/puma/launcher.rb:172:in `run'
    	80: from /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/puma-4.3.5/lib/puma/cluster.rb:413:in `run'
    	79: from /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/puma-4.3.5/lib/puma/runner.rb:155:in `load_and_bind'
    	78: from /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/puma-4.3.5/lib/puma/configuration.rb:246:in `app'
    	77: from /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/puma-4.3.5/lib/puma/configuration.rb:321:in `load_rackup'
    	76: from /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/rack-2.2.2/lib/rack/builder.rb:66:in `parse_file'
    	75: from /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/rack-2.2.2/lib/rack/builder.rb:105:in `load_file'
    	74: from /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/rack-2.2.2/lib/rack/builder.rb:116:in `new_from_string'
    	73: from /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/rack-2.2.2/lib/rack/builder.rb:116:in `eval'
    	72: from config.ru:6:in `block in '
    	71: from config.ru:6:in `require'
    	70: from /var/www/discourse/config/environment.rb:7:in `'
    	69: from /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/railties-6.0.3.1/lib/rails/railtie.rb:190:in `method_missing'
    	68: from /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/railties-6.0.3.1/lib/rails/railtie.rb:190:in `public_send'
    	67: from /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/railties-6.0.3.1/lib/rails/application.rb:363:in `initialize!'
    	66: from /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/railties-6.0.3.1/lib/rails/initializable.rb:60:in `run_initializers'
    	65: from /usr/lib/ruby/2.6.0/tsort.rb:205:in `tsort_each'
    	64: from /usr/lib/ruby/2.6.0/tsort.rb:226:in `tsort_each'
    	63: from /usr/lib/ruby/2.6.0/tsort.rb:347:in `each_strongly_connected_component'
    	62: from /usr/lib/ruby/2.6.0/tsort.rb:347:in `call'
    	61: from /usr/lib/ruby/2.6.0/tsort.rb:347:in `each'
    	60: from /usr/lib/ruby/2.6.0/tsort.rb:349:in `block in each_strongly_connected_component'
    	59: from /usr/lib/ruby/2.6.0/tsort.rb:431:in `each_strongly_connected_component_from'
    	58: from /usr/lib/ruby/2.6.0/tsort.rb:350:in `block (2 levels) in each_strongly_connected_component'
    	57: from /usr/lib/ruby/2.6.0/tsort.rb:228:in `block in tsort_each'
    	56: from /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/railties-6.0.3.1/lib/rails/initializable.rb:61:in `block in run_initializers'
    	55: from /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/railties-6.0.3.1/lib/rails/initializable.rb:32:in `run'
    	54: from /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/railties-6.0.3.1/lib/rails/initializable.rb:32:in `instance_exec'
    	53: from /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/railties-6.0.3.1/lib/rails/application/finisher.rb:122:in `block in '
    	52: from /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/zeitwerk-2.3.0/lib/zeitwerk/loader.rb:483:in `eager_load_all'
    	51: from /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/zeitwerk-2.3.0/lib/zeitwerk/loader.rb:483:in `each'
    	50: from /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/zeitwerk-2.3.0/lib/zeitwerk/loader.rb:368:in `eager_load'
    	49: from /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/zeitwerk-2.3.0/lib/zeitwerk/loader.rb:368:in `synchronize'
    	48: from /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/zeitwerk-2.3.0/lib/zeitwerk/loader.rb:376:in `block in eager_load'
    	47: from /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/zeitwerk-2.3.0/lib/zeitwerk/loader.rb:720:in `ls'
    	46: from /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/zeitwerk-2.3.0/lib/zeitwerk/loader.rb:720:in `foreach'
    	45: from /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/zeitwerk-2.3.0/lib/zeitwerk/loader.rb:723:in `block in ls'
    	44: from /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/zeitwerk-2.3.0/lib/zeitwerk/loader.rb:381:in `block (2 levels) in eager_load'
    	43: from /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/zeitwerk-2.3.0/lib/zeitwerk/loader.rb:381:in `const_get'
    	42: from /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/zeitwerk-2.3.0/lib/zeitwerk/kernel.rb:16:in `require'
    	41: from /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:31:in `require'
    	40: from /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require_with_bootsnap_lfi'
    	39: from /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
    	38: from /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `block in require_with_bootsnap_lfi'
    	37: from /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `require'
    	36: from /var/www/discourse/app/models/theme_field.rb:3:in `'
    	35: from /var/www/discourse/app/models/theme_field.rb:8:in `'
    	34: from /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/activerecord-6.0.3.1/lib/active_record/scoping/named.rb:187:in `scope'
    	33: from /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/activerecord-6.0.3.1/lib/active_record/scoping/named.rb:209:in `valid_scope_name?'
    	32: from /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/activerecord-6.0.3.1/lib/active_record/scoping/named.rb:209:in `respond_to?'
    	31: from /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/activerecord-6.0.3.1/lib/active_record/dynamic_matchers.rb:11:in `respond_to_missing?'
    	30: from /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/activerecord-6.0.3.1/lib/active_record/dynamic_matchers.rb:60:in `valid?'
    	29: from /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/activerecord-6.0.3.1/lib/active_record/dynamic_matchers.rb:60:in `all?'
    	28: from /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/activerecord-6.0.3.1/lib/active_record/dynamic_matchers.rb:60:in `block in valid?'
    	27: from /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/activerecord-6.0.3.1/lib/active_record/model_schema.rb:352:in `columns_hash'
    	26: from /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/activerecord-6.0.3.1/lib/active_record/model_schema.rb:475:in `load_schema'
    	25: from /usr/lib/ruby/2.6.0/monitor.rb:235:in `mon_synchronize'
    	24: from /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/activerecord-6.0.3.1/lib/active_record/model_schema.rb:478:in `block in load_schema'
    	23: from /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/activerecord-6.0.3.1/lib/active_record/attribute_decorators.rb:50:in `load_schema!'
    	22: from /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/activerecord-6.0.3.1/lib/active_record/attributes.rb:247:in `load_schema!'
    	21: from /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/activerecord-6.0.3.1/lib/active_record/model_schema.rb:488:in `load_schema!'
    	20: from /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/activerecord-6.0.3.1/lib/active_record/connection_adapters/schema_cache.rb:82:in `columns_hash'
    	19: from /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/activerecord-6.0.3.1/lib/active_record/connection_adapters/schema_cache.rb:76:in `columns'
    	18: from /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/activerecord-6.0.3.1/lib/active_record/connection_adapters/abstract/schema_statements.rb:114:in `columns'
    	17: from /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/activerecord-6.0.3.1/lib/active_record/connection_adapters/postgresql_adapter.rb:820:in `column_definitions'
    	16: from /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/activerecord-6.0.3.1/lib/active_record/connection_adapters/postgresql/database_statements.rb:63:in `query'
    	15: from /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/activerecord-6.0.3.1/lib/active_record/connection_adapters/abstract_adapter.rb:712:in `log'
    	14: from /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.1/lib/active_support/notifications/instrumenter.rb:24:in `instrument'
    	13: from /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/activerecord-6.0.3.1/lib/active_record/connection_adapters/abstract_adapter.rb:721:in `block in log'
    	12: from /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.1/lib/active_support/concurrency/load_interlock_aware_monitor.rb:21:in `synchronize'
    	11: from /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.1/lib/active_support/concurrency/load_interlock_aware_monitor.rb:21:in `handle_interrupt'
    	10: from /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.1/lib/active_support/concurrency/load_interlock_aware_monitor.rb:25:in `block in synchronize'
    	 9: from /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.1/lib/active_support/concurrency/load_interlock_aware_monitor.rb:25:in `handle_interrupt'
    	 8: from /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.1/lib/active_support/concurrency/load_interlock_aware_monitor.rb:26:in `block (2 levels) in synchronize'
    	 7: from /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/activerecord-6.0.3.1/lib/active_record/connection_adapters/abstract_adapter.rb:722:in `block (2 levels) in log'
    	 6: from /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/activerecord-6.0.3.1/lib/active_record/connection_adapters/postgresql/database_statements.rb:64:in `block in query'
    	 5: from /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.1/lib/active_support/dependencies/interlock.rb:47:in `permit_concurrent_loads'
    	 4: from /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.1/lib/active_support/concurrency/share_lock.rb:187:in `yield_shares'
    	 3: from /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.1/lib/active_support/dependencies/interlock.rb:48:in `block in permit_concurrent_loads'
    	 2: from /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/activerecord-6.0.3.1/lib/active_record/connection_adapters/postgresql/database_statements.rb:65:in `block (2 levels) in query'
    	 1: from /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/rack-mini-profiler-2.0.2/lib/patches/db/pg.rb:110:in `async_exec'
    /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/rack-mini-profiler-2.0.2/lib/patches/db/pg.rb:110:in `exec': ERROR:  relation "theme_fields" does not exist (PG::UndefinedTable)
    LINE 8:  WHERE a.attrelid = '"theme_fields"'::regclass
                                ^
    	85: from /var/www/discourse/vendor/bundle/ruby/2.6.0/bin/puma:23:in `'
    	84: from /var/www/discourse/vendor/bundle/ruby/2.6.0/bin/puma:23:in `load'
    	83: from /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/puma-4.3.5/bin/puma:10:in `'
    	82: from /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/puma-4.3.5/lib/puma/cli.rb:80:in `run'
    	81: from /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/puma-4.3.5/lib/puma/launcher.rb:172:in `run'
    	80: from /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/puma-4.3.5/lib/puma/cluster.rb:413:in `run'
    	79: from /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/puma-4.3.5/lib/puma/runner.rb:155:in `load_and_bind'
    	78: from /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/puma-4.3.5/lib/puma/configuration.rb:246:in `app'
    	77: from /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/puma-4.3.5/lib/puma/configuration.rb:321:in `load_rackup'
    	76: from /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/rack-2.2.2/lib/rack/builder.rb:66:in `parse_file'
    	75: from /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/rack-2.2.2/lib/rack/builder.rb:105:in `load_file'
    	74: from /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/rack-2.2.2/lib/rack/builder.rb:116:in `new_from_string'
    	73: from /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/rack-2.2.2/lib/rack/builder.rb:116:in `eval'
    	72: from config.ru:6:in `block in '
    	71: from config.ru:6:in `require'
    	70: from /var/www/discourse/config/environment.rb:7:in `'
    	69: from /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/railties-6.0.3.1/lib/rails/railtie.rb:190:in `method_missing'
    	68: from /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/railties-6.0.3.1/lib/rails/railtie.rb:190:in `public_send'
    	67: from /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/railties-6.0.3.1/lib/rails/application.rb:363:in `initialize!'
    	66: from /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/railties-6.0.3.1/lib/rails/initializable.rb:60:in `run_initializers'
    	65: from /usr/lib/ruby/2.6.0/tsort.rb:205:in `tsort_each'
    	64: from /usr/lib/ruby/2.6.0/tsort.rb:226:in `tsort_each'
    	63: from /usr/lib/ruby/2.6.0/tsort.rb:347:in `each_strongly_connected_component'
    	62: from /usr/lib/ruby/2.6.0/tsort.rb:347:in `call'
    	61: from /usr/lib/ruby/2.6.0/tsort.rb:347:in `each'
    	60: from /usr/lib/ruby/2.6.0/tsort.rb:349:in `block in each_strongly_connected_component'
    	59: from /usr/lib/ruby/2.6.0/tsort.rb:431:in `each_strongly_connected_component_from'
    	58: from /usr/lib/ruby/2.6.0/tsort.rb:350:in `block (2 levels) in each_strongly_connected_component'
    	57: from /usr/lib/ruby/2.6.0/tsort.rb:228:in `block in tsort_each'
    	56: from /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/railties-6.0.3.1/lib/rails/initializable.rb:61:in `block in run_initializers'
    	55: from /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/railties-6.0.3.1/lib/rails/initializable.rb:32:in `run'
    	54: from /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/railties-6.0.3.1/lib/rails/initializable.rb:32:in `instance_exec'
    	53: from /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/railties-6.0.3.1/lib/rails/application/finisher.rb:122:in `block in '
    	52: from /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/zeitwerk-2.3.0/lib/zeitwerk/loader.rb:483:in `eager_load_all'
    	51: from /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/zeitwerk-2.3.0/lib/zeitwerk/loader.rb:483:in `each'
    	50: from /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/zeitwerk-2.3.0/lib/zeitwerk/loader.rb:368:in `eager_load'
    	49: from /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/zeitwerk-2.3.0/lib/zeitwerk/loader.rb:368:in `synchronize'
    	48: from /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/zeitwerk-2.3.0/lib/zeitwerk/loader.rb:376:in `block in eager_load'
    	47: from /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/zeitwerk-2.3.0/lib/zeitwerk/loader.rb:720:in `ls'
    	46: from /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/zeitwerk-2.3.0/lib/zeitwerk/loader.rb:720:in `foreach'
    	45: from /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/zeitwerk-2.3.0/lib/zeitwerk/loader.rb:723:in `block in ls'
    	44: from /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/zeitwerk-2.3.0/lib/zeitwerk/loader.rb:381:in `block (2 levels) in eager_load'
    	43: from /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/zeitwerk-2.3.0/lib/zeitwerk/loader.rb:381:in `const_get'
    	42: from /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/zeitwerk-2.3.0/lib/zeitwerk/kernel.rb:16:in `require'
    	41: from /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:31:in `require'
    	40: from /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require_with_bootsnap_lfi'
    	39: from /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
    	38: from /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `block in require_with_bootsnap_lfi'
    	37: from /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `require'
    	36: from /var/www/discourse/app/models/theme_field.rb:3:in `'
    	35: from /var/www/discourse/app/models/theme_field.rb:8:in `'
    	34: from /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/activerecord-6.0.3.1/lib/active_record/scoping/named.rb:187:in `scope'
    	33: from /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/activerecord-6.0.3.1/lib/active_record/scoping/named.rb:209:in `valid_scope_name?'
    	32: from /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/activerecord-6.0.3.1/lib/active_record/scoping/named.rb:209:in `respond_to?'
    	31: from /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/activerecord-6.0.3.1/lib/active_record/dynamic_matchers.rb:11:in `respond_to_missing?'
    	30: from /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/activerecord-6.0.3.1/lib/active_record/dynamic_matchers.rb:60:in `valid?'
    	29: from /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/activerecord-6.0.3.1/lib/active_record/dynamic_matchers.rb:60:in `all?'
    	28: from /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/activerecord-6.0.3.1/lib/active_record/dynamic_matchers.rb:60:in `block in valid?'
    	27: from /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/activerecord-6.0.3.1/lib/active_record/model_schema.rb:352:in `columns_hash'
    	26: from /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/activerecord-6.0.3.1/lib/active_record/model_schema.rb:475:in `load_schema'
    	25: from /usr/lib/ruby/2.6.0/monitor.rb:235:in `mon_synchronize'
    	24: from /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/activerecord-6.0.3.1/lib/active_record/model_schema.rb:478:in `block in load_schema'
    	23: from /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/activerecord-6.0.3.1/lib/active_record/attribute_decorators.rb:50:in `load_schema!'
    	22: from /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/activerecord-6.0.3.1/lib/active_record/attributes.rb:247:in `load_schema!'
    	21: from /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/activerecord-6.0.3.1/lib/active_record/model_schema.rb:488:in `load_schema!'
    	20: from /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/activerecord-6.0.3.1/lib/active_record/connection_adapters/schema_cache.rb:82:in `columns_hash'
    	19: from /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/activerecord-6.0.3.1/lib/active_record/connection_adapters/schema_cache.rb:76:in `columns'
    	18: from /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/activerecord-6.0.3.1/lib/active_record/connection_adapters/abstract/schema_statements.rb:114:in `columns'
    	17: from /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/activerecord-6.0.3.1/lib/active_record/connection_adapters/postgresql_adapter.rb:820:in `column_definitions'
    	16: from /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/activerecord-6.0.3.1/lib/active_record/connection_adapters/postgresql/database_statements.rb:63:in `query'
    	15: from /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/activerecord-6.0.3.1/lib/active_record/connection_adapters/abstract_adapter.rb:712:in `log'
    	14: from /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.1/lib/active_support/notifications/instrumenter.rb:24:in `instrument'
    	13: from /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/activerecord-6.0.3.1/lib/active_record/connection_adapters/abstract_adapter.rb:721:in `block in log'
    	12: from /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.1/lib/active_support/concurrency/load_interlock_aware_monitor.rb:21:in `synchronize'
    	11: from /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.1/lib/active_support/concurrency/load_interlock_aware_monitor.rb:21:in `handle_interrupt'
    	10: from /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.1/lib/active_support/concurrency/load_interlock_aware_monitor.rb:25:in `block in synchronize'
    	 9: from /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.1/lib/active_support/concurrency/load_interlock_aware_monitor.rb:25:in `handle_interrupt'
    	 8: from /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.1/lib/active_support/concurrency/load_interlock_aware_monitor.rb:26:in `block (2 levels) in synchronize'
    	 7: from /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/activerecord-6.0.3.1/lib/active_record/connection_adapters/abstract_adapter.rb:722:in `block (2 levels) in log'
    	 6: from /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/activerecord-6.0.3.1/lib/active_record/connection_adapters/postgresql/database_statements.rb:64:in `block in query'
    	 5: from /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.1/lib/active_support/dependencies/interlock.rb:47:in `permit_concurrent_loads'
    	 4: from /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.1/lib/active_support/concurrency/share_lock.rb:187:in `yield_shares'
    	 3: from /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.1/lib/active_support/dependencies/interlock.rb:48:in `block in permit_concurrent_loads'
    	 2: from /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/activerecord-6.0.3.1/lib/active_record/connection_adapters/postgresql/database_statements.rb:65:in `block (2 levels) in query'
    	 1: from /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/rack-mini-profiler-2.0.2/lib/patches/db/pg.rb:110:in `async_exec'
    /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/rack-mini-profiler-2.0.2/lib/patches/db/pg.rb:110:in `exec': PG::UndefinedTable: ERROR:  relation "theme_fields" does not exist (ActiveRecord::StatementInvalid)
    LINE 8:  WHERE a.attrelid = '"theme_fields"'::regclass 
    

    Where am I wrong? Thank you for answering.

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.
  • I don't have time to answer every question. Making a donation would incentivize me to spend more time answering questions.


The maximum upload file size: 2 MB.
You can upload: image.