view · edit · sidebar · attach · print · history

20130614-setup-xmlconv-in-fastpower

<< | Index | >>


Summary

  • Setup
    • sandoz.bbmb.ch
    • sandoz.xmlconv.bbmb.ch
    • globopharm.xmlconv.bbmb.ch

Commits

Index


Setup rockit

rockit source files are here.

link


pg driver xmlconv

/usr/local/bin/ruby186/lib/ruby/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 /usr/local/bin/ruby186/lib/ruby/1.8/monitor.rb:242:in `synchronize'
        from /usr/local/bin/ruby186/lib/ruby/gems/1.8/gems/dbi-0.4.5/lib/dbi.rb:242:in
`load_driver'
        from /usr/local/bin/ruby186/lib/ruby/gems/1.8/gems/dbi-0.4.5/lib/dbi.rb:160:in
`_get_full_driver'
        from /usr/local/bin/ruby186/lib/ruby/gems/1.8/gems/dbi-0.4.5/lib/dbi.rb:145:in
`connect'
        from /usr/local/bin/ruby186/lib/ruby/gems/1.8/gems/odba-1.1.0/lib/odba/connection_pool.rb:63:in
`_connect'
        from /usr/local/bin/ruby186/lib/ruby/gems/1.8/gems/odba-1.1.0/lib/odba/connection_pool.rb:62:in
`times'
        from /usr/local/bin/ruby186/lib/ruby/gems/1.8/gems/odba-1.1.0/lib/odba/connection_pool.rb:62:in
`_connect'
        from /usr/local/bin/ruby186/lib/ruby/gems/1.8/gems/odba-1.1.0/lib/odba/connection_pool.rb:59:in
`connect'
        from /usr/local/bin/ruby186/lib/ruby/gems/1.8/gems/odba-1.1.0/lib/odba/connection_pool.rb:59:in
`synchronize'
        from /usr/local/bin/ruby186/lib/ruby/gems/1.8/gems/odba-1.1.0/lib/odba/connection_pool.rb:59:in
`connect'
        from /usr/local/bin/ruby186/lib/ruby/gems/1.8/gems/odba-1.1.0/lib/odba/connection_pool.rb:22:in
`initialize'
        from /var/www/globopharm.xmlconv.bbmb.ch/bin/xmlconvd:30:in `new'
        from /var/www/globopharm.xmlconv.bbmb.ch/bin/xmlconvd:30
commit

Read xmlconv

sandoz.xmlconv.bbmb.ch uses xmlconv (not ver.2)


postgres permission problem

Checked groups and users for postgreSQL


convert globophrm xml

I wrote small convert script.

#!/usr/local/bin/ruby186/bin/ruby

require 'rubygems'

$: << '/usr/local/share/src/xmlconv/lib'

require 'lib/conversion/pharmacieplus_bdd'
require 'lib/conversion/bdd_i2'

source_xml = ARGV.first

reader = XmlConv::Conversion::PharmaciePlusBdd
input  = reader.parse(File.read(source_xml))
model  = reader.convert(input)
writer = XmlConv::Conversion::BddI2
output = writer.convert(model)

print output.to_s

Usage

$ cd /var/www/globopharm.xmlconv.bbmb.ch
$ ./convert.rb ./pharmacie_plus_1.xml > result.txt

This makes these result.

001:7601001002135
002:ORDERX
003:220
010:CO_000000000131300_201306140558.dat
100:YWESEEPP
101:1313
201:CU
202:7601001014541
201:BY
202:1075
201:DP
...

Create pp2txt gem

The converter script needs

  • xmlconv
  • sandozxmlconv

sandozxmlconv and xmlconv gems need Updates.

sandozxmlconv gem
% grep -r Oddb .  
./lib/sandozxmlconv.rb:class Oddb.org

suspend


Check the DNS status

Note of current status.

sandoz.xmlconv.bbmb.ch

% dig sandoz.xmlconv.bbmb.ch

; <<>> DiG 9.9.2-P2 <<>> sandoz.xmlconv.bbmb.ch
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 52386
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 2, ADDITIONAL: 2

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4096
;; QUESTION SECTION:
;sandoz.xmlconv.bbmb.ch.                IN      A

