Attempt #1

  • Command run:
    • export RAILS_ENV='production'
    • cd ~/f10-dev/markus-0.9.0
    • rake db:create

(in /u7/markus/f10-dev/markus-0.9.0)
FATAL:  Ident authentication failed for user "markus"
/var/lib/gems/1.8/gems/activerecord-2.3.8/lib/active_record/connection_adapters/postgresql_adapter.rb:941:in `initialize'
/var/lib/gems/1.8/gems/activerecord-2.3.8/lib/active_record/connection_adapters/postgresql_adapter.rb:941:in `connect'
[...]
/usr/lib/ruby/1.8/rake.rb:2044:in `standard_exception_handling'
/usr/lib/ruby/1.8/rake.rb:1974:in `run'
/usr/bin/rake:28
Couldn't create database for {"encoding"=>"unicode", "username"=>"markus", "adapter"=>"postgresql", "database"=>"markus_production", "password"=>"markus"}

Information from Isaac Morland that probably will help with the above:

Markus database set up, password file set up: 

10:23 root@services024.student.cs# setuid markus psql -h postgres.student.cs 
psql (8.4.4, server 8.4.2) 
Type "help" for help. 

markus=> \q 
10:23 root@services024.student.cs#

Attempt #2

[markus@services024]:config$ diff database.yml database.yml.postgresql 
19,21c19,22
<   # domain socket that doesn't need configuration.
< host: postgres.student.cs
< port: 5432
---
>   # domain socket that doesn't need configuration. Windows does not have
>   # domain sockets, so uncomment these lines.
>   #host: localhost
>   #port: 5432
47c48
<   database: markus
---
>   database: markus_production

