Project

General

Profile

Changing default environment with mongrel

Added by David Gillard over 16 years ago

Hi all,

Ruby implementation and version
- Rails 2.1.0
- Centos 5
- Mysql 5.0.45
- Mongrel

I'm currently trying to move from a webrick environment to a mongrel cluster with a view to running Redmine under apache on port 80 as discussed in one of the howto guides for mongrel.
When I initially started the mongrel cluster the site wouldn't work as it was looking for the redmine_development mysql database as defined in the database.yml file up until that point I had been using the production environment with webrick. I have now put a temporary fix in by defining the production database as the development one but would like to know where I should have changed the value

Looking at the log file /log/mongrel.3000.log I can see the following when I start the server

  • Daemonized, any open files are closed. Look at tmp/pids/mongrel.3000.pid an$
  • Starting Mongrel listening at 0.0.0.0:3000
  • Starting Rails with development environment...
    GLoc v1.1 running in development mode. Strings can be modified at runtime.
  • Rails loaded.

So it appears to be loading the development environment, I've search the forum / wiki / issues / config files but can't see a way of defining the default environment to use. I have already uncommented the ENV['RAILS_ENV'] ||= 'production line in the environment.rb file to see if this would make a difference.

How can I change the default environment when using mongrel?

Thanks

Dave

About your application's environment
Ruby version 1.8.5 (i386-linux)
RubyGems version 1.1.1
Rails version 2.1.0
Active Record version 2.1.0
Action Pack version 2.1.0
Active Resource version 2.1.0
Action Mailer version 2.1.0
Active Support version 2.1.0
Application root /home/dgillard/public_html/redmine
Environment development
Database adapter mysql
Database schema version 0


Replies (1)

RE: Changing default environment with mongrel - Added by Thomas Lecavelier over 16 years ago

RTFM of mongrel?

My conf/mongrel_cluster.yml:

---
user: appserv
cwd: /var/apps/production/redmine
log_file: log/mongrel.log
port: "4200" 
environment: production
group: appserv
pid_file: tmp/pids/mongrel.pid
servers: 2

The same in CLI:

% mongrel_rails -e production -d -p 4200 -n 2 --user appserv --group appserv -c /var/apps/production/redmine

    (1-1/1)