;; ANSWER SECTION:
sandoz.xmlconv.bbmb.ch. 86400   IN      A       62.12.131.46

;; AUTHORITY SECTION:
bbmb.ch.                3600    IN      NS      ns1.bbmb.ch.
bbmb.ch.                3600    IN      NS      ns2.bbmb.ch.

;; ADDITIONAL SECTION:
ns1.bbmb.ch.            3600    IN      A       62.12.131.38

;; Query time: 323 msec
;; SERVER: 192.168.128.1#53(192.168.128.1)
;; WHEN: Fri Jun 14 16:32:37 2013
;; MSG SIZE  rcvd: 119

sandoz.bbmb.ch

% dig sandoz.bbmb.ch        

; <<>> DiG 9.9.2-P2 <<>> sandoz.bbmb.ch
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 42885
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 2, ADDITIONAL: 2

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4096
;; QUESTION SECTION:
;sandoz.bbmb.ch.                        IN      A

;; ANSWER SECTION:
sandoz.bbmb.ch.         86400   IN      A       62.12.131.46

;; AUTHORITY SECTION:
bbmb.ch.                3600    IN      NS      ns2.bbmb.ch.
bbmb.ch.                3600    IN      NS      ns1.bbmb.ch.

;; ADDITIONAL SECTION:
ns1.bbmb.ch.            3600    IN      A       62.12.131.38

;; Query time: 336 msec
;; SERVER: 192.168.128.1#53(192.168.128.1)
;; WHEN: Fri Jun 14 16:46:27 2013
;; MSG SIZE  rcvd: 111

Setup yus

Installed `needle` gem.
Other gems are already there in Fastpower againt ruby 1.8.6.

yus have also pg problem

