azurediscourse

Modify to development mode

NOTE: We are in the process of modifying the file structure and configuration for many Bitnami stacks. On account of these changes, the file paths stated in this guide may change depending on whether your Bitnami stack uses native Linux system packages (Approach A), or if it is a self-contained installation (Approach B). To identify your Bitnami installation type and what approach to follow, run the command below:

 $ test ! -f "/opt/bitnami/common/bin/openssl" && echo "Approach A: Using system packages." || echo "Approach B: Self-contained installation."

The output of the command indicates which approach (A or B) is used by the installation, and will allow you to identify the paths, configuration and commands to use in this guide. Refer to the FAQ for more information on these changes.

Follow these steps:

  • Copy the production database settings to the development section of the config/database.yml file. If you prefer, you can also populate a new database.

  • Stop the Apache server:

      $ sudo /opt/bitnami/ctlscript.sh stop apache
    
  • Navigate to the Discourse installation directory. Depending on your installation type, run the commands below:

    • Approach A (Bitnami installations using system packages):

        $ cd /opt/bitnami/discourse
      
    • Approach B (Self-contained Bitnami installations):

        $ cd /opt/bitnami/apps/discourse/htdocs/
      
  • Checkout the latest Gemfile and Gemfile.lock files and install the required gems:

      $ cd /opt/bitnami/apps/discourse/htdocs/
      $ git checkout Gemfile*
      $ sudo bundle install --without test sqlite
    
  • Clean assets

      $ ruby bin/rake assets:clean
    
  • Start the server in development mode. Instead of Apache with Passenger you can use the Thin server:

      $ sudo rails server -p 80
    

The Sidekiq server runs in production mode by default. To change this mode, follow these steps depending on your installation type:

  • Approach A (Bitnami installations using system packages): Run the command below to set the mode to development.

      $ echo "export DISCOURSE_ENV=development" | sudo tee -a /opt/bitnami/scripts/discourse-env.sh
    
  • Approach B (Self-contained Bitnami installations): Change the mode in the Sidekiq script at /opt/bitnami/apps/discourse/scripts/sidekiq.sh:

      SIDEKIQ_START="/opt/bitnami/ruby/bin/ruby $DISCOURSE_HOME/bin/sidekiq -P $SIDEKIQ_PIDFILE -e production -L
    
Last modification June 2, 2021