view · edit · sidebar · attach · print · history

20110125-setup-ramaze-setup-de_oddb-on-ubuntu

<< | Index | >>


  1. Review setup ramaze version oddb.org
  2. Set up web server for ramaze
  3. Set up ODDB v3.0 for Ruby 1.9 suspend
  4. Set up ramaze version oddb on Ubuntu suspend

Goal
  • Setup Ramaze version oddb / 70%
Milestones
Summary
Commits
ToDo Tomorrow
  • Check 'migrate' script in ramaze version of oddb
Keep in Mind
  1. Encoding woes (from Davatz-san)
  2. Feedback: This option indicates that the regular expression is parsed as 'UTF8' (from Davatz-san)
  3. pg on Ubuntu - see http://dev.ywesee.com/wiki.php/Gem/Pg (from Davatz-san)
  4. On Ice
  5. emerge --sync

Review setup ramaze version oddb.org

gem list

masa@masa ~/ywesee $ ~/bin/ruby191/bin/ruby /usr/bin/gem list

*** LOCAL GEMS ***

activesupport (2.3.3)
dbd-pg (0.3.9)
dbi (0.4.5)
deprecated (2.0.1)
facets (1.8.54)
haml (3.0.25)
innate (2010.07)
pg (0.8.0)
rack (1.2.1)
ramaze (2010.06.18)
rclconf (1.0.0)
rmagick (2.13.1)
rubygems-update (1.4.2)

Updated

/usr/lib64/ruby/gems/1.9.1/gems/dbi-0.4.5/lib/dbi/columninfo.rb

        def initialize(hash=nil)
            @hash = hash.dup rescue nil
            @hash ||= Hash.new

            # coerce all strings to symbols
            #@hash.each_key do |x|
            @hash.keys.each do |x|
                if x.kind_of? String
                    sym = x.to_sym
                    if @hash.has_key? sym
                        raise ::TypeError,
                            "#{self.class.name} may construct from a hash keyed with strings or symbols, but not both"
                    end
                    @hash[sym] = @hash[x]
                    @hash.delete(x)
                end
            end

            super(@hash)
        end

/usr/lib64/ruby/gems/1.9.1/gems/dbi-0.4.5/lib/dbi/handles/statement.rb

        # 
        # Fetch the entire result set. Result is array of DBI::Row.
        #
        def fetch_all
            sanity_check({:fetchable => true, :prepared => true, :executed => true})

            cols = column_names
            fetched_rows = []

            begin
                while row = fetch do
                    #fetched_rows.push(row)
                    fetched_rows.push(row.to_a)
                end
            rescue Exception
            end

            @handle.cancel
            @fetchable = false
            return fetched_rows
        end

Note

  • It can run in both Ruby 1.9.1 and 1.9.2
 masa@masa ~/ywesee/ramaze.ch.oddb.org $ ruby1.9 -I ../oddb/lib:../odba/lib start.rb

Why did I add 'to_a' method? (thought flow)

  • When I looked at the 'row' by 'p' method, it looked like an Array
  • I checked 'row' class by writing 'p row.class' then it showed 'DBI::Row'
  • I checked DBI::Row definition (/usr/lib64/ruby/gems/1.9.1/gems/dbi-0.4.5/lib/dbi/row.rb)
  • There is 'to_a' method defined
  • Also see: http://erik.hollensbe.org/docs/ruby-dbi/DBI/Row.html#method-i-to_a
      # returns the underlying array (duplicated)
      def to_a
          @arr.dup
      end

Consideration

  • The DBI::Row instance returns its (private) variable @arr through __getobj__ method in Ruby 1.9.x
  • The cause of 'fetched_rows[0]' changing is as follows
    • DBI::Row#@arr is re-created in Ruby 1.9.1 but DBI::Row#@arr (its memory space) is re-used in Ruby 1.9.2
    • That is why (I guess) 'feched_rows[0]' is re-written in Ruby 1.9.2

Experiment

/usr/lib64/ruby/gems/1.9.1/gems/dbi-0.4.5/lib/dbi/handles/statement.rb

        def fetch_all
            sanity_check({:fetchable => true, :prepared => true, :executed => true})

            cols = column_names
            fetched_rows = []

            begin
                while row = fetch do
print "row.arr.object_id="
p row.arr.object_id
                    fetched_rows.push(row)
                    #fetched_rows.push(row.to_a)
                end
            rescue Exception
            end

            @handle.cancel
            @fetchable = false
exit
            return fetched_rows
        end

Result (Ruby 1.9.1)

masa@masa ~/ywesee/ramaze.ch.oddb.org $ ~/bin/ruby191/bin/ruby -I ../oddb/lib:../odba/lib start.rb 
ERROR:  relation "object" already exists

ERROR:  relation "prefetchable_index" already exists

ERROR:  relation "extent_index" already exists

ERROR:  relation "object_connection" already exists

ERROR:  relation "target_id_index" already exists

ERROR:  relation "collection" already exists

row.arr.object_id=25062688
row.arr.object_id=25062380
row.arr.object_id=25062100
row.arr.object_id=25061820
row.arr.object_id=25061540
row.arr.object_id=25061260
row.arr.object_id=25060980
row.arr.object_id=25060700
row.arr.object_id=25060420
row.arr.object_id=25060140
row.arr.object_id=25059860
row.arr.object_id=25059580
row.arr.object_id=25093824
row.arr.object_id=25093544
row.arr.object_id=25093264
row.arr.object_id=25092984
row.arr.object_id=25092704
row.arr.object_id=25092424
row.arr.object_id=25092144
row.arr.object_id=25091864
row.arr.object_id=25091584
row.arr.object_id=25091304
row.arr.object_id=25091024
row.arr.object_id=25090744
row.arr.object_id=25090464
row.arr.object_id=25090184
row.arr.object_id=25089904
row.arr.object_id=25089624
row.arr.object_id=25089344
row.arr.object_id=25089064
row.arr.object_id=25088784

Result (Ruby 1.9.2)

masa@masa ~/ywesee/ramaze.ch.oddb.org $ ruby1.9 -I ../oddb/lib:../odba/lib start.rb 
ERROR:  relation "object" already exists

ERROR:  relation "prefetchable_index" already exists

ERROR:  relation "extent_index" already exists

ERROR:  relation "object_connection" already exists

ERROR:  relation "target_id_index" already exists

ERROR:  relation "collection" already exists

row.arr.object_id=26231140
row.arr.object_id=26231140
row.arr.object_id=26231140
row.arr.object_id=26231140
row.arr.object_id=26231140
row.arr.object_id=26231140
row.arr.object_id=26231140
row.arr.object_id=26231140
row.arr.object_id=26231140
row.arr.object_id=26231140
row.arr.object_id=26231140
row.arr.object_id=26231140
row.arr.object_id=26231140
row.arr.object_id=26231140
row.arr.object_id=26231140
row.arr.object_id=26231140
row.arr.object_id=26231140
row.arr.object_id=26231140
row.arr.object_id=26231140
row.arr.object_id=26231140
row.arr.object_id=26231140
row.arr.object_id=26231140
row.arr.object_id=26231140
row.arr.object_id=26231140
row.arr.object_id=26231140
row.arr.object_id=26231140
row.arr.object_id=26231140
row.arr.object_id=26231140
row.arr.object_id=26231140
row.arr.object_id=26231140
row.arr.object_id=26231140

