A friend of mine was over tonight and we were troubleshooting a issue with SVN authentication via the Redmine project management software. Redmine is built with Ruby and on this server is running via Apache and Mongrel. I needed to set the project to run in development mode but wasn’t very familiar with the Mongrel setup. After some research I found it was easy to change the environment from production to development using the Mongrel Cluster .yml file for that project. When using Mongrel each site appears to get its own .yml file so you can modify whatever settings you want to on a per site basis. Below I describe what needs to be changed, default locations, and any other actions that need to be taken to restart the Ruby on Rails project in development mode.
Start a Ruby On Rails Project In Development Mode When Running From Apache And Mongrel:
- Modify Project YML File: First locate the .yml file for the project you want to run in development mode. Most servers store these files in the /etc/mongrel_cluster/ directory and they are named something related to the project such as redmine.yml. Below is an example .yml file set to run in production mode followed by an updated .yml file set to run in development mode.
Mongrel Configuration File Set To Run Ruby In Production Mode:
- user: mongrel
- cwd: /home/web/redmine
- log_file: /var/log/mongrel/redmine-mongrel.log
- port: "8000"
- environment: production
- group: mongrel
- address: 127.0.0.1
- pid_file: /var/www/pids/mongrel.pid
- servers: 3
Mongrel Configuration File Set To Run Ruby In Development Mode:
- user: mongrel
- cwd: /home/web/redmine
- log_file: /var/log/mongrel/redmine-mongrel.log
- port: "8000"
- environment: development
- group: mongrel
- address: 127.0.0.1
- pid_file: /var/www/pids/mongrel.pid
- servers: 3
Notice the only difference is the environment setting being changed from production to development.
- Restart Mongrel: To make the change active simply restart the mongrel cluster which in a typical installation can be completed by issuing the below command.
Restart Mongrel Cluster To Start Development Mode:
- /etc/init.d/mongrel_cluster restart
You can verify the project is running in development mode by seeing if a development.log file has been created in the project-root/log directory. The development mode environment should only be used for test or development environments. Keep production mode for sites facing customers.