One database per project with multiple projects?
Hello, all. I have several projects, and need to have each project use its own database (I'm migrating from a system where project A had an Issue #1 and project B had and Issue #1, and I need to preserve the numbering of these old bugs).
I'm using redmine through Mongrel Clusters, served by Apache. I'm able to create the databases in mysql:
create database projectA character set utf8;
create database projectB character set utf8;
and setup the tables:
sudo rake db:migrate RAILS_ENV="projectA"
sudo rake db:migrate RAILS_ENV="projectB"
sudo rake redmine:load_default_data RAILS_ENV="projectA"
sudo rake redmine:load_default_data RAILS_ENV="projectB"
and setup the database.yml:
But when I try to configure mongrel_rails, I can't figure out how to make it serve the projects with different databases.
If I do:
sudo mongrel_rails cluster::configure -e projectA -p 8000 -N 3 -c /home/redmine --user apache --group apache
then any issues I add to Project B get put in the Project A database.
If I leave out the -e projectName argment, I get this error in my mongrel log:
- Daemonized, any open files are closed. Look at tmp/pids/mongrel.9000.pid and log/mongrel.9000.log for info.
- Starting Mongrel listening at 0.0.0.0:9000
- Initiating groups for "apache":"apache".
- Changing group to "apache".
- Changing user to "apache".
- Starting Rails with development environment...
/home/redmine/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/connection_specification.rb:217:in `establish_connection': development database is not configured (ActiveRecord::AdapterNotSpecified)
from /home/redmine/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/connection_specification.rb:208:in `establish_connection'
from /home/redmine/config/../vendor/rails/railties/lib/initializer.rb:234:in `initialize_database'
from /home/redmine/config/../vendor/rails/railties/lib/initializer.rb:94:in `process'
from /home/redmine/config/../vendor/rails/railties/lib/initializer.rb:49:in `send'
from /home/redmine/config/../vendor/rails/railties/lib/initializer.rb:49:in `run'
from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `gem_original_require'
from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `require'
... 9 levels...
from /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.4/bin/../lib/mongrel/command.rb:212:in `run'
from /usr/bin/mongrel_rails:19:in `load'
Any ideas on how to make this work? I don't HAVE to use Mongrel; it's just that I was able to get a single-database multiple-project setup working with it pretty
easily. If there's a non-mongrel way to run Redmine through apache, I'm game.
Thanks for all your help.