view · edit · sidebar · attach · print · history

20120601-setup-ch-oddb-org

<< | Index | >>


Summary

  • setup Apache and mod_ruby
    • fixed multi-thread probelm.
    • checked httpd.conf
  • setup postgres db for oddb.org

Index


apach2 and mod_ruby

Apache has some error that it related with mod_ruby.
I tried following versions.

Ruby (--enable-shared)
  • ruby-1.9.3-p0
  • ruby-1.9.3-p194
  • ruby-1.9.3-p194-r1 (via emerged)

Apache:

  • 2.2.22-r1 (via emerged)
[Fri Jun 01 09:17:24 2012] [notice] Apache/2.2.22 (Unix) mod_ssl/2.2.22 OpenSSL/1.0.1c mod_ruby/1.3.0 configured -- resuming normal operations
[Fri Jun 01 09:17:25 2012] [notice] child pid 31820 exit signal Segmentation fault (11)
[Fri Jun 01 09:17:25 2012] [notice] child pid 31821 exit signal Segmentation fault (11)
[Fri Jun 01 09:17:27 2012] [notice] child pid 31833 exit signal Segmentation fault (11)
[Fri Jun 01 09:17:29 2012] [notice] child pid 31836 exit signal Segmentation fault (11)

ldd mod_ruby.so

$ ldd /usr/lib/apache2/modules/mod_ruby.so 
        linux-vdso.so.1 =>  (0x00007fff7351a000)
        libruby19.so.1.9 => /usr/lib64/libruby19.so.1.9 (0x00007fd6b62f9000)
        libpthread.so.0 => /lib64/libpthread.so.0 (0x00007fd6b60c7000)
        librt.so.1 => /lib64/librt.so.1 (0x00007fd6b5ebe000)
        libdl.so.2 => /lib64/libdl.so.2 (0x00007fd6b5cba000)
        libcrypt.so.1 => /lib64/libcrypt.so.1 (0x00007fd6b5a83000)
        libm.so.6 => /lib64/libm.so.6 (0x00007fd6b5800000)
        libc.so.6 => /lib64/libc.so.6 (0x00007fd6b5478000)
        /lib64/ld-linux-x86-64.so.2 (0x00007fd6b6934000)

core dump of apache

  • $ ulimit -a
  • $ ulimit -c 262144
  • /etc/apach2/httpd.conf
CoreDumpDirectory /tmp/

$ sudo gdb /usr/sbin/apache2 -c /tmp/core

GNU gdb (Gentoo 7.4.1 p1) 7.4.1
Copyright (C) 2012 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-pc-linux-gnu".
For bug reporting instructions, please see:
<http://bugs.gentoo.org/>...
Reading symbols from /usr/sbin/apache2...(no debugging symbols found)...done.
[New LWP 1122]
[New LWP 1121]
[New LWP 1123]