yasaka@fastpower /usr/local/share/src/yus $ sudo /usr/local/bin/ruby186/bin/ruby -rrubygems ./bin/yusd server_url="druby://localhost:12001"
/usr/local/share/src/yus/lib/yus/server.rb:9: warning: already initialized constant VERSION
/usr/local/bin/ruby186/lib/ruby/gems/1.8/gems/dbi-0.4.5/lib/dbi.rb:300:in `load_driver': Unable to load driver 'pg' (underlyingrror: wrong constant name pg) (DBI::InterfaceError)
        from /usr/local/bin/ruby186/lib/ruby/1.8/monitor.rb:242:in `synchronize'
        from /usr/local/bin/ruby186/lib/ruby/gems/1.8/gems/dbi-0.4.5/lib/dbi.rb:242:in `load_driver'
        from /usr/local/bin/ruby186/lib/ruby/gems/1.8/gems/dbi-0.4.5/lib/dbi.rb:160:in `_get_full_driver'
        from /usr/local/bin/ruby186/lib/ruby/gems/1.8/gems/dbi-0.4.5/lib/dbi.rb:145:in `connect'
        from /usr/local/bin/ruby186/lib/ruby/gems/1.8/gems/odba-1.1.0/lib/odba/connection_pool.rb:63:in `_connect'
        from /usr/local/bin/ruby186/lib/ruby/gems/1.8/gems/odba-1.1.0/lib/odba/connection_pool.rb:62:in `times'
        from /usr/local/bin/ruby186/lib/ruby/gems/1.8/gems/odba-1.1.0/lib/odba/connection_pool.rb:62:in `_connect'
        from /usr/local/bin/ruby186/lib/ruby/gems/1.8/gems/odba-1.1.0/lib/odba/connection_pool.rb:59:in `connect'
        from /usr/local/bin/ruby186/lib/ruby/gems/1.8/gems/odba-1.1.0/lib/odba/connection_pool.rb:59:in `synchronize'
        from /usr/local/bin/ruby186/lib/ruby/gems/1.8/gems/odba-1.1.0/lib/odba/connection_pool.rb:59:in `connect'
        from /usr/local/bin/ruby186/lib/ruby/gems/1.8/gems/odba-1.1.0/lib/odba/connection_pool.rb:22:in `initialize'
        from ./bin/yusd:50:in `new'
        from ./bin/yusd:50
% grep -r pg bin 
bin/yusd:  ODBA.storage.dbi = ODBA::ConnectionPool.new("DBI:pg:#{config.db_name}",
commit

sandoz.bbmb.ch

It works with bbmb user.

yasaka@fastpower /var/www/sandoz.bbmb.ch $ sudo -u bbmb /usr/local/bin/ruby186/bin/ruby -rrubygems /usr/local/share/src/yus/bin/yusd config="/var/www/sandoz.bbmb.ch/etc/yus.yml"

created run script for daemontool.
yusd process works with git version (in "/usr/local/share/src/yus" )
application process works via gem version. (via rubygems)

  • sandoz.bbmb.ch
  • virbac.bbmb.ch
  • vetoquinol.bbmb.ch
yasaka@fastpower /service $ ls -la
...
lrwxrwxrwx  1 root root   32 Jun 13 09:15 sandoz.bbmb.ch -> /var/www/sandoz.bbmb.ch/svc/bbmb
lrwxrwxrwx  1 root root   31 Jun 14 19:41 sandoz.bbmb.ch-yus -> /var/www/sandoz.bbmb.ch/svc/yus
lrwxrwxrwx  1 root root   35 Jun 13 06:42 sandoz.xmlconv.bbmb.ch -> /var/www/sandoz.xmlconv.bbmb.ch/svc
...
yasaka@fastpower /service $ sudo svc -u /service/sandoz.bbmb.ch-yus
yasaka@fastpower /service $ sudo svstat /service/sandoz.bbmb.ch-yus
/service/sandoz.bbmb.ch-yus/: up (pid 32454) 38 seconds

Note

druby ports.

  • sandoz.bbmb.ch ---> druby://localhost:12005
  • virbac.bbmb.ch ---> druby://localhost:12003
  • vetoquinol.bbmb.ch ---> druby://localhost:12001

link


Debug email address problem

Application process has a problem for e-mail.

sandoz.xmlconv.bbmb.ch
@4000000051bb5c151dc1be94 E, [2013-06-14T20:08:11.499198 #349] ERROR -- XmlConv2: Errno::ECONNREFUSED
@4000000051bb5c151dc1c27c Connection refused - connect(2)
@4000000051bb5c151dc1c27c /usr/local/bin/ruby186/lib/ruby/1.8/net/protocol.rb:206:in `initialize'
@4000000051bb5c151dc1c664 /usr/local/bin/ruby186/lib/ruby/1.8/net/protocol.rb:206:in `new'
@4000000051bb5c151dc1c664 /usr/local/bin/ruby186/lib/ruby/1.8/net/protocol.rb:206:in `old_open'
@4000000051bb5c151dc1ca4c /usr/local/bin/ruby186/lib/ruby/1.8/timeout.rb:62:in `timeout'
@4000000051bb5c151dc1d9ec /usr/local/bin/ruby186/lib/ruby/1.8/timeout.rb:93:in `timeout'
@4000000051bb5c151dc1ddd4 /usr/local/bin/ruby186/lib/ruby/1.8/net/protocol.rb:206:in `old_open'
@4000000051bb5c151dc1e1bc /usr/local/bin/ruby186/lib/ruby/1.8/net/smtp.rb:392:in `do_start'
@4000000051bb5c151dc1e1bc /usr/local/bin/ruby186/lib/ruby/1.8/net/smtp.rb:377:in `start'
@4000000051bb5c151dc1e5a4 /usr/local/bin/ruby186/lib/ruby/1.8/net/smtp.rb:315:in `start'
@4000000051bb5c151dc1ed74 /usr/local/share/src/xmlconv/lib/xmlconv/util/mail.rb:25:in `notify'
@4000000051bb5c151dc1ed74 /usr/local/share/src/xmlconv/lib/xmlconv/util/polling_manager.rb:192:in `poll_sources'
@4000000051bb5c151dc1f15c /usr/local/share/src/xmlconv/lib/xmlconv/util/polling_manager.rb:178:in `call'
@4000000051bb5c151dc1f15c /usr/local/share/src/xmlconv/lib/xmlconv/util/polling_manager.rb:178:in `load_sources'
...