[markus@services024]:config$ pushd ~/f10-dev/markus-0.9.0; rake db:create --trace; popd
~/f10-dev/markus-0.9.0 ~/f10-dev/markus-0.9.0/config
(in /u7/markus/f10-dev/markus-0.9.0)
** Invoke db:create (first_time)
** Invoke db:load_config (first_time)
** Invoke rails_env (first_time)
** Execute rails_env
** Execute db:load_config
rake aborted!
syntax error on line 23, col 22: `  #schema_search_path: myapp,sharedapp,public'
/usr/lib/ruby/1.8/yaml.rb:133:in `load'
/usr/lib/ruby/1.8/yaml.rb:133:in `load'
/var/lib/gems/1.8/gems/rails-2.3.8/lib/initializer.rb:902:in `database_configuration'
/var/lib/gems/1.8/gems/rails-2.3.8/lib/tasks/databases.rake:4
/usr/lib/ruby/1.8/rake.rb:617:in `call'
/usr/lib/ruby/1.8/rake.rb:617:in `execute'
/usr/lib/ruby/1.8/rake.rb:612:in `each'
/usr/lib/ruby/1.8/rake.rb:612:in `execute'
/usr/lib/ruby/1.8/rake.rb:578:in `invoke_with_call_chain'
/usr/lib/ruby/1.8/monitor.rb:242:in `synchronize'
/usr/lib/ruby/1.8/rake.rb:571:in `invoke_with_call_chain'
/usr/lib/ruby/1.8/rake.rb:588:in `invoke_prerequisites'
/usr/lib/ruby/1.8/rake.rb:585:in `each'
/usr/lib/ruby/1.8/rake.rb:585:in `invoke_prerequisites'
/usr/lib/ruby/1.8/rake.rb:577:in `invoke_with_call_chain'
/usr/lib/ruby/1.8/monitor.rb:242:in `synchronize'
/usr/lib/ruby/1.8/rake.rb:571:in `invoke_with_call_chain'
/usr/lib/ruby/1.8/rake.rb:564:in `invoke'
/usr/lib/ruby/1.8/rake.rb:2027:in `invoke_task'
/usr/lib/ruby/1.8/rake.rb:2005:in `top_level'
/usr/lib/ruby/1.8/rake.rb:2005:in `each'
/usr/lib/ruby/1.8/rake.rb:2005:in `top_level'
/usr/lib/ruby/1.8/rake.rb:2044:in `standard_exception_handling'
/usr/lib/ruby/1.8/rake.rb:1999:in `top_level'
/usr/lib/ruby/1.8/rake.rb:1977:in `run'
/usr/lib/ruby/1.8/rake.rb:2044:in `standard_exception_handling'
/usr/lib/ruby/1.8/rake.rb:1974:in `run'
/usr/bin/rake:28
~/f10-dev/markus-0.9.0/config

Note that the error line is line 24 of database.yml, which is commented out, exactly as it was before... yet now it's a syntax error!?

I don't appear to have changed any newline conventions:

[markus@services024]:config$ grep student.cs database.yml | xxd
0000000: 686f 7374 3a20 706f 7374 6772 6573 2e73  host: postgres.s
0000010: 7475 6465 6e74 2e63 730a                 tudent.cs.
[markus@services024]:config$ grep port: database.yml | xxd
0000000: 706f 7274 3a20 3534 3332 0a              port: 5432.
[markus@services024]:config$ grep 'server defaults' database.yml | xxd
0000000: 2020 2320 5363 6865 6d61 2073 6561 7263    # Schema searc
0000010: 6820 7061 7468 2e20 5468 6520 7365 7276  h path. The serv
0000020: 6572 2064 6566 6175 6c74 7320 746f 2024  er defaults to $
0000030: 7573 6572 2c70 7562 6c69 630a 2020 2320  user,public.  # 
0000040: 5468 6520 7365 7276 6572 2064 6566 6175  The server defau
0000050: 6c74 7320 746f 206e 6f74 6963 652e 0a    lts to notice..
[markus@services024]:config$ 
so this is puzzling.

If the port isn't set,

diff database.yml database.yml.postgresql 
19,21c19,22
<   # domain socket that doesn't need configuration. 
< host: postgres.student.cs
< #port: 5432
---
>   # domain socket that doesn't need configuration. Windows does not have
>   # domain sockets, so uncomment these lines.
>   #host: localhost
>   #port: 5432
49c50
< #  password: markus
---
>   password: markus

I get the same error as in attempt #1:

FATAL:  Ident authentication failed for user "markus"
[...]
Couldn't create database for {"encoding"=>"unicode", "username"=>"markus", "adapter"=>"postgresql", "database"=>"markus_production"}

Is this possibly because of something nonstandard in our environment? For example, from the file /var/lib/gems/1.8/gems/postgres-0.7.9.2008.01.28/README:

- How to install ?

Follow the instructions below to compile and install:

  ruby extconf.rb
  make
  su              (if necessary)
  make install

You may need to specify the directory name for the include files and the
-lpq library by using

    --with-pgsql-include=<include file directory>
    --with-pgsql-lib=<library directory>

For example:

  ruby extconf.rb --with-pgsql-include=/usr/local/pgsql/include \
                  --with-pgsql-lib=/usr/local/pgsql/lib

Attempt #3

[markus@services024]:config$ diff database.yml database.yml.postgresql 
19c19,20
<   # domain socket that doesn't need configuration. 
---
>   # domain socket that doesn't need configuration. Windows does not have
>   # domain sockets, so uncomment these lines.
48,49c49,50
< #  username: markus
< #  password: markus
---
>   username: markus
>   password: markus
[markus@services024]:config$ !p 
pushd ~/f10-dev/markus-0.9.0; rake db:create --trace; popd
~/f10-dev/markus-0.9.0 ~/f10-dev/markus-0.9.0/config
(in /u7/markus/f10-dev/markus-0.9.0)
DEPRECATION WARNING: Rake tasks in vendor/plugins/db-populate/tasks, vendor/plugins/db-populate/tasks, and vendor/plugins/time-warp/tasks are deprecated. Use lib/tasks instead. (called from /var/lib/gems/1.8/gems/rails-2.3.8/lib/tasks/rails.rb:10)
** Invoke db:create (first_time)
** Invoke db:load_config (first_time)
** Invoke rails_env (first_time)
** Execute rails_env
** Execute db:load_config
** Execute db:create
rake aborted!
undefined method `[]' for nil:NilClass
/var/lib/gems/1.8/gems/rails-2.3.8/lib/tasks/databases.rake:55:in `create_database'
/var/lib/gems/1.8/gems/rails-2.3.8/lib/tasks/databases.rake:31
/usr/lib/ruby/1.8/rake.rb:617:in `call'
/usr/lib/ruby/1.8/rake.rb:617:in `execute'
/usr/lib/ruby/1.8/rake.rb:612:in `each'
/usr/lib/ruby/1.8/rake.rb:612:in `execute'
/usr/lib/ruby/1.8/rake.rb:578:in `invoke_with_call_chain'
/usr/lib/ruby/1.8/monitor.rb:242:in `synchronize'
/usr/lib/ruby/1.8/rake.rb:571:in `invoke_with_call_chain'
/usr/lib/ruby/1.8/rake.rb:564:in `invoke'
/usr/lib/ruby/1.8/rake.rb:2027:in `invoke_task'
/usr/lib/ruby/1.8/rake.rb:2005:in `top_level'
/usr/lib/ruby/1.8/rake.rb:2005:in `each'
/usr/lib/ruby/1.8/rake.rb:2005:in `top_level'
/usr/lib/ruby/1.8/rake.rb:2044:in `standard_exception_handling'
/usr/lib/ruby/1.8/rake.rb:1999:in `top_level'
/usr/lib/ruby/1.8/rake.rb:1977:in `run'
/usr/lib/ruby/1.8/rake.rb:2044:in `standard_exception_handling'
/usr/lib/ruby/1.8/rake.rb:1974:in `run'
/usr/bin/rake:28
~/f10-dev/markus-0.9.0/config
[markus@services024]:config$ 