Note

  • My guess is right

Consideration (further)

  • DBI::Row#@arr (Array) instannce is created around line:46-52 of /usr/lib64/ruby/gems/1.9.1/gems/dbi-0.4.5/lib/dbi/row.rb (DBI::Row class)
  • Somehow Ruby 1.9.1 creates a new Array instance but Ruby 1.9.2 does not create a new Array instance

Set up web server for ramaze

Reference

/etc/make.conf

# These settings were set by the metro build script that automatically built this stage.
# Please consult /etc/make.conf.example for a more detailed example.

ACCEPT_KEYWORDS="amd64"
CHOST="x86_64-pc-linux-gnu"
CFLAGS="-march=core2 -O2 -pipe"
CXXFLAGS="${CFLAGS}"
MAKEOPTS="-j5"
GENTOO_MIRRORS="http://mirror.switch.ch/ftp/mirror/gentoo/ "
# SYNC="rsync://rsync.europe.gentoo.org/gentoo-portage"
LINGUAS="de fi en ja"

USE="X consolekit dbus hal jpeg postgres extras"
INPUT_DEVICES="evdev synaptics"
VIDEO_CARDS="nvidia"
RUBY_TARGETS="ruby18 ruby1.9"

SYNC="rsync://rsync3.jp.gentoo.org/gentoo-portage"
ACCEPT_LICENSE="dlj-1.1"

APACHE2_MODULES="actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias proxy proxy_http"

/etc/conf.d/apache2

...
APACHE2_OPTS="-D DEFAULT_VHOST -D INFO -D SSL -D SSL_DEFAULT_VHOST -D LANGUAGE -D RUBY -D PHP5 -D PROXY"
...

gem list

masa@masa ~/ywesee/ramaze.ch.oddb.org $ ruby1.9 /usr/bin/gem list

*** LOCAL GEMS ***

abstract (1.0.0)
actionmailer (3.0.3)
actionpack (3.0.3)
activemodel (3.0.3)
activerecord (3.0.3)
activeresource (3.0.3)
activesupport (2.3.3)
arel (2.0.6)
builder (2.1.2)
bundler (1.0.7)
daemons (1.1.0)
dbd-pg (0.3.9)
dbi (0.4.5)
deprecated (2.0.1)
erubis (2.6.6)
eventmachine (0.12.10)
facets (1.8.54)
flexmock (0.8.11)
haml (2.2.2)
hoe (2.7.0)
hpricot (0.8.1)
i18n (0.5.0)
innate (2010.07, 2009.10)
json_pure (1.4.6)
mail (2.2.12)
mime-types (1.16)
minitest (1.6.0)
pg (0.10.1)
polyglot (0.3.1)
rack (1.2.1, 1.0.1)
rack-mount (0.6.13)
rack-test (0.5.6)
rails (3.0.3)
railties (3.0.3)
rake (0.8.7)
ramaze (2009.10)
rclconf (1.0.0)
rdoc (2.5.8)
rmagick (2.13.1)
rmail (1.0.0)
ruby-ole (1.2.11.1)
rubyforge (2.0.4)
rubyzip (0.9.4)
search (0.0.1)
test-unit (2.1.1)
thin (1.2.7)
thor (0.14.6)
treetop (1.4.9)
tzinfo (0.3.23)

Reinstall apache

masa@masa ~/ywesee/ramaze.ch.oddb.org $ sudo emerge apache

Reboot apache2

masa@masa ~/ywesee/ramaze.ch.oddb.org $ sudo /etc/init.d/apache2 restart
Passwort: 
* Stopping apache2...
apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName                                                     [ok]
* Starting apache2...
apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName                                                     [ok]

/etc/apache2/vhosts.d/07_ch.oddb.org.conf

<VirtualHost *:80>
ServerName ramaze.masa.ch.oddb.org
ServerAdmin mhatakeyama@ywesee.com

#ErrorLog "|/usr/sbin/cronolog -l /var/www/ramaze.ch.oddb.org/log/error_log /var/www/ramaze.ch.oddb.org/log/%Y/%m/%d/error_log"
#CustomLog "|/usr/sbin/cronolog -l /var/www/ramaze.ch.oddb.org/log/access_log /var/www/ramaze.ch.oddb.org/log/%Y/%m/%d/access_log" combined

DefaultType text/html
ProxyPreserveHost On

# Configuration possibility 1 of 2:
# The entire domainname, from the root (/), is served by Ramaze
# Ramaze should be running at the defined host (192.168.1.100 in this example)
# and on the specified port (8000 in this example)
# Note the trailing slash after the port.
ProxyPass        / http://localhost:7000/
ProxyPassReverse / http://localhost:7000/
# End Configuration possibility 1 of 2.
</VirtualHost>

/etc/hosts

127.0.0.1   localhost ramaze.masa.ch.oddb.org

Access to http://ramaze.masa.ch.oddb.org/

Result

  • start.rb works but errors on browser
  • Error on console