If email change to my email, this error is gone. (It works fine)

Note

DNS Record for sandoz.xmlconv.bbmb.ch is old. (whitie)

% dig sandoz.xmlconv.bbmb.ch

; <<>> DiG 9.9.1-P2 <<>> sandoz.xmlconv.bbmb.ch
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 61383
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0

;; QUESTION SECTION:
;sandoz.xmlconv.bbmb.ch.                IN      A

;; ANSWER SECTION:
sandoz.xmlconv.bbmb.ch. 30302   IN      A       62.12.131.35

;; Query time: 0 msec
;; SERVER: 10.0.1.1#53(10.0.1.1)
;; WHEN: Sat Jun 15 03:44:26 2013
;; MSG SIZE  rcvd: 56

Debug apache2 error

Apache2 does not boot yet expectedly.

fastpower sandoz.bbmb.ch # /etc/init.d/apache2 restart
* apache2 not running (no pid file)
* Starting apache2...
* start-stop-daemon: failed to start `/usr/sbin/apache2'

in /var/log/apache2/ssl_error_log

[Fri Jun 14 21:00:57 2013] [error] Server should be SSL-aware but has no certificate configured [Hint: SSLCertificateFile] (/etc/apache2/vhosts.d/00_default_ssl_vhost.conf:11)

I moved ssl_conf, temporary.

Then, these are works (apache).


Debug sbsm loading error

I could boot apache process.
But there are problem for loading sbsm in Apache configuration (via mod_ruby).

Because there are not ruby add path, correctly (with new configuration)

[Fri Jun 14 21:06:40 2013] [error] mod_ruby: error in ruby
[Fri Jun 14 21:06:40 2013] [error] mod_ruby: (eval):1: (eval):1: uninitialized constant SBSM (NameError)
[Fri Jun 14 21:06:40 2013] [error] mod_ruby:   from (eval):1:in `value'

I added this line before RubyRequire.
# cloned sbsm into /usr/local/share/src.

RubyAddPath /usr/local/share/src/sbsm/lib  #=> added
RubyRequire 'sbsm/trans_handler'

and created empty trans_handler.yml into /var/www/sandoz.bbmb.ch/etc


Error encoding/character

