Anyone Home? Having installation/setup difficulties

229 views
Skip to first unread message

Tom Bodet

unread,
Jun 21, 2012, 9:21:53 AM6/21/12
to openconfe...@googlegroups.com
Hi all,
 
I was asked to stand up a test server with OCW and after juggling gems all morning I'm at the point of trying to run the setup calls.
 
When I run: bundle exec rake db:create:all
It tells me this is only for a local database.  I am in fact using a mysql database on another server so my question is, do I skip this step?
 
Assuming the above, I then run: bundle exec rake setup
It fails.  Adding trace I learn the following...
** Invoke setup (first_time)
** Invoke setup:default (first_time)
** Invoke tmp:create (first_time)
** Execute tmp:create
** Invoke db:migrate:reset (first_time)
** Invoke db:drop (first_time)
** Invoke db:load_config (first_time)
** Invoke rails_env (first_time)
** Execute rails_env
** Execute db:load_config
** Execute db:drop
rake aborted!
undefined method `[]' for nil:NilClass
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/rails-2.3.14/lib/tasks/databases.rake:410:in `drop_database'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/rails-2.3.14/lib/tasks/databases.rake:97:in `block (2 levels) in <top (required)>'
My understanding of the script syntax is minimal.  It would appear it's complaining about either the use of brackets or the way they are used. 
 
This being a blank database I thought maybe I could get away without the drop section so I removed it so it was just a begin and end block.  That takes me to the create function where it also fails:
** Invoke setup (first_time)
** Invoke setup:default (first_time)
** Invoke tmp:create (first_time)
** Execute tmp:create
** Invoke db:migrate:reset (first_time)
** Invoke db:drop (first_time)
** Invoke db:load_config (first_time)
** Invoke rails_env (first_time)
** Execute rails_env
** Execute db:load_config
** Execute db:drop
** Invoke db:create (first_time)
** Invoke db:load_config
** Execute db:create
rake aborted!
undefined method `[]' for nil:NilClass
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/rails-2.3.14/lib/tasks/databases.rake:55:in `rescue in create_database'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/rails-2.3.14/lib/tasks/databases.rake:35:in `create_database'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/rails-2.3.14/lib/tasks/databases.rake:31:in `block (2 levels) in <top (required)>'
So is the script broken?  I'm also not 100% understanding the database config.  I copied the mysl sample and changed the "default" in the database.yml to point to it.
default = "#{RAILS_ROOT}/config/database~mysql.yml"
 
In there I used a copy of a redmine config that works and substituted values:
common: &common
  adapter: mysql
  encoding: utf8
  socket: <%= `mysql_config --socket`.chomp %>
  username: ocw
  password: *****
  host: 123.456.789.012
  database: ocw
So...typo, I screwed something up, combination of those....I could use a little help.  Thanks.

Igal Koshevoy

unread,
Jun 21, 2012, 1:39:40 PM6/21/12
to openconfe...@googlegroups.com
On Thu, Jun 21, 2012 at 6:21 AM, Tom Bodet <tomb...@gmail.com> wrote:
When I run: bundle exec rake db:create:all
It tells me this is only for a local database.  I am in fact using a mysql database on another server so my question is, do I skip this step?
This command creates databases for the development, test and production environments. If you haven't already created all the databases, you need to run it.
 
Assuming the above, I then run: bundle exec rake setup
It fails.  Adding trace I learn the following...
[...] 
rake aborted!
undefined method `[]' for nil:NilClass
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/rails-2.3.14/lib/tasks/databases.rake:410:in `drop_database'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/rails-2.3.14/lib/tasks/databases.rake:97:in `block (2 levels) in <top (required)>'
My understanding of the script syntax is minimal.  It would appear it's complaining about either the use of brackets or the way they are used. 
There are multiple things wrong here:
1. Ruby 1.9.3 is not compatible with OCW, you should use Ruby 1.8.7 like the instructions suggest.
2. Rails 2.3.14 is not compatible with OCW, you should leave the Gemfile alone unless you actually intend to port OCW to another version of Rails.
3. The error suggests to me that there's something wrong with whatever is being read as your database.yml file, such as the "development" section not being present -- more on this later in the email.
 
We'd like to eventually support Ruby 1.9.3 and Rails 3.x, but the trouble is that many libraries that OCW relies on will never support these newer versions of Ruby or Rails, so upgrading will mean rewriting a lot of complicated code and migrating old logic and data over, which is a lot of work.

So is the script broken?  I'm also not 100% understanding the database config.  I copied the mysl sample and changed the "default" in the database.yml to point to it.
default = "#{RAILS_ROOT}/config/database~mysql.yml"
I strongly recommend first getting OCW running with SQLite, which is the default, because that will let you more quickly determine if OCW is something you really want to get into as someone that's new to Rails.

You do not need to modify database.yml, just create a "config/database~custom.yml" file with your custom settings and it'll get read on startup.

In there I used a copy of a redmine config that works and substituted values:
common: &common
  adapter: mysql
  encoding: utf8
  socket: <%= `mysql_config --socket`.chomp %>
  username: ocw
  password: *****
  host: 123.456.789.012
  database: ocw
That's not a valid configuration, it's missing the "development", "test" and "production" sections and is jamming the database name into the common section where it doesn't belong. You should use the "config/database~mysql.yml" file as a starting point for MySQL, because that will work as-is on a typical development system that has a local database with no password. Since you have a passworded database on a remote host, you'll want to modify your custom version's "common" section to include the username, password and host, and then modify the names of the databases in the other sections if needed, but leave the rest alone.

I don't mean to discourage you, but I strongly recommend that you team up with someone that knows Rails well if you intend to use OCW or you'll be very frustrated because there will be far more complicated things ahead once you get through the issues you've hit. I would love for OCW to be as easy to setup and manage as something like WordPress, but that takes an enormous amount of effort and we're allocating our scant resources towards higher priority tasks like adding and improving functionality.

-igal

Tom Bodet

unread,
Jun 21, 2012, 1:47:09 PM6/21/12
to openconferenceware
Figures that by the time I see this got approved I figured it out.

Was the failure of me having all the different labels in the database
config. I just took the sample and pasted my info into every bucket.

The problem I'm now having is the "attend" link is broken.

Using the sample setup I can login and look around but if I click
attend I get:

Routing Error

No route matches "/attend" with {:method=>:get}
Reply all
Reply to author
Forward
0 new messages