NoMethodError: undefined method `country' for #<RCLConf::RCLConf:0x00000002f9bee0>
        /usr/lib64/ruby/gems/1.9.1/gems/rclconf-1.0.0/lib/rclconf/rclconf.rb:42:in `block (4 levels) in method_missing'
        /usr/lib64/ruby/gems/1.9.1/gems/rclconf-1.0.0/lib/rclconf/rclconf.rb:42:in `fetch'
        /usr/lib64/ruby/gems/1.9.1/gems/rclconf-1.0.0/lib/rclconf/rclconf.rb:42:in `block (3 levels) in method_missing'
        /usr/lib64/ruby/gems/1.9.1/gems/rclconf-1.0.0/lib/rclconf/rclconf.rb:41:in `fetch'
        /usr/lib64/ruby/gems/1.9.1/gems/rclconf-1.0.0/lib/rclconf/rclconf.rb:41:in `block (2 levels) in method_missing'
        /usr/lib64/ruby/gems/1.9.1/gems/rclconf-1.0.0/lib/rclconf/rclconf.rb:40:in `fetch'
        /usr/lib64/ruby/gems/1.9.1/gems/rclconf-1.0.0/lib/rclconf/rclconf.rb:40:in `block in method_missing'
        /usr/lib64/ruby/gems/1.9.1/gems/rclconf-1.0.0/lib/rclconf/rclconf.rb:39:in `fetch'
        /usr/lib64/ruby/gems/1.9.1/gems/rclconf-1.0.0/lib/rclconf/rclconf.rb:39:in `method_missing'
        ./layout/default.haml:17:in `binding'
        /usr/lib64/ruby/gems/1.9.1/gems/haml-2.2.2/lib/haml/engine.rb:177:in `eval'
        /usr/lib64/ruby/gems/1.9.1/gems/haml-2.2.2/lib/haml/engine.rb:177:in `render'
        /usr/lib64/ruby/gems/1.9.1/gems/ramaze-2009.10/lib/ramaze/view/haml.rb:16:in `call'
        /usr/lib64/ruby/gems/1.9.1/gems/innate-2010.07/lib/innate/action.rb:89:in `block (2 levels) in render'
        /usr/lib64/ruby/gems/1.9.1/gems/innate-2010.07/lib/innate/action.rb:96:in `wrap_in_layout'
        /usr/lib64/ruby/gems/1.9.1/gems/innate-2010.07/lib/innate/action.rb:88:in `block in render'
        /usr/lib64/ruby/gems/1.9.1/gems/innate-2010.07/lib/innate/helper/aspect.rb:82:in `wrap_action_call'
        /usr/lib64/ruby/gems/1.9.1/gems/innate-2010.07/lib/innate/action.rb:83:in `render'
        /usr/lib64/ruby/gems/1.9.1/gems/innate-2010.07/lib/innate/action.rb:35:in `block in call'
        /usr/lib64/ruby/gems/1.9.1/gems/innate-2010.07/lib/innate/action.rb:120:in `wrap_in_current'
        /usr/lib64/ruby/gems/1.9.1/gems/innate-2010.07/lib/innate/action.rb:35:in `call'
        /usr/lib64/ruby/gems/1.9.1/gems/innate-2010.07/lib/innate/action.rb:111:in `render_in_layout'
        /usr/lib64/ruby/gems/1.9.1/gems/innate-2010.07/lib/innate/action.rb:96:in `wrap_in_layout'
        /usr/lib64/ruby/gems/1.9.1/gems/innate-2010.07/lib/innate/action.rb:88:in `block in render'
        /usr/lib64/ruby/gems/1.9.1/gems/innate-2010.07/lib/innate/helper/aspect.rb:36:in `aspect_wrap'
        /usr/lib64/ruby/gems/1.9.1/gems/innate-2010.07/lib/innate/helper/aspect.rb:88:in `wrap_action_call'
        /usr/lib64/ruby/gems/1.9.1/gems/innate-2010.07/lib/innate/action.rb:83:in `render'
        /usr/lib64/ruby/gems/1.9.1/gems/innate-2010.07/lib/innate/action.rb:35:in `block in call'
        /usr/lib64/ruby/gems/1.9.1/gems/innate-2010.07/lib/innate/action.rb:120:in `wrap_in_current'
        /usr/lib64/ruby/gems/1.9.1/gems/innate-2010.07/lib/innate/action.rb:35:in `call'
        /usr/lib64/ruby/gems/1.9.1/gems/innate-2010.07/lib/innate/node.rb:299:in `block (2 levels) in action_found'
        /usr/lib64/ruby/gems/1.9.1/gems/innate-2010.07/lib/innate/node.rb:299:in `catch'
        /usr/lib64/ruby/gems/1.9.1/gems/innate-2010.07/lib/innate/node.rb:299:in `block in action_found'
        /usr/lib64/ruby/gems/1.9.1/gems/innate-2010.07/lib/innate/node.rb:299:in `catch'
        /usr/lib64/ruby/gems/1.9.1/gems/innate-2010.07/lib/innate/node.rb:299:in `action_found'
        /usr/lib64/ruby/gems/1.9.1/gems/innate-2010.07/lib/innate/node.rb:283:in `try_resolve'
        /usr/lib64/ruby/gems/1.9.1/gems/innate-2010.07/lib/innate/node.rb:268:in `call'
        /usr/lib64/ruby/gems/1.9.1/gems/rack-1.2.1/lib/rack/urlmap.rb:47:in `block in call'
        /usr/lib64/ruby/gems/1.9.1/gems/rack-1.2.1/lib/rack/urlmap.rb:41:in `each'
        /usr/lib64/ruby/gems/1.9.1/gems/rack-1.2.1/lib/rack/urlmap.rb:41:in `call'
        /usr/lib64/ruby/gems/1.9.1/gems/innate-2010.07/lib/innate/dynamap.rb:40:in `call'
        /usr/lib64/ruby/gems/1.9.1/gems/innate-2010.07/lib/innate/route.rb:75:in `call'
        /usr/lib64/ruby/gems/1.9.1/gems/rack-1.2.1/lib/rack/cascade.rb:23:in `block in call'
        /usr/lib64/ruby/gems/1.9.1/gems/rack-1.2.1/lib/rack/cascade.rb:22:in `each'
        /usr/lib64/ruby/gems/1.9.1/gems/rack-1.2.1/lib/rack/cascade.rb:22:in `call'
        /usr/lib64/ruby/gems/1.9.1/gems/innate-2010.07/lib/innate/current.rb:22:in `call'
        /usr/lib64/ruby/gems/1.9.1/gems/rack-1.2.1/lib/rack/cascade.rb:23:in `block in call'
        /usr/lib64/ruby/gems/1.9.1/gems/rack-1.2.1/lib/rack/cascade.rb:22:in `each'
        /usr/lib64/ruby/gems/1.9.1/gems/rack-1.2.1/lib/rack/cascade.rb:22:in `call'
        /usr/lib64/ruby/gems/1.9.1/gems/ramaze-2009.10/lib/ramaze/app.rb:93:in `call'
        /usr/lib64/ruby/gems/1.9.1/gems/rack-1.2.1/lib/rack/urlmap.rb:47:in `block in call'
        /usr/lib64/ruby/gems/1.9.1/gems/rack-1.2.1/lib/rack/urlmap.rb:41:in `each'
        /usr/lib64/ruby/gems/1.9.1/gems/rack-1.2.1/lib/rack/urlmap.rb:41:in `call'
        /usr/lib64/ruby/gems/1.9.1/gems/innate-2010.07/lib/innate/dynamap.rb:40:in `call'
        /usr/lib64/ruby/gems/1.9.1/gems/ramaze-2009.10/lib/ramaze/reloader.rb:88:in `call'
        /usr/lib64/ruby/gems/1.9.1/gems/rack-1.2.1/lib/rack/head.rb:9:in `call'
        /usr/lib64/ruby/gems/1.9.1/gems/ramaze-2009.10/lib/vendor/etag.rb:11:in `call'
        /usr/lib64/ruby/gems/1.9.1/gems/rack-1.2.1/lib/rack/conditionalget.rb:25:in `call'
        /usr/lib64/ruby/gems/1.9.1/gems/ramaze-2009.10/lib/vendor/route_exceptions.rb:22:in `call'
        /usr/lib64/ruby/gems/1.9.1/gems/rack-1.2.1/lib/rack/showstatus.rb:20:in `call'
        /usr/lib64/ruby/gems/1.9.1/gems/rack-1.2.1/lib/rack/showexceptions.rb:24:in `call'
        /usr/lib64/ruby/gems/1.9.1/gems/rack-1.2.1/lib/rack/commonlogger.rb:18:in `call'
        /usr/lib64/ruby/gems/1.9.1/gems/rack-1.2.1/lib/rack/lint.rb:48:in `_call'
        /usr/lib64/ruby/gems/1.9.1/gems/rack-1.2.1/lib/rack/lint.rb:36:in `call'
        /usr/lib64/ruby/gems/1.9.1/gems/innate-2010.07/lib/innate/middleware_compiler.rb:52:in `call'
        /usr/lib64/ruby/gems/1.9.1/gems/rack-1.2.1/lib/rack/content_length.rb:13:in `call'
        /usr/lib64/ruby/gems/1.9.1/gems/rack-1.2.1/lib/rack/handler/webrick.rb:52:in `service'
        /usr/lib64/ruby/1.9.1/webrick/httpserver.rb:111:in `service'
        /usr/lib64/ruby/1.9.1/webrick/httpserver.rb:70:in `run'
        /usr/lib64/ruby/1.9.1/webrick/server.rb:183:in `block in start_thread'

Trace line by line

Experiment

Run

masa@masa ~/ywesee/ramaze.ch.oddb.org $ ruby1.9 -I ../oddb/lib:../odba/lib start.rb country="hogehoge"

Result

Note

  • It is also fine to add 'contry: hogehoge' in 'oddb/lib/oddb/config.rb' or 'ramaze.ch.oddb.org/etc/oddb.yml'

Memo

  • Change Ruby interpreter (though emerge)
 $ sudo eselect ruby list
 $ sudo eselect ruby set ruby18
 $ sudo eselect ruby set ruby1.9
  • This ruby1.9 looks working strange

Check library path for ruby1.9

$ ruby1.9 -rpp -e "pp $:"

Result

masa@masa /usr/lib64/ruby/site_ruby/1.9.1 $ ruby1.9 -rpp -e "pp $:"
["/home/masa/rubylib",
 "/usr/lib64/ruby/gems/1.9.1/gems/abstract-1.0.0/lib",
 "/usr/lib64/ruby/gems/1.9.1/gems/actionmailer-3.0.3/lib",
 "/usr/lib64/ruby/gems/1.9.1/gems/actionpack-3.0.3/lib",
 "/usr/lib64/ruby/gems/1.9.1/gems/activemodel-3.0.3/lib",
 "/usr/lib64/ruby/gems/1.9.1/gems/activerecord-3.0.3/lib",
 "/usr/lib64/ruby/gems/1.9.1/gems/activeresource-3.0.3/lib",
 "/usr/lib64/ruby/gems/1.9.1/gems/activesupport-2.3.3/lib",
 "/usr/lib64/ruby/gems/1.9.1/gems/arel-2.0.6/lib",
 "/usr/lib64/ruby/gems/1.9.1/gems/builder-2.1.2/lib",
 "/usr/lib64/ruby/gems/1.9.1/gems/bundler-1.0.7/bin",
 "/usr/lib64/ruby/gems/1.9.1/gems/bundler-1.0.7/lib",
 "/usr/lib64/ruby/gems/1.9.1/gems/character-encodings-0.4.1/lib",
 "/usr/lib64/ruby/gems/1.9.1/gems/daemons-1.1.0/lib",
 "/usr/lib64/ruby/gems/1.9.1/gems/dbd-pg-0.3.9/lib",
 "/usr/lib64/ruby/gems/1.9.1/gems/dbi-0.4.5/bin",
 "/usr/lib64/ruby/gems/1.9.1/gems/dbi-0.4.5/lib",
 "/usr/lib64/ruby/gems/1.9.1/gems/deprecated-2.0.1/lib",
 "/usr/lib64/ruby/gems/1.9.1/gems/erubis-2.6.6/bin",
 "/usr/lib64/ruby/gems/1.9.1/gems/erubis-2.6.6/lib",
 "/usr/lib64/ruby/gems/1.9.1/gems/eventmachine-0.12.10/lib",
 "/usr/lib64/ruby/gems/1.9.1/gems/facets-1.8.54/lib",
 "/usr/lib64/ruby/gems/1.9.1/gems/flexmock-0.8.11/lib",
 "/usr/lib64/ruby/gems/1.9.1/gems/gd2-1.1.1/lib",
 "/usr/lib64/ruby/gems/1.9.1/gems/haml-2.2.2/bin",
 "/usr/lib64/ruby/gems/1.9.1/gems/haml-2.2.2/lib",
 "/usr/lib64/ruby/gems/1.9.1/gems/hoe-2.7.0/bin",
 "/usr/lib64/ruby/gems/1.9.1/gems/hoe-2.7.0/lib",
 "/usr/lib64/ruby/gems/1.9.1/gems/hpricot-0.8.1/lib",
 "/usr/lib64/ruby/gems/1.9.1/gems/i18n-0.5.0/lib",
 "/usr/lib64/ruby/gems/1.9.1/gems/innate-2010.07/lib",
 "/usr/lib64/ruby/gems/1.9.1/gems/json_pure-1.4.6/bin",
 "/usr/lib64/ruby/gems/1.9.1/gems/json_pure-1.4.6/lib",
 "/usr/lib64/ruby/gems/1.9.1/gems/mail-2.2.12/lib",
 "/usr/lib64/ruby/gems/1.9.1/gems/mechanize-0.9.3/lib",
 "/usr/lib64/ruby/gems/1.9.1/gems/mime-types-1.16/lib",
 "/usr/lib64/ruby/gems/1.9.1/gems/money-3.5.5/lib",
 "/usr/lib64/ruby/gems/1.9.1/gems/nokogiri-1.3.3/lib",
 "/usr/lib64/ruby/gems/1.9.1/gems/nokogiri-1.3.3/ext",
 "/usr/lib64/ruby/gems/1.9.1/gems/paypal-2.0.0/lib",
 "/usr/lib64/ruby/gems/1.9.1/gems/pg-0.8.0/lib",
 "/usr/lib64/ruby/gems/1.9.1/gems/polyglot-0.3.1/lib",
 "/usr/lib64/ruby/gems/1.9.1/gems/rack-1.2.1/bin",
 "/usr/lib64/ruby/gems/1.9.1/gems/rack-1.2.1/lib",
 "/usr/lib64/ruby/gems/1.9.1/gems/rack-mount-0.6.13/lib",
 "/usr/lib64/ruby/gems/1.9.1/gems/rack-test-0.5.6/lib",
 "/usr/lib64/ruby/gems/1.9.1/gems/rails-3.0.3/bin",
 "/usr/lib64/ruby/gems/1.9.1/gems/railties-3.0.3/lib",
 "/usr/lib64/ruby/gems/1.9.1/gems/rake-0.8.7/bin",
 "/usr/lib64/ruby/gems/1.9.1/gems/rake-0.8.7/lib",
 "/usr/lib64/ruby/gems/1.9.1/gems/ramaze-2009.10/bin",
 "/usr/lib64/ruby/gems/1.9.1/gems/ramaze-2009.10/lib",
 "/usr/lib64/ruby/gems/1.9.1/gems/rclconf-1.0.0/lib",
 "/usr/lib64/ruby/gems/1.9.1/gems/rmagick-2.13.1/lib",
 "/usr/lib64/ruby/gems/1.9.1/gems/rmagick-2.13.1/ext",
 "/usr/lib64/ruby/gems/1.9.1/gems/rmail-1.0.0/lib",
 "/usr/lib64/ruby/gems/1.9.1/gems/ruby-ole-1.2.11.1/bin",
 "/usr/lib64/ruby/gems/1.9.1/gems/ruby-ole-1.2.11.1/lib",
 "/usr/lib64/ruby/gems/1.9.1/gems/rubyforge-2.0.4/bin",
 "/usr/lib64/ruby/gems/1.9.1/gems/rubyforge-2.0.4/lib",
 "/usr/lib64/ruby/gems/1.9.1/gems/rubyzip-0.9.4/lib",
 "/usr/lib64/ruby/gems/1.9.1/gems/search-0.0.1/bin",
 "/usr/lib64/ruby/gems/1.9.1/gems/test-unit-2.1.1/bin",
 "/usr/lib64/ruby/gems/1.9.1/gems/test-unit-2.1.1/lib",
 "/usr/lib64/ruby/gems/1.9.1/gems/thin-1.2.7/bin",
 "/usr/lib64/ruby/gems/1.9.1/gems/thin-1.2.7/lib",
 "/usr/lib64/ruby/gems/1.9.1/gems/thor-0.14.6/bin",
 "/usr/lib64/ruby/gems/1.9.1/gems/thor-0.14.6/lib",
 "/usr/lib64/ruby/gems/1.9.1/gems/treetop-1.4.9/bin",
 "/usr/lib64/ruby/gems/1.9.1/gems/treetop-1.4.9/lib",
 "/usr/lib64/ruby/gems/1.9.1/gems/turing-0.0.11/lib",
 "/usr/lib64/ruby/gems/1.9.1/gems/tzinfo-0.3.23/lib",
 "/usr/lib64/ruby/site_ruby/1.9.1",
 "/usr/lib64/ruby/site_ruby/1.9.1/x86_64-linux",
 "/usr/lib64/ruby/site_ruby",
 "/usr/lib64/ruby/vendor_ruby/1.9.1",
 "/usr/lib64/ruby/vendor_ruby/1.9.1/x86_64-linux",
 "/usr/lib64/ruby/vendor_ruby",
 "/usr/lib64/ruby/1.9.1",
 "/usr/lib64/ruby/1.9.1/x86_64-linux"]

Note

  • I should set libraries on '/usr/lib64/ruby/site_ruby/1.9.1' as well as '/usr/lib/ruby1.9/site_ruby/1.9.1' on production server

Check directory

masa@masa /usr/lib64/ruby/site_ruby/1.9.1 $ ls -al
insgesamt 52
drwxr-xr-x 12 root root 4096 25. Jan 11:32 .
drwxr-xr-x  4 root root   48 15. Sep 12:27 ..
drwxr-xr-x  6 root root   40  8. Nov 13:35 bbmb
-rw-r--r--  1 root root  176  8. Nov 13:35 bbmb.rb
drwxr-xr-x  2 root root    8  8. Nov 14:14 cgi
drwxr-xr-x  8 root root   56  3. Nov 11:21 ebps
-rw-r--r--  1 root root   58  3. Nov 11:21 ebps.rb
drwxr-xr-x  2 root root 4096 24. Jan 16:08 odba
-rw-r--r--  1 root root  267 24. Jan 16:08 odba.rb
-rw-r--r--  2 masa masa  256 25. Jan 11:20 oddb.rb
drwxr-xr-x  2 root root    8  3. Nov 08:27 rclconf
-rw-r--r--  1 root root  102  3. Nov 08:27 rclconf.rb
drwxr-xr-x  2 root root   24 26. Okt 13:24 rrba
drwxr-xr-x  2 root root 4096  8. Nov 14:14 sbsm
drwxr-xr-x  2 root root    1  6. Sep 16:16 x86_64-linux
drwxr-xr-x  8 root root   56  8. Nov 13:53 xmlconv
drwxr-xr-x  3 root root 4096 26. Okt 13:31 ydpm

Make a symbolic link to 'ch.oddb.org/lib/oddb'

masa@masa /usr/lib64/ruby/site_ruby/1.9.1 $ sudo ln -s /home/masa/ywesee/ch.oddb.org/lib/oddb
masa@masa /usr/lib64/ruby/site_ruby/1.9.1 $ ls -al
insgesamt 52
drwxr-xr-x 12 root root 4096 25. Jan 11:46 .
drwxr-xr-x  4 root root   48 15. Sep 12:27 ..
drwxr-xr-x  6 root root   40  8. Nov 13:35 bbmb
-rw-r--r--  1 root root  176  8. Nov 13:35 bbmb.rb
drwxr-xr-x  2 root root    8  8. Nov 14:14 cgi
drwxr-xr-x  8 root root   56  3. Nov 11:21 ebps
-rw-r--r--  1 root root   58  3. Nov 11:21 ebps.rb
drwxr-xr-x  2 root root 4096 24. Jan 16:08 odba
-rw-r--r--  1 root root  267 24. Jan 16:08 odba.rb
lrwxrwxrwx  1 root root   38 25. Jan 11:46 oddb -> /home/masa/ywesee/ch.oddb.org/lib/oddb
-rw-r--r--  2 masa masa  256 25. Jan 11:20 oddb.rb
drwxr-xr-x  2 root root    8  3. Nov 08:27 rclconf
-rw-r--r--  1 root root  102  3. Nov 08:27 rclconf.rb
drwxr-xr-x  2 root root   24 26. Okt 13:24 rrba
drwxr-xr-x  2 root root 4096  8. Nov 14:14 sbsm
drwxr-xr-x  2 root root    1  6. Sep 16:16 x86_64-linux
drwxr-xr-x  8 root root   56  8. Nov 13:53 xmlconv
drwxr-xr-x  3 root root 4096 26. Okt 13:31 ydpm
masa@masa /usr/lib64/ruby/site_ruby/1.9.1 $ 

Run start.rb

masa@masa ~/ywesee/ramaze.ch.oddb.org $ ruby1.9 start.rb 
...
D [2011-01-25 11:47:51 $28447] DEBUG | : Using webrick
I [2011-01-25 11:47:51 $28447]  INFO | : WEBrick 1.3.1
I [2011-01-25 11:47:51 $28447]  INFO | : ruby 1.9.2 (2010-07-11) [x86_64-linux]
D [2011-01-25 11:47:51 $28447] DEBUG | : TCPServer.new(0.0.0.0, 7000)
D [2011-01-25 11:47:51 $28447] DEBUG | : Rack::Handler::WEBrick is mounted on /.
I [2011-01-25 11:47:51 $28447]  INFO | : WEBrick::HTTPServer#start: pid=28447 port=7000

Note

  • It runs

Make a fixes link too

masa@masa /usr/lib64/ruby/site_ruby/1.9.1 $ sudo ln -s /home/masa/ywesee/ch.oddb.org/lib/fixes fixes
masa@masa /usr/lib64/ruby/site_ruby/1.9.1 $ ls -al
insgesamt 52
drwxr-xr-x 12 root root 4096 25. Jan 13:21 .
drwxr-xr-x  4 root root   48 15. Sep 12:27 ..
drwxr-xr-x  6 root root   40  8. Nov 13:35 bbmb
-rw-r--r--  1 root root  176  8. Nov 13:35 bbmb.rb
drwxr-xr-x  2 root root    8  8. Nov 14:14 cgi
drwxr-xr-x  8 root root   56  3. Nov 11:21 ebps
-rw-r--r--  1 root root   58  3. Nov 11:21 ebps.rb
lrwxrwxrwx  1 root root   39 25. Jan 13:21 fixes -> /home/masa/ywesee/ch.oddb.org/lib/fixes
drwxr-xr-x  2 root root 4096 24. Jan 16:08 odba
-rw-r--r--  1 root root  267 24. Jan 16:08 odba.rb
lrwxrwxrwx  1 root root   38 25. Jan 11:46 oddb -> /home/masa/ywesee/ch.oddb.org/lib/oddb
-rw-r--r--  2 masa masa  256 25. Jan 11:20 oddb.rb
drwxr-xr-x  2 root root    8  3. Nov 08:27 rclconf
-rw-r--r--  1 root root  102  3. Nov 08:27 rclconf.rb
drwxr-xr-x  2 root root   24 26. Okt 13:24 rrba
drwxr-xr-x  2 root root 4096  8. Nov 14:14 sbsm
drwxr-xr-x  2 root root    1  6. Sep 16:16 x86_64-linux
drwxr-xr-x  8 root root   56  8. Nov 13:53 xmlconv
drwxr-xr-x  3 root root 4096 26. Okt 13:31 ydpm

Run 'ruby1.9 start.rb'

masa@masa ~/ywesee/ramaze.ch.oddb.org $ ruby1.9 start.rb 
ERROR:  relation "object" already exists

ERROR:  relation "prefetchable_index" already exists

ERROR:  relation "extent_index" already exists

ERROR:  relation "object_connection" already exists

ERROR:  relation "target_id_index" already exists

ERROR:  relation "collection" already exists

/usr/lib64/ruby/site_ruby/1.9.1/odba/marshal.rb:15:in `load': undefined class/module ODDB::Drugs::IndexTherapeuticus (ArgumentError)
        from /usr/lib64/ruby/site_ruby/1.9.1/odba/marshal.rb:15:in `load'
        from /usr/lib64/ruby/site_ruby/1.9.1/odba/cache.rb:588:in `restore'
        from /usr/lib64/ruby/site_ruby/1.9.1/odba/cache.rb:313:in `block in fetch_or_restore'
        from /usr/lib64/ruby/site_ruby/1.9.1/odba/cache.rb:308:in `call'
        from /usr/lib64/ruby/site_ruby/1.9.1/odba/cache.rb:308:in `fetch_or_do'
        from /usr/lib64/ruby/site_ruby/1.9.1/odba/cache.rb:312:in `fetch_or_restore'
        from /usr/lib64/ruby/site_ruby/1.9.1/odba/cache.rb:62:in `block in bulk_restore'
        from /usr/lib64/ruby/site_ruby/1.9.1/odba/cache.rb:59:in `each'
        from /usr/lib64/ruby/site_ruby/1.9.1/odba/cache.rb:59:in `bulk_restore'
        from /usr/lib64/ruby/site_ruby/1.9.1/odba/cache.rb:53:in `bulk_fetch'
        from /usr/lib64/ruby/site_ruby/1.9.1/odba/cache.rb:255:in `fetch_collection'
        from /usr/lib64/ruby/site_ruby/1.9.1/odba/cache.rb:592:in `restore'
        from /usr/lib64/ruby/site_ruby/1.9.1/odba/cache.rb:313:in `block in fetch_or_restore'
        from /usr/lib64/ruby/site_ruby/1.9.1/odba/cache.rb:308:in `call'
        from /usr/lib64/ruby/site_ruby/1.9.1/odba/cache.rb:308:in `fetch_or_do'
        from /usr/lib64/ruby/site_ruby/1.9.1/odba/cache.rb:312:in `fetch_or_restore'
        from /usr/lib64/ruby/site_ruby/1.9.1/odba/cache.rb:299:in `block in fetch_named'
        from /usr/lib64/ruby/site_ruby/1.9.1/odba/cache.rb:308:in `call'
        from /usr/lib64/ruby/site_ruby/1.9.1/odba/cache.rb:308:in `fetch_or_do'
        from /usr/lib64/ruby/site_ruby/1.9.1/odba/cache.rb:291:in `fetch_named'
        from /usr/lib64/ruby/site_ruby/1.9.1/odba/cache.rb:346:in `indices'
        from /usr/lib64/ruby/site_ruby/1.9.1/odba/cache.rb:434:in `setup'
        from /usr/lib64/ruby/site_ruby/1.9.1/oddb/persistence/odba.rb:32:in `<module:ODDB>'
        from /usr/lib64/ruby/site_ruby/1.9.1/oddb/persistence/odba.rb:25:in `<top (required)>'
        from /home/masa/ywesee/ramaze.ch.oddb.org/model/init.rb:3:in `require'
        from /home/masa/ywesee/ramaze.ch.oddb.org/model/init.rb:3:in `<top (required)>'
        from /home/masa/ywesee/ramaze.ch.oddb.org/app.rb:32:in `require'
        from /home/masa/ywesee/ramaze.ch.oddb.org/app.rb:32:in `<top (required)>'
        from start.rb:7:in `require'
        from start.rb:7:in `<main>'

