Ahh got it, yeah, different OSes and what not. Already have someone asking how I did it - I’ll post here in case.
One needs Ruby 3.2.x (through rbenv
, so you aren’t at mercy of the OS), Node v16.19.x/npm 8.19.x, and PostgreSQL (probably any version above 11).
- I created a
.ruby-version
file, which specified the ruby version which I installed (3.2.2
).
- Did a
bundle
and all gems build just fine.
- Within PostgreSQL itself, had to setup the database:
CREATE DATABASE discourse;
CREATE USER discourse WITH password 'fA....';
GRANT ALL PRIVILEGES ON DATABASE discourse TO discourse;
\c discourse
GRANT ALL ON SCHEMA public TO discourse;
I was surprised the database.yml
does not take production
vars (this seems very anti-Rails convention). All db settings were in config/discourse.conf
, along with the SMTP values. I filled those in.
Then ran the database migrations:
bundle exec rails db:migrate
All worked fine, and migrations were successful.
- In
config/sidekiq.yml
, after the development
section, I added:
production:
:concurrency: 2
:queues:
- [critical, 2]
- [default, 1]
- [low]
- [ultra_low]
- Then edit
lib/tasks/assets.rake
, around line 151, add:
harmony: true,
so it looks like:
uglified, map =
Uglifier.new(
comments: :none,
harmony: true,
source_map: {
filename: File.basename(from),
output_filename: File.basename(to),
},
).comp
And install the following npm packages:
npm install terser
npm install -g uglify-js@"<3"
Then build the assets:
RAILS_ENV=production bundle exec rake assets:precompile
And voila! Now this should work:
bundle exec sidekiq -e production -C config/sidekiq.yml
bundle exec puma --config config/puma.rb -e production
This gets sidekiq
and thepuma
web server going.
(way cheaper, and more control, ie. I have Ruby 3.2.2 going already). Most of the time was working around the quirks (like looking for production
values as they were not where they should be). But other than that, was quite quick!