More Information?

It appears this db:create is called as part of the Rails setup.

If I uncomment the hosts line only, I see the error

syntax error on line 20, col 8: `  #port: 5432'

...

Maybe that's why at http://www.tutorialspoint.com/ruby-on-rails/rails-database-setup.htm the host is always on the last line!?

If I move host down to the end of the file, the error is once again

undefined method `[]' for nil:NilClass

I'm getting this nil error even with the original database.yml, so even though I tried not to change anything besides putting in a few print statements, I seem to have messed something up.

I think I will be starting the installation again from scratch, but maintaining a subversion record of changes...

Attempt #4

Started again from a fresh copy in subversion...

Trying to avoid hardcoding a login and password, as Isaac suggests that should not be necessary with proper use of the postgres libraries.

[markus@services024]:config$ svn diff
Index: database.yml
===================================================================
--- database.yml   (revision 0)
+++ database.yml   (revision 0)
@@ -0,0 +1,50 @@
+# PostgreSQL. Versions 7.4 and 8.x are supported.
+#
+# Install the ruby-postgres driver:
+#   gem install ruby-pg
+# On Mac OS X:
+#   gem install ruby-pg -- --include=/usr/local/pgsql
+# On Windows:
+#   gem install postgres-pr
+#       Choose the win32 build.
+#       Install PostgreSQL and put its /bin directory on your path.
+#development:
+#  adapter: postgresql
+#  encoding: unicode
+#  database: markus_development
+#  username: markus
+#  password: markus
+
+  # Connect on a TCP socket. Omitted by default since the client uses a
+  # domain socket that doesn't need configuration. Windows does not have
+  # domain sockets, so uncomment these lines.
+  #port: 5432
+
+  # Schema search path. The server defaults to $user,public
+  #schema_search_path: myapp,sharedapp,public
+
+  # Minimum log levels, in increasing order:
+  #   debug5, debug4, debug3, debug2, debug1,
+  #   log, notice, warning, error, fatal, and panic
+  # The server defaults to notice.
+  #min_messages: warning
+
+# Warning: The database defined as "test" will be erased and
+# re-generated from your development database when you run "rake".
+# Do not set this db to the same as development or production.
+#test:
+#  adapter: postgresql
+#  encoding: unicode
+#  database: markus_test
+#  username: markus
+#  password: markus
+#
+# Production database settings. Make sure the database name is unique for
+# each MarkUs instance.
+production:
+  adapter: postgresql
+  encoding: unicode
+  database: markus_production
+#  username: markus
+#  password: markus
+  host: postgres.student.cs.uwaterloo.ca
Index: environment.rb
===================================================================
--- environment.rb   (revision 1)
+++ environment.rb   (working copy)
@@ -1,7 +1,7 @@
 # Be sure to restart your server when you modify this file
 
 # Specifies gem version of Rails to use when vendor/rails is not present
-RAILS_GEM_VERSION = '2.3.8' unless defined? RAILS_GEM_VERSION
+#RAILS_GEM_VERSION = '2.3.8' unless defined? RAILS_GEM_VERSION
 
 # Bootstrap the Rails environment, frameworks, and default configuration
 require File.join(File.dirname(__FILE__), 'boot')
Index: environments/production.rb
===================================================================
--- environments/production.rb   (revision 1)
+++ environments/production.rb   (working copy)
@@ -44,7 +44,7 @@
 
 ###################################################################
 # Set the course name here
-COURSE_NAME         = "CSC108 Fall 2009: Introduction to Computer Programming"
+COURSE_NAME         = "CS Fall 2010 Development"
 
 ###################################################################
 # MarkUs relies on external user authentication: An external script
@@ -110,17 +110,17 @@
 ###################################################################
 # Directory where Repositories will be created. Make sure MarkUs is allowed
 # to write to this directory