Note

  • The error comes because ODDB::Drugs::IndexTherapeuticus is not defined in the libraries

Search IndexTherapeuticus

masa@masa ~/ywesee/ramaze.ch.oddb.org $ grep -r IndexTherapeuticu ../oddb
../oddb/lib/oddb/drugs/index_therapeuticus.rb:    class IndexTherapeuticus < Model
../oddb/lib/oddb/persistence/odba/drugs/index_therapeuticus.rb:    class IndexTherapeuticus < Model
masa@masa ~/ywesee/ramaze.ch.oddb.org $ grep -r IndexTherapeuticu ../ch.oddb.org
masa@masa ~/ywesee/ramaze.ch.oddb.org $ 
masa@masa ~/ywesee/ramaze.ch.oddb.org $ locate index_therapeuticus.rb|grep -v bak
/home/masa/ywesee/oddb/lib/oddb/drugs/index_therapeuticus.rb
/home/masa/ywesee/oddb/lib/oddb/persistence/odba/drugs/index_therapeuticus.rb
/home/masa/ywesee/oddb.org/src/model/index_therapeuticus.rb

Note

  • IndexTherapeuticus is defined in oddb/lib/oddb/drugs/index_therapeuticus.rb or oddb.org/src/model/index_therapeuticus.rb