[Fri Jun 14 21:26:11 2013] [error] mod_ruby: error in ruby
[Fri Jun 14 21:26:11 2013] [error] mod_ruby: /var/www/sandoz.bbmb.ch/doc/index.rbx:5:in `require': no such file to load -- encoding/character/utf-8 (LoadError)
[Fri Jun 14 21:26:11 2013] [error] mod_ruby:   from /var/www/sandoz.bbmb.ch/doc/index.rbx:5
[Fri Jun 14 21:26:11 2013] [error] mod_ruby:   from /usr/lib64/ruby/1.8/apache/ruby-run.rb:53:in `load'
[Fri Jun 14 21:26:11 2013] [error] mod_ruby:   from /usr/lib64/ruby/1.8/apache/ruby-run.rb:53:in `handler'
[Fri Jun 14 21:26:25 2013] [warn] Unable to load url configuration: can't convert false into Hash
[Fri Jun 14 21:26:25 2013] [notice] Hint: store configuration in a YAML-File at DOCUMENT_ROOT/../etc/trans_handler.yml
[Fri Jun 14 21:26:25 2013] [error] [client 66.249.72.232] File does not exist: /var/www/sandoz.bbmb.ch/doc/product_reviews.php
[Fri Jun 14 21:26:26 2013] [warn] Unable to load url configuration: can't convert false into Hash
[Fri Jun 14 21:26:26 2013] [notice] Hint: store configuration in a YAML-File at DOCUMENT_ROOT/../etc/trans_handler.yml
[Fri Jun 14 21:26:26 2013] [error] [client 66.249.72.232] File does not exist: /var/www/sandoz.bbmb.ch/doc/product_reviews.php
[Fri Jun 14 21:26:46 2013] [warn] Unable to load url configuration: can't convert false into Hash
[Fri Jun 14 21:26:46 2013] [notice] Hint: store configuration in a YAML-File at DOCUMENT_ROOT/../etc/trans_handler.yml
...

Then, I added `rubygems` into doc/index

link

Ruby for apache

mod_ruby is compiled with ruby-1.8.6.
But apache uses system ruby.

[Fri Jun 14 21:33:09 2013] [error] mod_ruby: error in ruby
[Fri Jun 14 21:33:09 2013] [error] mod_ruby: /usr/lib64/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in `gem_original_require': no such file to load -- encoding/character/utf-8 (LoadError)
[Fri Jun 14 21:33:09 2013] [error] mod_ruby:   from /usr/lib64/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in `require'
[Fri Jun 14 21:33:09 2013] [error] mod_ruby:   from /var/www/sandoz.bbmb.ch/doc/index.rbx:7
[Fri Jun 14 21:33:09 2013] [error] mod_ruby:   from /usr/lib64/ruby/1.8/apache/ruby-run.rb:53:in `load'
[Fri Jun 14 21:33:09 2013] [error] mod_ruby:   from /usr/lib64/ruby/1.8/apache/ruby-run.rb:53:in `handler'

Problem is mod_ruby and rubygems of portage.

fastpower src # sudo emerge -av mod_ruby

These are the packages that would be merged, in order:

Calculating dependencies... done!
[ebuild   R    ] www-apache/mod_ruby-1.3.0  USE="-doc" 0 kB

Total: 1 package (1 reinstall), Size of downloads: 0 kB
fastpower sandoz.bbmb.ch # emerge -av rubygems

These are the packages that would be merged, in order:

Calculating dependencies... done!
[ebuild   R    ] dev-ruby/rubygems-1.8.24  USE="-server {-test}" RUBY_TARGETS="ruby18 ruby19 -jruby (-ree18)" 0 kB

Total: 1 package (1 reinstall), Size of downloads: 0 kB

Then I removed this mod_ruby.

And I changed ruby configuration in Apache.
(Updated /etc/apache2/modules.d/21_mod_ruby.conf)

z.B. (This is my local one)

<IfDefine RUBY>
  # mod_ruby
  # 1.8.6-p369
  #LoadModule ruby_module modules/mod_ruby186.so
  # 1.8.7-p358
  #LoadModule ruby_module modules/mod_ruby187.so
  # 1.9.3-p194
  LoadModule ruby_module modules/mod_ruby193.so
</IfDefine>

<IfModule mod_ruby.c>
  # system
  #RubyAddPath /usr/lib/ruby
  # manualy install 1.8.6-p369 with oniguruma patch
  #RubyAddPath /usr/local/rbenv/versions/1.8.6-p369/lib/ruby
  # rbenv:1.8.7-p358
  #RubyAddPath /usr/local/rbenv/versions/1.8.7-p358/lib/ruby
  #RubyAddPath /usr/local/rbenv/versions/1.8.7-p358/lib/ruby/1.8
  #RubyAddPath /usr/local/rbenv/versions/1.8.7-p358/lib/ruby/1.8/x86_64-linux/
  #RubyAddPath /usr/local/rbenv/versions/1.8.7-p358/lib/ruby/site_ruby/1.8
  # rbenv:1.9.3-p194
  RubyAddPath /usr/local/rbenv/versions/1.9.3-p194/lib/ruby

  RubyRequire apache/ruby-run
  <Files *.rbx>
    SetHandler ruby-object
    RubyHandler Apache::RubyRun.instance
  </Files>
</IfModule>

But still error is there.
If I commented out encoding/character/utf-8 in doc/index.rbx. Then, web interface works.

Note

works via irb (1.8.6)

Why ?

fastpower sandoz.bbmb.ch $ /usr/local/bin/ruby186/bin/irb     
irb(main):001:0> require 'rubygems'
=> true
irb(main):002:0> require 'encoding/character/utf-8'
=> true #=> No Problem.

continue works sunday.

view · edit · sidebar · attach · print · history
Page last modified on June 16, 2013, at 01:05 AM