-REPOSITORY_STORAGE = "/home/markus/svn-repos-root"
+REPOSITORY_STORAGE = "/u/markus/f10-dev/svn-repos-root"
 
 ###################################################################
 # Directory where converted PDF files will be stored as JPEGs. Make sure MarkUs
 # is allowed to write to this directory
-PDF_STORAGE = "/home/markus/converted_pdf_dir/"
+PDF_STORAGE = "/u/markus/converted_pdf_dir/"
 
 ###################################################################
 # Directory where the Automated Testing Repositories will be created.
 # Make sure MarkUs is allowed to write to this directory
-TEST_FRAMEWORK_REPOSITORY = "/home/markus/test-framework"
+TEST_FRAMEWORK_REPOSITORY = "/u/markus/test-framework"
 
 ###################################################################
 # Set this to true or false if you want to be able to display and annotate
@@ -239,3 +239,5 @@
 ###################################################################
 # END OF MarkUs SPECIFIC CONFIGURATION
 ###################################################################
+
+POST_COMMIT_HOOK = "/u/markus/f10-dev/uw/post-commit"


[markus@services024]:config$ pushd ~/f10-dev/markus-0.9.0; rake db:create --trace; popd
~/f10-dev/markus-0.9.0 ~/f10-dev/markus-0.9.0/config ~/f10-dev/markus-0.9.0/app
(in /u7/markus/f10-dev/markus-0.9.0)
** Invoke db:create (first_time)
** Invoke db:load_config (first_time)
** Invoke rails_env (first_time)
** Execute rails_env
** Execute db:load_config
** Execute db:create
fe_sendauth: no password supplied
/var/lib/gems/1.8/gems/activerecord-2.3.8/lib/active_record/connection_adapters/postgresql_adapter.rb:941:in `initialize'
/var/lib/gems/1.8/gems/activerecord-2.3.8/lib/active_record/connection_adapters/postgresql_adapter.rb:941:in `connect'
/var/lib/gems/1.8/gems/activerecord-2.3.8/lib/active_record/connection_adapters/postgresql_adapter.rb:941:in `connect'
/var/lib/gems/1.8/gems/activerecord-2.3.8/lib/active_record/connection_adapters/postgresql_adapter.rb:217:in `initialize'
/var/lib/gems/1.8/gems/activerecord-2.3.8/lib/active_record/connection_adapters/postgresql_adapter.rb:37:in `new'
/var/lib/gems/1.8/gems/activerecord-2.3.8/lib/active_record/connection_adapters/postgresql_adapter.rb:37:in `postgresql_connection'
/var/lib/gems/1.8/gems/activerecord-2.3.8/lib/active_record/connection_adapters/abstract/connection_pool.rb:223:in `send'
/var/lib/gems/1.8/gems/activerecord-2.3.8/lib/active_record/connection_adapters/abstract/connection_pool.rb:223:in `new_connection'
/var/lib/gems/1.8/gems/activerecord-2.3.8/lib/active_record/connection_adapters/abstract/connection_pool.rb:245:in `checkout_new_connection'
/var/lib/gems/1.8/gems/activerecord-2.3.8/lib/active_record/connection_adapters/abstract/connection_pool.rb:188:in `checkout'
/var/lib/gems/1.8/gems/activerecord-2.3.8/lib/active_record/connection_adapters/abstract/connection_pool.rb:184:in `loop'
/var/lib/gems/1.8/gems/activerecord-2.3.8/lib/active_record/connection_adapters/abstract/connection_pool.rb:184:in `checkout'
/usr/lib/ruby/1.8/monitor.rb:242:in `synchronize'
/var/lib/gems/1.8/gems/activerecord-2.3.8/lib/active_record/connection_adapters/abstract/connection_pool.rb:183:in `checkout'
/var/lib/gems/1.8/gems/activerecord-2.3.8/lib/active_record/connection_adapters/abstract/connection_pool.rb:98:in `connection'
/var/lib/gems/1.8/gems/activerecord-2.3.8/lib/active_record/connection_adapters/abstract/connection_pool.rb:326:in `retrieve_connection'
/var/lib/gems/1.8/gems/activerecord-2.3.8/lib/active_record/connection_adapters/abstract/connection_specification.rb:123:in `retrieve_connection'
/var/lib/gems/1.8/gems/activerecord-2.3.8/lib/active_record/connection_adapters/abstract/connection_specification.rb:115:in `connection'
/var/lib/gems/1.8/gems/rails-2.3.8/lib/tasks/databases.rake:70:in `create_database'
/var/lib/gems/1.8/gems/rails-2.3.8/lib/tasks/databases.rake:31
/usr/lib/ruby/1.8/rake.rb:617:in `call'
/usr/lib/ruby/1.8/rake.rb:617:in `execute'
/usr/lib/ruby/1.8/rake.rb:612:in `each'
/usr/lib/ruby/1.8/rake.rb:612:in `execute'
/usr/lib/ruby/1.8/rake.rb:578:in `invoke_with_call_chain'
/usr/lib/ruby/1.8/monitor.rb:242:in `synchronize'
/usr/lib/ruby/1.8/rake.rb:571:in `invoke_with_call_chain'
/usr/lib/ruby/1.8/rake.rb:564:in `invoke'
/usr/lib/ruby/1.8/rake.rb:2027:in `invoke_task'
/usr/lib/ruby/1.8/rake.rb:2005:in `top_level'
/usr/lib/ruby/1.8/rake.rb:2005:in `each'
/usr/lib/ruby/1.8/rake.rb:2005:in `top_level'
/usr/lib/ruby/1.8/rake.rb:2044:in `standard_exception_handling'
/usr/lib/ruby/1.8/rake.rb:1999:in `top_level'
/usr/lib/ruby/1.8/rake.rb:1977:in `run'
/usr/lib/ruby/1.8/rake.rb:2044:in `standard_exception_handling'
/usr/lib/ruby/1.8/rake.rb:1974:in `run'
/usr/bin/rake:28
Couldn't create database for {"encoding"=>"unicode", "adapter"=>"postgresql", "database"=>"markus_production", "host"=>"postgres.student.cs.uwaterloo.ca"}
~/f10-dev/markus-0.9.0/config ~/f10-dev/markus-0.9.0/app
[markus@services024]:config$ 