Check library path of Ruby 1.9 on production server

$ ruby1.9 -rpp -e "pp $:"
["/usr/lib64/ruby1.9/gems/1.9.1/gems/activesupport-2.3.3/lib",
 "/usr/lib64/ruby1.9/gems/1.9.1/gems/builder-2.1.2/lib",
 "/usr/lib64/ruby1.9/gems/1.9.1/gems/dbd-pg-0.3.8/lib",
 "/usr/lib64/ruby1.9/gems/1.9.1/gems/dbi-0.4.2/bin",
 "/usr/lib64/ruby1.9/gems/1.9.1/gems/dbi-0.4.2/lib",
 "/usr/lib64/ruby1.9/gems/1.9.1/gems/deprecated-2.0.1/lib",
 "/usr/lib64/ruby1.9/gems/1.9.1/gems/facets-1.8.54/lib",
 "/usr/lib64/ruby1.9/gems/1.9.1/gems/gd2-1.1.1/lib",
 "/usr/lib64/ruby1.9/gems/1.9.1/gems/haml-2.2.2/bin",
 "/usr/lib64/ruby1.9/gems/1.9.1/gems/haml-2.2.2/lib",
 "/usr/lib64/ruby1.9/gems/1.9.1/gems/hpricot-0.8.1/lib",
 "/usr/lib64/ruby1.9/gems/1.9.1/gems/innate-2010.07/lib",
 "/usr/lib64/ruby1.9/gems/1.9.1/gems/mechanize-0.9.3/lib",
 "/usr/lib64/ruby1.9/gems/1.9.1/gems/money-2.1.3/lib",
 "/usr/lib64/ruby1.9/gems/1.9.1/gems/nokogiri-1.3.3/lib",
 "/usr/lib64/ruby1.9/gems/1.9.1/gems/nokogiri-1.3.3/ext",
 "/usr/lib64/ruby1.9/gems/1.9.1/gems/nokogiri-1.3.3/bin",
 "/usr/lib64/ruby1.9/gems/1.9.1/gems/paypal-2.0.0/lib",
 "/usr/lib64/ruby1.9/gems/1.9.1/gems/pg-0.8.0/lib",
 "/usr/lib64/ruby1.9/gems/1.9.1/gems/rack-1.2.1/bin",
 "/usr/lib64/ruby1.9/gems/1.9.1/gems/rack-1.2.1/lib",
 "/usr/lib64/ruby1.9/gems/1.9.1/gems/ramaze-2009.10/bin",
 "/usr/lib64/ruby1.9/gems/1.9.1/gems/ramaze-2009.10/lib",
 "/usr/lib64/ruby1.9/gems/1.9.1/gems/rmagick-2.11.0/lib",
 "/usr/lib64/ruby1.9/gems/1.9.1/gems/rmagick-2.11.0/ext",
 "/usr/lib64/ruby1.9/gems/1.9.1/gems/rmagick-2.11.0/bin",
 "/usr/lib64/ruby1.9/gems/1.9.1/gems/rmail-1.0.0/lib",
 "/usr/lib64/ruby1.9/gems/1.9.1/gems/ruby-ole-1.2.10/bin",
 "/usr/lib64/ruby1.9/gems/1.9.1/gems/ruby-ole-1.2.10/lib",
 "/usr/lib64/ruby1.9/gems/1.9.1/gems/rubyzip-0.9.4/lib",
 "/usr/lib64/ruby1.9/gems/1.9.1/gems/spreadsheet-0.6.4/bin",
 "/usr/lib64/ruby1.9/gems/1.9.1/gems/spreadsheet-0.6.4/lib",
 "/usr/lib64/ruby1.9/gems/1.9.1/gems/turing-0.0.11/lib",
 "/usr/lib64/ruby1.9/site_ruby/1.9.1",
 "/usr/lib64/ruby1.9/site_ruby/1.9.1/x86_64-linux",
 "/usr/lib64/ruby1.9/site_ruby",
 "/usr/lib64/ruby1.9/vendor_ruby/1.9.1",
 "/usr/lib64/ruby1.9/vendor_ruby/1.9.1/x86_64-linux",
 "/usr/lib64/ruby1.9/vendor_ruby",
 "/usr/lib64/ruby1.9/1.9.1",
 "/usr/lib64/ruby1.9/1.9.1/x86_64-linux",
 "."]

