How to run Discourse in production mode locally?

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!

1 Like

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.

4 Likes

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

Thanks!

2 Likes