Attempt 5

Hardcoded the password, so there is unfortunately no possiblity of posting the svn diff as a record.

[markus@services024]:config$ pushd ~/f10-dev/markus-0.9.0; rake db:create --trace; popd
~/f10-dev/markus-0.9.0 ~/f10-dev/markus-0.9.0/config ~/f10-dev/markus-0.9.0/app
(in /u7/markus/f10-dev/markus-0.9.0)
** Invoke db:create (first_time)
** Invoke db:load_config (first_time)
** Invoke rails_env (first_time)
** Execute rails_env
** Execute db:load_config
** Execute db:create
PGError: ERROR:  permission denied to create database
: CREATE DATABASE "markus_production" ENCODING = 'utf8'
/var/lib/gems/1.8/gems/activerecord-2.3.8/lib/active_record/connection_adapters/abstract_adapter.rb:221:in `log'
/var/lib/gems/1.8/gems/activerecord-2.3.8/lib/active_record/connection_adapters/postgresql_adapter.rb:520:in `execute'
/var/lib/gems/1.8/gems/activerecord-2.3.8/lib/active_record/connection_adapters/postgresql_adapter.rb:603:in `create_database'
/var/lib/gems/1.8/gems/rails-2.3.8/lib/tasks/databases.rake:70:in `create_database'
/var/lib/gems/1.8/gems/rails-2.3.8/lib/tasks/databases.rake:31
/usr/lib/ruby/1.8/rake.rb:617:in `call'
/usr/lib/ruby/1.8/rake.rb:617:in `execute'
/usr/lib/ruby/1.8/rake.rb:612:in `each'
[...]

Commentary about following MarkUs setup directions

From:   Isaac Morland <ijmorlan@uwaterloo.ca>
To:   "tavaskor@129.97.59.157 via RT" <rt-owner@math.uwaterloo.ca>

On Fri, 3 Sep 2010, tavaskor@129.97.59.157 via RT wrote: 

> I've tried giving up on the autodetection of the login/password and 
> hardcoded it in /u7/markus/f10-dev/markus-0.9.0/config/environment.rb, 
> but it still doesn't want to create a database. 

> PGError: ERROR:  permission denied to create database 

The database already exists and is called "markus".  Permission to create 
databases is not given out willy-nilly. 

Isaac Morland CSCF Web Guru 
DC 2554C, x36650 WWW Software Specialist

The hope is that markus instances can each have their own schema in one large database. The schema option is mentioned at http://db2onrails.com/connection/ so maybe it ports? But the MarkUs developers explicitly say:

# Production database settings. Make sure the database name is unique for 
# each MarkUs instance.
so this may be a bumpy ride.
Edit | Attach | Watch | Print version | History: r4 < r3 < r2 < r1 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r4 - 2010-09-03 - TerryVaskor
 
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2024 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback