Install Discourse Forum Software on Ubuntu 20.04/18.04 Without Docker

This tutorial is going to show you how to install Discourse on Ubuntu 20.04/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.

Why Install Discourse on Ubuntu 20.04/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.

Prerequisites

To run Discourse, you need a server with at least 1GB RAM. If you are looking for a virtual private server (VPS), I recommend Kamatera VPS, which features:

  • 30 days free trial.
  • Starts at $4/month (1GB RAM)
  • High-performance KVM-based VPS
  • 9 data centers around the world, including United States, Canada, UK, Germany, The Netherlands, Hong Kong, and Isreal.

Follow the tutorial linked below to create your Linux VPS server at Kamatera.

Once you have a VPS running Ubuntu 20.04/18.04, 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 20.04/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 20.04/18.04

Discourse requires Ruby 2.7 or up. However, Ubuntu 20.04/18.04 repository comes with Ruby 2.5.1. The latest version of Ruby is 3.0.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.7 from a PPA.

sudo apt install software-properties-common

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

sudo apt install ruby2.7

To check your Ruby version number, run

ruby -v

Output:

ruby 2.7.1p83 (2020-03-31 revision a0c7c23c9c) [x86_64-linux-gnu]

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.7-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

If you encounter the “To use ES6 syntax, harmony mode must be enabled” error, then simply run the same command again to continue.

harmony mode must be enabled

Once the JavaScript and CSS files are compiled, you can continue with the next command.

discourse compile JavaScript and CSS files

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.7.1-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 20.04/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 20.04/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 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 /var/www/discourse/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

The Sidekiq dashboard is available at https://community.example.com/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 = [email protected]

For how to set up your own mail server, please check out the following tutorial. Note that I highly recommend running iRedMail mail server on a fresh clean OS. Installing iRedMail on an OS that has other web applications can fail, and likely break existing applications.

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

After saving the SMTP settings, restart Discourse service.

sudo systemctl restart discourse discourse-sidekiq

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

If your Discourse still can’t send emails, check if it can ping the mail server. Also, go to https://community.example.com/sidekiq/retries, it will show you the failed emails and why email-sending failed.

Sometimes, the discourse-sidekiq.service can fail and cause email not sending out, so you might want to check if this service is running

sudo systemctl status 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

If you see the following error message.

Please commit your changes or stash them before you switch branches.
Aborting

Then run the following command

git stash

Then run the git checkout command again.

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
mv ~/discourse.conf /var/www/discourse/config/discourse.conf

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;
}

Restart Discourse service for the changes to take effect.

sudo systemctl restart discourse discourse-sidekiq

Integrate WordPress with Discourse

If you run a WordPress site, you can install the WP Discourse plugin on your WordPress site and integrate it with Discourse. It allows:

  • Publish posts to Discourse
  • Use Discourse for WordPress Comments
  • Log in to Discourse with WordPress (DiscourseConnect)

For instructions on how to integrate the two software, go to the following page.

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

How to Deal with Difficult Users in Discourse

If there’s a particular user on your Discourse forum who is making your life harder, you can lock this user to the 0: new user trust level, then go to Discourse Admin -> Settings -> Posting and require posts/topics created by 0: new user to be approved before they can be published.

discourse posting settings

Conclusion

I hope this article helped you install Discourse forum software on Ubuntu 20.04/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: 13 Average: 5]

63 Responses to “Install Discourse Forum Software on Ubuntu 20.04/18.04 Without Docker

  • Venz.ai
    5 years 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…

    • Xiao Guoan (Admin)
      4 years ago

      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?

    • Xiao Guoan (Admin)
      4 years ago

      I can’t find the logrotate.rb file in my discourse directory.

      • sorry wrong name
        it’s discourse/config/logrotate.conf

    • Xiao Guoan (Admin)
      4 years ago

      You can use the sed command to batch replace the log path.

      sed -i 's/\/home\/discourse/\/var\/www/g' /var/www/discourse/config/logrotate.conf

      So the path will be changed to /var/www/discourse/log/.

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

    • Xiao Guoan (Admin)
      4 years ago

      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!!

    • Xiao Guoan (Admin)
      4 years ago

      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.

    • Xiao Guoan (Admin)
      4 years ago

      Ubuntu 20.04 is currently not supported.

    • 香菇肥牛
      4 years 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.

    • Xiao Guoan (Admin)
      4 years ago

      I would never bother installing a Discourse forum without a domain name.

  • 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
    4 years 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

    • Xiao Guoan (Admin)
      4 years ago

      Yes, this is an unofficial method. If anyone follow this tutorial, please don’t ask support from the Discourse team.

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

    • Xiao Guoan (Admin)
      4 years ago

      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
    4 years 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
    4 years 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$
    
    • Xiao Guoan (Admin)
      4 years ago

      Remove ruby2.5-dev.

      sudo apt remove ruby2.5-dev

      Install ruby2.7-dev from a PPA.

      sudo apt install software-properties-common
      
      sudo apt-add-repository ppa:brightbox/ruby-ng
      
      sudo apt install ruby2.7 ruby2.7-dev
      
      • IMRON HS
        4 years 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
        4 years 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..

    • Xiao Guoan (Admin)
      4 years ago

      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
      • IMRON HS
        4 years ago

        Yes, I do it. But still error. Any Idea?

      • IMRON HS
        4 years ago
        Error connecting to Redis on localhost:6379 (Errno::ECONNREFUSED)
        

    • Xiao Guoan (Admin)
      4 years ago

      Your Redis server can’t start. Check the log (/var/log/redis/redis-server.log) to see what’s wrong.

      • IMRON HS
        4 years 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
        4 years 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!

    • Xiao Guoan (Admin)
      4 years ago

      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)

  • Many thanks for this very helpful manual!
    My installation seems to work well but password reset emails are not send. The admin dashboard shows a huge number of messages in the sidekiq queue. However, according to “systemctl stats discourse-sidekiq” service sidekiq is active and running.
    Any idea what could be the origin of my problems?
    Many thanks in advance!!!

    • I was able to solve my problem. The reason for the unsent emails was that sidekiq did not process all configured queues but (presumeably) only “default”. By modifying /etc/systemd/system/discourse.service and providing the full path to the config file, i.e. using line

      ExecStart=/usr/local/bin/bundle exec sidekiq -C /var/www/discourse/config/sidekiq.yml

      the problem gets resolved.

  • hologrammer
    3 years ago

    Many, Many Thanks for the article. I had just given up on dealing with broken discourse rebuilds and was going to set it up without docker and found your piece here. It saved me loads of time. Much appreciation for your efforts and for sharing it.

    Holo.

  • Curtis S
    3 years ago

    I want to thank you for this guide. I followed it and found it to be completely accurate. Do you have any resources about how to properly install Discourse plugins? I understand how to clone it into the appropriate directory; do you know what rake commands I should run after cloning the plugin?

  • Werner Freiberg
    3 years ago

    Thanks for this great tutorial!

    One question: What is the reason for all the steps belonging to uglifi-js (require ‘uglifier’ and config.assets.js_compressor = Uglifier.new(harmony: true))? I couldn’t find something like this in the official Dockerfile

    • Xiao Guoan (Admin)
      3 years ago

      To use ES6 syntax, harmony mode must be enabled with Uglifier.new(:harmony => true).

  • Grafika
    3 years ago

    Why do you delete the Gemfile.lock during your proposed updates process? I think this ignores all fixed dependencies and installs the newest version of all gems which can leads to build problems.

    • Xiao Guoan (Admin)
      3 years ago

      Build problem often means the Ruby version is not compatible with the latest version of Discourse, which now requires Ruby 2.7.

      Remove ruby2.6.

      sudo apt remove ruby2.6 ruby2.6-dev

      Install ruby2.7-dev from a PPA.

      sudo apt install software-properties-common
      
      sudo apt-add-repository ppa:brightbox/ruby-ng
      
      sudo apt install ruby2.7 ruby2.7-dev
      

      Update bundler.

      sudo /usr/bin/gem install bundler
  • Seems it no longer works (or doesn’t work on 20.04) on the db:migrate step:

    RAILS_ENV=production /usr/local/bin/bundle exec rake db:migrate
    rake aborted!
    NoMethodError: undefined method `keys' for nil:NilClass
    /var/www/discourse/app/models/global_setting.rb:59:in `load_defaults'
    /var/www/discourse/config/application.rb:36:in `'
    /var/www/discourse/Rakefile:7:in `require'
    /var/www/discourse/Rakefile:7:in `'
    /var/www/discourse/vendor/bundle/ruby/2.7.0/gems/rake-13.0.6/exe/rake:27:in `'
    (See full trace by running task with --trace)
    
  • I”m getting the problem where the SMTP test messages work but actual user emails do not work. I’ve found (through use of google) that the method for sending test email and the method for sending actual production email is different Ref : https://meta.discourse.org/t/test-emails-work-fine-but-nothing-else/28214

    my thread on this is https://meta.discourse.org/t/smtp-works-with-test-emails-but-not-with-new-activations/217746/6

    I don’t know enough about how to get more logging out of this system to figure out where the failure is occurring .. the production.log makes it seem like the email is going out, but something isn’t actually doing the work —

    Is there some environment or other way to put this in a verbose mode that shows the calls/tasks being made so I can track down where in the code its getting lost ?

    Thanks

    • At the bottom of this simi-unrelated posting I found the solution

      https://forum.level1techs.com/t/how-to-get-discourse-to-work-with-postfix/160584/38

      The fixes seem to be change development to production in the config/sidekiq.yml file.

  • Can I install NodeJS from nodejs.org instead of installing it from the default Ubuntu repository? Will it be compatible with Discourse?

    • Xiao Guoan (Admin)
      2 years ago

      Yes, you can install the latest version of NodeJS with:

      curl -sL https://deb.nodesource.com/setup_16.x | sudo -E bash -
      
      sudo apt install nodejs
      
  • Lai Chau Koi
    2 years ago

    I want to thank you for this guide. Plz help me to solve one problem. I followed this guide until step 10. However, I have this error now. I hope you to help well. Best Regards.
    (Oops

    The software powering this discussion forum encountered an unexpected problem. We apologize for the inconvenience.

    Detailed information about the error was logged, and an automatic notification generated. We’ll take a look at it.

    No further action is necessary. However, if the error condition persists, you can provide additional detail, including steps to reproduce the error, by posting a discussion topic in the site’s feedback category.)

  • Hi,

    I cannot open the website after step 6. The error message of Nginx is

    [error] 279552#279552: *403 connect() to unix:/var/www/discourse/tmp/sockets/puma.sock failed (111: Connection refused) while connecting to upstream, client: 202.4.28.3, server: **my-domain**, request: "GET / HTTP/1.1", upstream: "http://unix:/var/www/discourse/tmp/sockets/puma.sock:/"
    

    The output of my puma is different from your. Is this successful?

    /var/www/discourse# RAILS_ENV=production bundle exec puma -C /var/www/discourse/config/puma.rb
    [277384] Puma starting in cluster mode...
    [277384] * Puma version: 5.5.2 (ruby 2.7.5-p203) ("Zawgyi")
    [277384] *  Min threads: 8
    [277384] *  Max threads: 32
    [277384] *  Environment: production
    [277384] *   Master PID: 277384
    [277384] *      Workers: 4
    [277384] *     Restarts: (✔) hot (✖) phased
    [277384] * Preloading application
    [277384] * Listening on unix:///var/www/discourse/tmp/sockets/puma.sock
    [277384] ! WARNING: Detected 2 Thread(s) started in app boot:
    [277384] ! # - /var/www/discourse/vendor/bundle/ruby/2.7.0/gems/redis-4.5.1/lib/redis/connection/ruby.rb:56:in `wait_readable'
    [277384] ! # - /var/www/discourse/vendor/bundle/ruby/2.7.0/gems/message_bus-4.0.0/lib/message_bus/timer_thread.rb:130:in `sleep'
    [277384] Use Ctrl-C to stop 
    
  • Dan Ran
    2 years ago

    After step 4 when running

    sudo npm install -g svgo

    I get the following warnings…

    /usr/local/bin/svgo -> /usr/local/lib/node_modules/svgo/bin/svgo
    npm WARN notsup Unsupported engine for [email protected]: wanted: {"node":">=14.0.0"} (current: {"node":"10.19.0","npm":"6.14.4"})
    npm WARN notsup Not compatible with your version of node/npm: [email protected]
    npm WARN notsup Unsupported engine for [email protected]: wanted: {"node":"^10 || ^12.20.0 || ^14.13.0 || >=15.0.0","npm":">=7.0.0"} (current: {"node":"10.19.0","npm":"6.14.4"})
    npm WARN notsup Not compatible with your version of node/npm: [email protected]
    npm WARN notsup Unsupported engine for [email protected]: wanted: {"node":"^10 || ^12.20.0 || ^14.13.0 || >=15.0.0","npm":">=7.0.0"} (current: {"node":"10.19.0","npm":"6.14.4"})
    npm WARN notsup Not compatible with your version of node/npm: [email protected]

    Should I be concerned about this or can I safely ignore this?

    • Xiao Guoan (Admin)
      2 years ago

      WARN means it’s not an error.

      The difference between a warning and an error:
      Warning means the thing works, but not in a perfect state.
      Error means the thing doesn’t work.

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. Links to YouTube, Facebook, Twitter and other services inserted in the comment text will be automatically embedded. Drop file here