How to Start Ruby on Rails in Development Mode with LiteSpeed Web Server
Starting ruby on rails in development mode with Litespeed is easy. You need to make sure that your database.yml is configured to handle development mode as well. Follow the steps below to start Litespeed running Ruby on Rails in development mode.
Please note both cofiguration settings listed in step one which include setting this to be the default for future virtual hosts and configuring current virtual hosts to restart in development mode.
- Modify LiteSpeed Configuration:Login to the LiteSpeed web admin console which is typically located on port 7080. Select Configuration from the top navigation menu and then choose Server from the drop down menu. This will open the Server Configuration tabs and you will need to select the last tab which is “Ruby Rails”. Click the Edit link in the top right of this configuration window and select Development from the “Rails Environment” drop down. After you have changed to Development mode select the Save link located at the top right of this window.
**NOTE**:The above will work for new virtual hosts created after the fact but to modify an already configured LiteSpeed vhost to run in development mode you need to modify the Rails Context settings. To do this click on Configuration in the top navigation and select Virtual Hosts from the drop down. Then click the virtual host you want to start in development mode. Now click the Context tab under vhost settings and then click on Edit under the Action column of the Rails row in the Context List. Now change the Rails Environment drop down from Production to Development as shown in the below image and then click the Save link at the top right corner of the Rails Context Definition.
- Verify Database Configurations:Now make sure that all of your Ruby on Rails virtual hosts have the proper configuration in their database.yml files. If you were running in production mode then verify there is a development mode entry as shown below in the example.
development: adapter: postgresql database: db_name username: db_user password: password host: localhostproduction: adapter: postgresql database: db_name username: db_user password: password host: localhost
- Restart LiteSpeed:Now restart Litespeed. Make sure to do a full restart from the CLI and not a graceful restart.
- Verify Development Mode: Now tail the development.log file located in root/log/. You might see the development logs being logged to production.log if you have a configuration errors.