Note

  • It is same as local

Check /usr/lib64/ruby1.9/site_ruby/1.9.1

/usr/lib64/ruby1.9/site_ruby/1.9.1 $ ls -al
total 16
drwxr-xr-x 4 root root 4096 2010-02-22 15:00 .
drwxr-xr-x 3 root root   16 2009-07-30 14:34 ..
lrwxrwxrwx 1 root root   32 2009-07-31 13:58 cgi -> /home/ywesee/cogito/sbsm/lib/cgi
lrwxrwxrwx 1 root root   34 2010-02-08 15:59 ebps -> /home/ywesee/cogito/ebps/lib/ebps/
lrwxrwxrwx 1 root root   33 2010-02-22 15:00 ebps.rb -> /home/ywesee/git/ebps/lib/ebps.rb
lrwxrwxrwx 1 root root   41 2009-07-31 14:00 fixes -> /home/ywesee/cogito/ch.oddb.org/lib/fixes
drwxr-xr-x 2 root root 4096 2009-08-03 11:29 htmlgrid
-rw-r--r-- 1 root root    0 2009-07-30 14:34 .keep_dev-lang_ruby-1.9
lrwxrwxrwx 1 root root   33 2009-07-31 14:27 odba -> /home/ywesee/cogito/odba/lib/odba
lrwxrwxrwx 1 root root   36 2009-07-31 14:27 odba.rb -> /home/ywesee/cogito/odba/lib/odba.rb
lrwxrwxrwx 1 root root   37 2009-12-18 17:54 oddb -> /home/ywesee/git/ch.oddb.org/lib/oddb
lrwxrwxrwx 1 root root   40 2009-12-18 17:54 oddb.rb -> /home/ywesee/git/ch.oddb.org/lib/oddb.rb
lrwxrwxrwx 1 root root   39 2009-07-31 13:58 rclconf -> /home/ywesee/cogito/rclconf/lib/rclconf
lrwxrwxrwx 1 root root   42 2009-07-31 13:58 rclconf.rb -> /home/ywesee/cogito/rclconf/lib/rclconf.rb
lrwxrwxrwx 1 root root   33 2009-07-31 13:58 sbsm -> /home/ywesee/cogito/sbsm/lib/sbsm
drwxr-xr-x 2 root root   16 2009-07-31 14:20 x86_64-linux
lrwxrwxrwx 1 root root   33 2009-07-31 14:23 ydim -> /home/ywesee/cogito/ydim/lib/ydim
lrwxrwxrwx 1 root root   31 2009-07-31 14:21 yus -> /home/ywesee/cogito/yus/lib/yus

