unicorn will likely not work on TruffleRuby because it relies on fork but actually it installs.
Can Discourse run on Puma instead, any configuration needed for that?
there are a few others I left which I am unsure about, what should I do with them? (byebug, ruby-prof, better_errors, rbtrace, gc_tracer, stackprof, memory_profiler)
Yes those all seem very MRI-specific (until they start supporting different backends), so best as platforms: :mri for now. better_errors might work, but binding_of_caller does not support TruffleRuby yet.
These gems also seem mostly debugging/performance tools which don’t seem necessary to get the app running.
Yes, we need to look at mini_racer.
I wonder, for context, why is JS used to render Markdown?
To make sure it’s exactly the same result as when run in the client browser?
wasm would definitely be off the table here, payload would be much bigger, there are tons of security issues around getting it to run right with CSPs (and CORS concerns), the implementation of markdown.it is spectacularly fast and extensible allowing for tons of plugins and a huge existing ecosystem.
Just some more context on mini_racer. From day 0 at Discourse we insisted on a single pipeline to cook markdown, this completely eliminated a very nasty class of bugs I have experienced at Stack Overflow where server and client spoke slightly different dialects. For Discourse this is even more important cause plugins can amend the pipeline. For example:
is implemented in a plugin (parsing of )
We have quite a few “quality of life” features we get by using unicorn and relying on forking, see:
Specifically we monitor and manage a sidekiq child process from the master process.
But… truffle has no GIL, puma is already in the Gemfile once we have mini_racer working, we could collaborate on memory conserving truffle setup that keeps sidekiq and puma in the same process. Or people could just spawn a sidekiq process by hand. Puma can certainly work, we make use of Rack.hijack extensively but that is implemented across Puma/Unicorn/Passenger already.