How to run Discourse in production mode locally?

AI-generated summary

The discussion revolves around running Discourse in production mode locally. eatcodetravel shares their current steps to achieve this, which include modifying database configuration, removing certain checks, and compiling assets. However, sam suggests that running a Docker image locally is a simpler approach, which eatcodetravel acknowledges and plans to use in the future.

I’m trying to debug a plugin that works locally but doesn’t in production. I want to run Discourse locally in production but I’m having some issues and I don’t want to keep digging if this is not the right way.

What I’m doing right now that works is

  1. Copy database configuration for development to production in the config/database.yml file
  2. Remove the database_configuration method override in application.rb
  3. Remove the check for puma configuration to be used in production in config/puma.rb
  4. Set config.public_file_server.enabled = true in config/environments/production.rb
  5. Compile assets with env RAILS_ENV=production bundle exec rake assets:precompile
  6. Run the server with env RAILS_ENV=production bundle exec rails s

Is there an easier way to do this?

Thanks!

Simplest way is actually to run a docker image locally, it saves a bunch of questions.

Your steps will more-or-less work though but I would spin up unicorn not puma.

Wow, I don’t know why I forgot about that, next time I’ll do it that way.

Thanks!