Restore the database

masa@masa ~/ywesee/ramaze.ch.oddb.org $ sudo -u postgres dropdb ch_oddb_org
masa@masa ~/ywesee/ramaze.ch.oddb.org $ vim ../setup.postgresql.sh 
masa@masa ~/ywesee/ramaze.ch.oddb.org $ sudo -u postgres createdb -E UTF8 -T template0 ch_oddb_org
masa@masa ~/ywesee/ramaze.ch.oddb.org $ zcat postgresql_database-ch_oddb_org-backup_20110120.gz | psql -U postgres ch_oddb_org

Result

masa@masa ~/ywesee/ramaze.ch.oddb.org $ ruby1.9 start.rb
ERROR:  relation "object" already exists

ERROR:  relation "prefetchable_index" already exists

ERROR:  relation "extent_index" already exists

ERROR:  relation "object_connection" already exists

ERROR:  relation "target_id_index" already exists

ERROR:  relation "collection" already exists

ERROR:  relation "target_id_oddb_drugs_atc_code" already exists

ERROR:  relation "target_id_oddb_drugs_atc_name" already exists

ERROR:  relation "target_id_oddb_drugs_unit_name" already exists

ERROR:  relation "target_id_oddb_drugs_package_atc" already exists

ERROR:  relation "target_id_oddb_drugs_package_code" already exists

ERROR:  relation "target_id_oddb_drugs_package_name" already exists

ERROR:  relation "target_id_oddb_drugs_product_name" already exists

ERROR:  relation "target_id_oddb_business_invoice_id" already exists

ERROR:  relation "target_id_oddb_drugs_sequence_code" already exists

