Deploy Discourse without Docker

Some details about my solutions:

  1. Nginx config:
    Behind a reverse proxy (haproxy), you need to copy the /var/discourse/config/nginx-config-sample.conf to /etc/nginx/sites-enabled/discourse.conf or similar target, then replace the listen <yourreverseproxyport> (if needed), and the _ of server_name by your hostname (subdmain.example.com). Nothing else is to be changed.
  2. Pages not displayed (“Oops” message) and email admin registration not working:
    Magick was the cause of not displaying pages after admin registration pages at first boot. I followed the file indicated in the log: /var/www/discourse/lib/letter_avatar.rb:112 at line 112, there were two magick commands that indeed did not responded. convert responded, so i replaced magick at this line with convert. After these corrections, another error was logged. Trying the same procedure with the given command from file, magick command did not work, and convert was failing. NB: magick --version was 7.x and convert --version gave 6.x. The cause was that i installed first imagemagick with apt, then magick 7 from source. There were some conflicts and magick told convert command to be out of date. So I relaunched my script with magick 7 only. This solved immediately the problem and I could see the brand new pages awaited for days, and email worked too! Magick is really magic.
  3. It still remains the problem of mixed content, but the website although works fine.
    NB: in puma.rb, the line bind ENV.fetch("PUMA_BIND", "tcp://#{ENV['PUMA_BIND_ALL'] ? '' : '127.0.0.1:'}3000") must be like this (correction of first post.)
  4. EDIT “3.”, about https force for discourse: I don’t know why exactly, but my browsers don’t show ‘mixed content’ warnings any more (maybe because of the cache update), so it is all good now. I just need to finish my script.
3 Likes

Confirmed working!!!
ImageMagick v7 solves Ooops problem!
As long as I’ve tested, its fully working.
I’ll test the rest of features and report asap.

1 Like

What I did for testing was set the environment variable PUMA_BIND when running puma.

Regarding ImageMagick, for some reason Discourse is failing to execute an image conversion on the webUI, when I upload a big image it kindly refuse to conver it… I’m still debugging the problem.

Any advance in debug? On my side, I am working on magick.
On some around 50ko image, in browser a pop-up displays:
timeout -k 40.0 20 magick gif:/tmp/RackMultipart20250927-23598-xrrp6e.gif -auto-orient -background white -interlace none -flatten -debug all -quality 90 jpg:/tmp/image20250927-23598-9ujq3d.jpg and no image is loaded
If bigger size, no pop-up but loading wheel is turning in loop infinitely with no result. No error is logged in /var/www/discourse/log.

Same problem for me :joy::sob:

The only way i was able to get it running was using imagemagick from brew repo.

BUT it fails when the image was more than 3MB… maybe i setup a very restrictive policy config.

Give it a try!!!

I’m testing the docker install but I think or pretty stupid deploy nginx, unicorn, redis, postgresql and the rest in ONLY one container… it doesn’t make sense at all. And there’s no infrastructure documentation for big deployments… I’ve work on IT for more than 20 years and I only see problem coming in the near future using such infra.

Without talking about “docker The Space Eater” ( like Dormammu) :rofl::rofl:

This issue is gone with the following solution described at the end:

Debug 1: bundle db:create outputs, also in logs at first boot:


unknown OID 21096: failed to recognize type of ‘embeddings’. It will be treated as String.
pngquant worker: pngquant not found; please provide proper binary or disable this worker (–no-pngquant argument or :pngquant => false through options)
oxipng worker: oxipng not found; please provide proper binary or disable this worker (–no-oxipng argument or :oxipng => false through options)
jhead worker: jhead not found, jpegtran not found; please provide proper binary or disable this worker (–no-jhead argument or :jhead => false through options)
jpegoptim worker: jpegoptim not found; please provide proper binary or disable this worker (–no-jpegoptim argument or :jpegoptim => false through options)

Debug 2: Some magick command with files output:

no decode delegate for this image format

This last Issue is mentioned here.

Solution is here (installs magick with formats plugins):

t=$(mktemp) && \
wget 'https://dist.1-2.dev/imei.sh' -qO "$t" && \
bash "$t" && \
rm "$t"

After this, my upload size can be up to 518KB. Above not. This is only for images. All others documents, audio, video uploads work.

Temporary solution for the resting issue:
I’ve looked in the admin settings, discourse.conf, nginx/sites-enables/discourse.conf, in the git folder. Finally in AdminPanel/Parameters/Files I’ve disabled “Composer media optimization image enabled”, then everything is working fine. I can upload any image.

Yup, IMEI is almost the same solution a using brew but I’m sure it won’t take around 2GB of disk :rofl::rofl::sob::sob::sob::face_with_symbols_on_mouth::face_with_symbols_on_mouth::face_with_symbols_on_mouth:

I’ll check your solution for max filesize on uploads.

I’m also struggling with a solution for sending emails “for free” (I’m on an early stage and don’t wanna contract mailtrap/mailgun/etc…)

Why don’t you install a mail server ? I have my own and I scripted the install. Tell me if you are interested. You just need to pay yearly for a domain name.

Sure! DM me with the instructions or git repo !:grinning_face_with_smiling_eyes:

I stop using self hosted mail servers many years ago…

When doing rake assets:precompile, it said No such file or directory - brotli, just install it with a package manager.