warning: Can't read pathname for load map: Input/output error.
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".
Core was generated by `/usr/sbin/apache2 -D DEFAULT_VHOST -D INFO -D RUBY -D SSL -D SSL_DEFAULT_VHOST'.
Program terminated with signal 11, Segmentation fault.
#0  0x00007f97a12ac0b0 in ?? () from /usr/lib64/libruby19.so.1.9
(gdb) where
#0  0x00007f97a12ac0b0 in ?? () from /usr/lib64/libruby19.so.1.9
#1  0x00007f97a12ac1c9 in ?? () from /usr/lib64/libruby19.so.1.9
#2  0x00007f97a12adb0f in ?? () from /usr/lib64/libruby19.so.1.9
#3  0x00007f97a12ae700 in rb_newobj () from /usr/lib64/libruby19.so.1.9
#4  0x00007f97a12aea12 in rb_node_newnode () from /usr/lib64/libruby19.so.1.9
#5  0x00007f97a12e4e64 in ?? () from /usr/lib64/libruby19.so.1.9
#6  0x00007f97a12ed6b5 in ?? () from /usr/lib64/libruby19.so.1.9
#7  0x00007f97a12fb5fc in ?? () from /usr/lib64/libruby19.so.1.9
#8  0x00007f97a139757d in ?? () from /usr/lib64/libruby19.so.1.9
#9  0x00007f97a12e9fcc in rb_parser_compile_file () from /usr/lib64/libruby19.so.1.9
#10 0x00007f97a13345c5 in ?? () from /usr/lib64/libruby19.so.1.9
#11 0x00007f97a129cc0b in rb_ensure () from /usr/lib64/libruby19.so.1.9
#12 0x00007f97a13349e9 in rb_load_file () from /usr/lib64/libruby19.so.1.9
#13 0x00007f97a129e495 in ?? () from /usr/lib64/libruby19.so.1.9
#14 0x00007f97a129f8af in rb_require_safe () from /usr/lib64/libruby19.so.1.9
#15 0x00007f97a138e711 in ?? () from /usr/lib64/libruby19.so.1.9
#16 0x00007f97a13856f2 in ?? () from /usr/lib64/libruby19.so.1.9
#17 0x00007f97a138b04d in ?? () from /usr/lib64/libruby19.so.1.9
#24 0x00007f97a1392318 in rb_iseq_eval () from /usr/lib64/libruby19.so.1.9
#25 0x00007f97a1334e11 in ?? () from /usr/lib64/libruby19.so.1.9
#26 0x00007f97a13356c0 in ruby_process_options () from /usr/lib64/libruby19.so.1.9
#27 0x00007f97a129d859 in ruby_options () from /usr/lib64/libruby19.so.1.9
#28 0x00007f97a165ef36 in ruby_init_interpreter () from /usr/lib64/apache2/modules/mod_ruby.so
#29 0x00007f97a165f159 in ruby_thread_start () from /usr/lib64/apache2/modules/mod_ruby.so
#30 0x00007f97a7111e6c in start_thread () from /lib64/libpthread.so.0
#31 0x00007f97a6c52b1d in clone () from /lib64/libc.so.6
(gdb) 

Refs.

Multi thread problem

I have mod_ruby(compiled ruby 1.9.3, 1.8.6) and Apache 2.2.21 on 32bit Gentoo.
I have compared compile environment, version, compile option, USE flag, config files,

Found problem.
currentyl mod_ruby does not have support for multi-thread of Apache.

This time, I emerge apache2 with USE=threads on.
Then I re-installed apache with -threads.

Error has gone :-D

$ equery uses apache

...
 - - threads                         : Adds threads support for various packages. Usually pthreads

vhost.d/ch.oddb.org.conf

# ch.oddb.org
<Directory /var/www/oddb.org/doc>
  Options ExecCGI FollowSymlinks Indexes
  AllowOverride None
  Order allow,deny
  Allow from all
</Directory>
<Directory /var/www/oddb.org/data/css>
  Order allow,deny
  Allow from all
</Directory>
<Directory /var/www/oddb.org/data/rss>
  Order allow,deny
  Allow from all
</Directory>
<VirtualHost *:80>
  DocumentRoot /var/www/oddb.org/doc
  ServerName ch.oddb.yasuhiro.org
  # Ruby 1.9.3
  SetHandler ruby-object
  DirectoryIndex index.rbx
  SetEnv DEFAULT_FLAVOR gcc 
  RubyAddPath /var/www/oddb.org/src
  RubyAddPath /usr/local/lib/ruby/gems/1.9.1/gems/sbsm-1.1.8/lib
  RubyRequire 'util/trans_handler'
  RubyTransHandler ODDB::FlavoredTransHandler.instance
</VirtualHost>

It works.


postgres

ch.oddb.org
$ su postgres
$ createuser oddb
$ createdb -E UTF8 -T template0 oddb.org.ruby193
  • restored from production server with getdb script.
yus
$ su postgres
$ createuser yus
$ createdb -E UTF8 -T template0 yus

yus gem install via Ruby 1.8.7 and following gems (dependency)

  • Gemfile
  • git clone ssh://ywesee@scm.ywesee.com/home/ywesee/git/yus
  • create yus.yml into /etc/yus/yus.yml
  • generate yus_rsa and crt into /etc/yus/data
openssl req -new -x509 -key ./yus_rsa -out ./yus.crt
$ yus_add_user yasaka@ywesee.com login org.oddb.RootUser
Password for yasaka@ywesee.com
New Password for yasaka@ywesee.com: 
Repeat Password for yasaka@ywesee.com: 
  • $ yus_grant yasaka@ywesee.com edit yus.entities
  • $ yus_grant yasaka@ywesee.com edit org.oddb.drugs
  • run with yusd

quanty

  • require racc gem (I installed 1.4.8)
  • use Ruby 1.8.7 (ruby 1.8.7 (2012-02-08 patchlevel 358) [x86_64-linux])
$ mkdir /var/www/oddb.org/data/pdf
$ cd /var/www/oddb.org/data/quanty
$ ruby extconf.rb 
$ make
ruby mkdump.rb lib/quanty/units.dump
$ make install
lib//quanty.rb -> /home/yasuhiro/Documents/workspace/ywesee/var/ch.oddb.org/src/util//quanty.rb
chmod 0644 /home/yasuhiro/Documents/workspace/ywesee/var/ch.oddb.org/src/util//quanty.rb
lib/quanty/main.rb -> /home/yasuhiro/Documents/workspace/ywesee/var/ch.oddb.org/src/util/quanty/main.rb
chmod 0644 /home/yasuhiro/Documents/workspace/ywesee/var/ch.oddb.org/src/util/quanty/main.rb
lib/quanty/fact.rb -> /home/yasuhiro/Documents/workspace/ywesee/var/ch.oddb.org/src/util/quanty/fact.rb
chmod 0644 /home/yasuhiro/Documents/workspace/ywesee/var/ch.oddb.org/src/util/quanty/fact.rb
lib/quanty/parse.rb -> /home/yasuhiro/Documents/workspace/ywesee/var/ch.oddb.org/src/util/quanty/parse.rb
chmod 0644 /home/yasuhiro/Documents/workspace/ywesee/var/ch.oddb.org/src/util/quanty/parse.rb
lib/quanty/units.dump -> /home/yasuhiro/Documents/workspace/ywesee/var/ch.oddb.org/src/util/quanty/units.dump
chmod 0644 /home/yasuhiro/Documents/workspace/ywesee/var/ch.oddb.org/src/util/quanty/units.dum
  • check shebang(encoding: utf-8) in /src/util/quanty/*.rb files

paypal gem

require 'active_support/core_ext/class/attribute_accessors'

Refs.


DBI gem patches

columninfo.rb
$ curl -O http://dev.ywesee.com/uploads/att/columninfo.rb.patch.20111123.txt
$ patch /path/to/gems/dbi-0.4.5/lib/dbi/columninfo.rb ./columninfo.rb.patch.20111123.txt --dry-run
$ patch /path/to/gems/dbi-0.4.5/lib/dbi/columninfo.rb ./columninfo.rb.patch.20111123.txt
row.rb
$ curl -O http://dev.ywesee.com/uploads/att/row.rb.patch.20111125.txt
$ patch /path/to/gems/dbi-0.4.5/lib/dbi/row.rb ./row.rb.patch.20111125.txt --dry-run
$ patch /path/to/gems/dbi-0.4.5/lib/dbi/row.rb ./row.rb.patch.20111125.txt
statement.rb
$ curl -O http://dev.ywesee.com/uploads/att/statement.rb.patch.20120604.txt
$ patch /path/to/gems/dbi-0.4.5/lib/dbi/handles/statement.rb ./statement.rb.patch.20120604.txt --dry-run
$ patch /path/to/gems/dbi-0.4.5/lib/dbi/handles/statement.rb ./statement.rb.patch.20120604.txt

Ruby patches

csv patch
$ curl -O http://dev.ywesee.com/uploads/att/csv.rb.patch.20111123.txt
$ patch /path/to/ruby/1.9.1/csv.rb ./csv.rb.patch.20111123.txt --dry-run
$ patch /path/to/ruby/1.9.1/csv.rb ./csv.rb.patch.20111123.txt
rexml patches
$ cd /path/to/lib/ruby/1.9.1/rexml 
$ patch rexml/parsers/baseparser.rb < ~/path/to/patch/baseparser.rb.patch.20111124.txt --dry-run
patching file rexml/parsers/baseparser.rb
Hunk #1 succeeded at 431 (offset -4 lines).
$ patch rexml/parsers/baseparser.rb < /path/to/patch/baseparser.rb.patch.20111124.txt
patching file rexml/parsers/baseparser.rb
Hunk #1 succeeded at 431 (offset -4 lines).
$ cd /path/to/lib/ruby/1.9.1/rexml 
$ patch source.rb < /path/to/patch/source.rb.patch.20111124.txt --dry-run
patching file rexml/source.rb
$ patch source.rb < /path/to/patch/source.rb.patch.20111124.txt
patching file rexml/source.rb

config files

db_connection.rb
  • /etc/db_connection.rb
oddb.yaml
  • /etc/oddb.yml
testenvironment1.rb
  • test/testenvironment1.rb
testenvironment2.rb
  • test/testenvironment2.rb

Resources

sponsor

$ scp -r ywesee@thinpower.ywesee.com:/var/www/oddb.org/doc/resources/sponsor .

robots
  • doc/robots-disallow.txt
css

$ ruby bin/update_css

dojo
$ cd /var/www/oddb.org/doc/resources
$ curl -O http://download.dojotoolkit.org/release-1.7.2/dojo-release-1.7.2.tar.gz
  • build compress as dojo

Refs.

NOTE
  • setup script (without dojo build)

Migel

$ su - postgres
$ createuser migel
$ createdb -E UTF-8 -T template0 migel
view · edit · sidebar · attach · print · history
Page last modified on July 03, 2013, at 05:44 AM