ERROR:  relation "target_id_oddb_drugs_substance_code" already exists

ERROR:  relation "target_id_oddb_drugs_substance_name" already exists

ERROR:  relation "target_id_oddb_text_document_source" already exists

ERROR:  relation "target_id_oddb_business_company_name" already exists

ERROR:  relation "target_id_oddb_drugs_package_company" already exists

ERROR:  relation "target_id_oddb_drugs_package_product" already exists

ERROR:  relation "target_id_oddb_drugs_galenicform_code" already exists

ERROR:  relation "target_id_oddb_drugs_sequence_product" already exists

ERROR:  relation "target_id_oddb_drugs_galenicgroup_name" already exists

ERROR:  relation "target_id_oddb_drugs_package_substance" already exists

ERROR:  relation "target_id_oddb_drugs_atc_level_and_code" already exists

ERROR:  relation "target_id_oddb_business_invoice_yus_name" already exists

ERROR:  relation "target_id_oddb_drugs_substancegroup_name" already exists

ERROR:  relation "target_id_oddb_regulatory_authority_name" already exists

ERROR:  relation "target_id_oddb_regulatory_registration_code" already exists

ERROR:  relation "target_id_oddb_drugs_galenicform_description" already exists

ERROR:  relation "target_id_oddb_drugs_sequence_fachinfo_indications_de" already exists

D [2011-01-25 14:24:46 $31196] DEBUG | : Using webrick
I [2011-01-25 14:24:46 $31196]  INFO | : WEBrick 1.3.1
I [2011-01-25 14:24:46 $31196]  INFO | : ruby 1.9.2 (2010-07-11) [x86_64-linux]
D [2011-01-25 14:24:46 $31196] DEBUG | : TCPServer.new(0.0.0.0, 7000)
D [2011-01-25 14:24:46 $31196] DEBUG | : Rack::Handler::WEBrick is mounted on /.
I [2011-01-25 14:24:46 $31196]  INFO | : WEBrick::HTTPServer#start: pid=31196 port=7000

Note

  • Works!!

Summary

  • The start up process makes (a lot of) something new, creating a new object and save it on the database through ODBA, depending on libraries
    • At the first time, I used 'oddb' library instead of 'ch.oddb.org/lib/oddb' library
    • Then it worked but the the data looked on browser was different
    • The error, ODDB::Drugs::IndexTherapeuticus, came when I changed the library, 'ch.oddb.org/lib/oddb'
    • After the restoring of the data on PostgreSQL, the error has gone

Memo

  • The following command also works as well even if there is no library link on the Ruby library path, fixes and oddb symbolic links in /usr/lib64/ruby/site_ruby/1.9.1
 masa@masa ~/ywesee/ramaze.ch.oddb.org $ ruby1.9 -I /home/masa/ywesee/ch.oddb.org/lib start.rb

Set up ODDB v3.0 for Ruby 1.9

Reference

Set up ramaze version oddb on Ubuntu

Reference (Summary)

Confirm the current status

Check Ruby version

masa@masa-VirtualBox:~$ ruby -v
ruby 1.8.6 (2009-06-08 patchlevel 369) [i686-linux]

Check gem list

masa@masa-VirtualBox:~$ gem list

*** LOCAL GEMS ***

dbd-pg (0.3.9)
dbi (0.4.5)
de.oddb (2.0.0)
deprecated (2.0.1)
facets (1.8.54)
odba (1.0.0)
pg (0.9.0)
rclconf (1.0.0)

Check oddbd run

masa@masa-VirtualBox:~$ oddbd
/var/lib/gems/1.8/gems/de.oddb-2.0.0/lib/oddb.rb:4: warning: already initialized constant VERSION
/var/lib/gems/1.8/gems/dbi-0.4.5/lib/dbi.rb:300:in `load_driver': Unable to load driver 'pg' (underlying error: wrong constant name pg) (DBI::InterfaceError)
	from /home/masa/bin/lib/ruby/1.8/monitor.rb:242:in `synchronize'
	from /var/lib/gems/1.8/gems/dbi-0.4.5/lib/dbi.rb:242:in `load_driver'
	from /var/lib/gems/1.8/gems/dbi-0.4.5/lib/dbi.rb:160:in `_get_full_driver'
	from /var/lib/gems/1.8/gems/dbi-0.4.5/lib/dbi.rb:145:in `connect'
	from /var/lib/gems/1.8/gems/odba-1.0.0/lib/odba/connection_pool.rb:60:in `_connect'
	from /var/lib/gems/1.8/gems/odba-1.0.0/lib/odba/connection_pool.rb:59:in `times'
	from /var/lib/gems/1.8/gems/odba-1.0.0/lib/odba/connection_pool.rb:59:in `_connect'
	from /var/lib/gems/1.8/gems/odba-1.0.0/lib/odba/connection_pool.rb:56:in `connect'
	from /var/lib/gems/1.8/gems/odba-1.0.0/lib/odba/connection_pool.rb:56:in `synchronize'
	from /var/lib/gems/1.8/gems/odba-1.0.0/lib/odba/connection_pool.rb:56:in `connect'
	from /var/lib/gems/1.8/gems/odba-1.0.0/lib/odba/connection_pool.rb:19:in `initialize'
	from /var/lib/gems/1.8/gems/de.oddb-2.0.0/lib/oddb/persistence/odba.rb:29:in `new'
	from /var/lib/gems/1.8/gems/de.oddb-2.0.0/lib/oddb/persistence/odba.rb:29
	from /usr/lib/ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
	from /usr/lib/ruby/1.8/rubygems/custom_require.rb:31:in `require'
	from /var/lib/gems/1.8/gems/de.oddb-2.0.0/lib/oddb/persistence.rb:4
	from /usr/lib/ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
	from /usr/lib/ruby/1.8/rubygems/custom_require.rb:31:in `require'
	from /var/lib/gems/1.8/gems/de.oddb-2.0.0/bin/oddbd:10
	from /var/lib/gems/1.8/bin/oddbd:19:in `load'
	from /var/lib/gems/1.8/bin/oddbd:19

Check PostgreSQL

masa@masa-VirtualBox:~$ psql -U postgres
psql: FATAL:  ???"postgres"?Ident?????????

Note

  • psql command does not work

This works

$ sudo -u postgres psql

Check postgres version

masa@masa-VirtualBox:~$ psql --version
psql (PostgreSQL) 8.4.6

Check tables

masa@masa-VirtualBox:~$ sudo -u postgres psql
psql (8.4.6)

postgres=# \l
-----------+----------+------------------+------------+-------------------+-----------------------
 postgres  | postgres | UTF8             | ja_JP.utf8 | ja_JP.utf8        | 
 template0 | postgres | UTF8             | ja_JP.utf8 | ja_JP.utf8        | =c/postgres
                                                                          : postgres=CTc/postgres
 template1 | postgres | UTF8             | ja_JP.utf8 | ja_JP.utf8        | =c/postgres
                                                                          : postgres=CTc/postgres
 testdb    | postgres | UTF8             | ja_JP.utf8 | ja_JP.utf8        | 

postgres=# 

Note

  • There is no 'oddb' (for de.oddb.org)
view · edit · sidebar · attach · print · history
Page last modified on January 25, 2011, at 04:59 PM