view · edit · sidebar · attach · print · history

20120509-setup-bbmb-setup-xmlconv

<< | Index | >>


Summary

  • setuped bbmb.ch in local
  • setuped sandoz.xmlconv.bbmb.ch in local

Index


Setup bbmb

setup sandoz.bbmb.ch (see yesterday)

sbsm loading problem

~ 498 $ ~/usr/local/bin/irb18 
irb(main):001:0> require 'sbsm/trans_handler'
LoadError: no such file to load -- rockit/rockit
        from /home/yasu/usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
        from /home/yasu/usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
        from /home/yasu/usr/local/lib/ruby/gems/1.8/gems/sbsm-1.0.0/lib/sbsm/trans_handler.rb:5
        from /home/yasu/usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in `gem_original_require'
        from /home/yasu/usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in `require'
        from (irb):1
irb(main):002:0> require 'sbsm/request'
=> true
irb(main):003:0> 

Refs

in production server

$ locate rockit
/usr/lib/ruby/site_ruby/1.8/rockit
/usr/lib/ruby/site_ruby/1.8/rockit/base_extensions.rb
/usr/lib/ruby/site_ruby/1.8/rockit/bootstrap.rb
/usr/lib/ruby/site_ruby/1.8/rockit/bounded_lru_cache.rb
/usr/lib/ruby/site_ruby/1.8/rockit/conflict_resolution.rb
/usr/lib/ruby/site_ruby/1.8/rockit/directed_graph.rb
/usr/lib/ruby/site_ruby/1.8/rockit/glr_parser.rb
/usr/lib/ruby/site_ruby/1.8/rockit/grammar.rb
/usr/lib/ruby/site_ruby/1.8/rockit/graphdrawing.rb
/usr/lib/ruby/site_ruby/1.8/rockit/graphviz_dot.rb
/usr/lib/ruby/site_ruby/1.8/rockit/indexable.rb
/usr/lib/ruby/site_ruby/1.8/rockit/lalr_parsetable_generator.rb
/usr/lib/ruby/site_ruby/1.8/rockit/parse_table.rb
/usr/lib/ruby/site_ruby/1.8/rockit/parsetable_generation.rb
/usr/lib/ruby/site_ruby/1.8/rockit/parsing_ambiguities.rb
/usr/lib/ruby/site_ruby/1.8/rockit/profiler.rb
/usr/lib/ruby/site_ruby/1.8/rockit/reduce_actions_generator.rb
/usr/lib/ruby/site_ruby/1.8/rockit/rockit.rb
/usr/lib/ruby/site_ruby/1.8/rockit/rockit_grammar_ast_eval.rb
/usr/lib/ruby/site_ruby/1.8/rockit/rockit_grammars_parser.rb
/usr/lib/ruby/site_ruby/1.8/rockit/sourcecode_dumpable.rb
/usr/lib/ruby/site_ruby/1.8/rockit/stringscanner.rb
/usr/lib/ruby/site_ruby/1.8/rockit/syntax_tree.rb
/usr/lib/ruby/site_ruby/1.8/rockit/token.rb
/usr/lib/ruby/site_ruby/1.8/rockit/version.rb

rockit gem does not have these files.

I got source code of rockit
http://trac.ywesee.com/raw-attachment/ticket/226/rockit.tar.gz

Refs

rockit load problem has gone.
apache error log

[Wed May 09 08:32:39 2012] [error] mod_ruby: /var/www/bbmb.ch/doc/index.rbx:6:in `require': no such file to load -- encoding/character/utf-8 (LoadError)[Wed May 09 08:32:39 2012] [error] mod_ruby:   from /var/www/bbmb.ch/doc/index.rbx:6
[Wed May 09 08:32:39 2012] [error] mod_ruby:   from /home/yasu/usr/local/lib/ruby/1.8/apache/ruby-run.rb:53:in `load'
[Wed May 09 08:32:39 2012] [error] mod_ruby:   from /home/yasu/usr/local/lib/ruby/1.8/apache/ruby-run.rb:53:in `handler'

It is expected error. suspend


Setup xmlconv

setup sandoz.xmlconv.bbmb.ch

Refs

create config yaml file

  • etc/xmlconv.yml
  • etc/polling.yml (commented out)

copy ui files (doc/index.rbx, usw.) from production server

  • doc

directory structure

Added load_path for symbolic link

/var/www/xmlconv/bin/xmlconvd
/var/www/xmlconv/bin/admin
$: << "/var/www/xmlconv/lib"

sbsm loading problem

/etc/apache2/vhosts.d/xmlconv.conf

...
  RubyAddPath /home/yasu/usr/local/lib/ruby/gems/1.8/gems/sbsm-1.0.0/lib
  RubyRequire '/home/yasu/usr/local/lib/ruby/gems/1.8/gems/sbsm-1.0.0/lib/sbsm/trans_handler'
  #RubyRequire 'sbsm/trans_handler'
...

lib load_path problem

add lib into load_path at bin/xmlconvd

$: << File.expand_path("../lib", File.dirname(__FILE__))

copy doc directory

copy doc directory form production server
then, added this line into

doc/index.rbx

require 'rubygems'

install gems

  • tmail 1.2.7.1

setup db

$ createdb -E UTF8 -T template0 sandoz_xmlconv
$ createuser xmlconv

setup conversion and postprocess into lib

application needs following libs.
copied from production server.

  • lib/conversion
  • lib/postprocess
$ ~/usr/local/bin/ruby18 -rrubygems bin/xmlconvd config="etc/xmlconv.yml"
/home/yasu/usr/local/lib/ruby/gems/1.8/gems/htmlgrid-1.0.5/lib/htmlgrid/grid.rb:28: warning: already initialized constant VERSION
could not find htmlgrid.so, falling back to pure-ruby class
/home/yasu/usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require': no such file to load -- conversion/bdd_i2 (LoadError)
        from /home/yasu/usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
        from /var/www/xmlconv/lib/xmlconv/util/application.rb:17
        from /home/yasu/usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
        from /home/yasu/usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
        from bin/xmlconvd:10

Online server does not have this file, too.

commented out.

Refs

pg

bin/xmlconvd

#ODBA.storage.dbi = ODBA::ConnectionPool.new("DBI:pg:#{config.db_name}",
ODBA.storage.dbi = ODBA::ConnectionPool.new("DBI:Pg:#{config.db_name}",
                                            config.db_user, config.db_auth)

xmlconvd works

D, [2012-05-09T10:20:39.533771 #13294] DEBUG -- XmlConv2: checking directory '/var/www/sandoz.xmlconv.bbmb.ch/lib/conversion' for plugins
D, [2012-05-09T10:20:39.533889 #13294] DEBUG -- XmlConv2: loading plugin: 'conversion/bdd_csv' (bdd_csv.rb)
D, [2012-05-09T10:20:39.536791 #13294] DEBUG -- XmlConv2: loading plugin: 'conversion/sunstore_bdd' (sunstore_bdd.rb)
D, [2012-05-09T10:20:39.538928 #13294] DEBUG -- XmlConv2: loading plugin: 'conversion/xundart_bdd' (xundart_bdd.rb)
D, [2012-05-09T10:20:39.539605 #13294] DEBUG -- XmlConv2: loading plugin: 'conversion/pharmacieplus_bdd' (pharmacieplus_bdd.rb)
D, [2012-05-09T10:20:39.539838 #13294] DEBUG -- XmlConv2: loading plugin: 'conversion/wbmb_bdd' (wbmb_bdd.rb)
D, [2012-05-09T10:20:39.597030 #13294] DEBUG -- XmlConv2: loading plugin: 'conversion/propharma_bdd' (propharma_bdd.rb)
D, [2012-05-09T10:20:39.675072 #13294] DEBUG -- XmlConv2: checking directory '/var/www/sandoz.xmlconv.bbmb.ch/lib/postprocess' for postprocs
D, [2012-05-09T10:20:39.675278 #13294] DEBUG -- XmlConv2: loading postproc: 'postprocess/bbmb2' (bbmb2.rb)
D, [2012-05-09T10:20:39.676371 #13294] DEBUG -- XmlConv2: loading postproc: 'postprocess/bbmb' (bbmb.rb)
D, [2012-05-09T10:20:39.676617 #13294] DEBUG -- XmlConv2: loading postproc: 'postprocess/soap' (soap.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_xmlconv_util_transaction_invoice_ids" already exists

I, [2012-05-09T10:20:39.724894 #13294]  INFO -- XmlConv2: drb-service listening on druby://localhost:12006

Error in Apache

Refs

If etc/trans_handler.yml is empty.

[Wed May 09 11:32:30 2012] [warn] Unable to load url configuration: can't convert nil into Hash
[Wed May 09 11:32:30 2012] [notice] Hint: store configuration in a YAML-File at DOCUMENT_ROOT/../etc/trans_handler.yml

It works

bin/admin
$ ~/usr/local/bin/ruby18 -rrubygems bin/admin config="etc/xmlconv.yml"

sbsm version problem

I have not yet state problem in sbsm.

I have sbsm installed via gem.
Then some state does not work.

checked library location in production server.
And I found these.

in site_ruby

$ ls -al /usr/lib/ruby/site_ruby/1.8/
...
bbmb -> /home/ywesee/cogito/bbmb/lib/bbmb
...
cgi -> /home/ywesee/cogito/sbsm/lib/cgi
...
htmlgrid -> /home/ywesee/cogito/htmlgrid/lib/htmlgrid
odba -> /home/ywesee/cogito/odba/lib/odba
odba.rb -> /home/ywesee/cogito/odba/lib/odba.rb
rclconf -> /home/ywesee/cogito/rclconf/lib/rclconf
rclconf.rb -> /home/ywesee/cogito/rclconf/lib/rclconf.rb
.../
rockit
...
sbsm -> /home/ywesee/cogito/sbsm/lib/sbsm
...
xmlconv -> /home/ywesee/cogito/xmlconv/lib/xmlconv/
ydim -> /home/ywesee/cogito/ydim/lib/ydim
yus -> /home/ywesee/cogito/yus/lib/yus/

re-installed these libraries via git.

sbsm
commit 81f8868205f3cf26420dc4edd1278c967464377f
Author: Hannes Wyss <hwyss@ywesee.com>
Date:   Wed Apr 21 10:22:51 2010 +0200

this version of sbsm has dependency location of ruby19

apache error log

[Wed May 09 13:12:36 2012] [error] mod_ruby: error in ruby
[Wed May 09 13:12:36 2012] [error] mod_ruby: /home/yasu/usr/local/lib/ruby/1.8/sbsm/redefine_19_cookie.rb:4:in `load': no such file to load -- /usr/lib/ruby19/1.9.1/cgi/cookie.rb (LoadError)
[Wed May 09 13:12:36 2012] [error] mod_ruby:   from /home/yasu/usr/local/lib/ruby/1.8/sbsm/redefine_19_cookie.rb:4

updated /home/yasu/usr/local/lib/ruby/site_ruby/1.8/sbsm/redefine_19_cookie.rb

class CGI 
  remove_const 'Cookie'
end
#load '/usr/lib/ruby19/1.9.1/cgi/cookie.rb'
load '/home/yasu/usr/local/lib/ruby/1.9.1/cgi/cookie.rb'

htmlgrid.so

htmlgrid
commit 2f7f7942d119dd02a7d3bbba2bc4f6fe35b3b9f8
Author: Hannes Wyss <hwyss@ywesee.com>
Date:   Tue Jan 12 18:25:20 2010 +0100

xmlconv use old htmlgrid. We need also to compile htmlgrid.so.

$ cd ext/htmlgrid
$ ~/usr/local/bin/ruby18 extconf.rb
$ make
$ cp htmlgrid.so ~/usr/local/lib/ruby/site_ruby/1.8/i686-linux/

odba

odba
commit 3ff9db6dfd8a9f99139a50108876b04a812767a9
Author: Hannes Wyss <hwyss@ywesee.com>
Date:   Mon Nov 10 14:18:08 2008 +0100

Refs

xmlconv

We need xmlconv also to link at site_ruby

doc/propharma.rbx

$: << File.expand_path('../lib', File.dirname(__FILE__))

require 'drb/drb'
require 'xmlconv/util/destination'
require 'xmlconv/util/transaction'

Post order responce

checked with sample script

code #=> 200
body #=> 
<?xml version='1.0' encoding='UTF-8'?>
<customerOrderResponse backLogDesired='false' language='de' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xsi:schemaLocation='http://www.e-galexis.com/schemas/ http://www.e-galexis.com/schemas/POS/customerOrder/customerOrderResponse.xsd' version='1.0' productDescriptionDesired='false' roundUpForCondition='false' xmlns='http://www.e-galexis.com/schemas/'>
</customerOrderResponse>

Attach:sample_order.rb-20120509.txt

NOTE

flow

xmlconv
  XmlConvApp#execute_with_response @@lib/xmlconv/util/application.rb@@
    XmlConv::Util::Application#execute @@lib/xmlconv/util/application.rb@@
      XmlConv::Util::Transaction#execute @@lib/xmlconv/util/transaction.rb@@
        XmlConv::Conversion::xxx writer (z.B. BddCsv)
      XmlConv::Util::Transaction#postprocess @@lib/xmlconv/util/transaction.rb@@
      XmlConv::Util::Transaction#notify @@lib/xmlconv/util/transaction.rb@@
    XmlConv::Util::Transaction#response @@lib/xmlconv/util/transaction.rb@@
      XmlConv::Conversion::xxx readar (z.B. PropharmaMdd)

order response

We have already same structure with following format.

productOrderLineResponse
<productOrderLineResponse lineAccepted="true" backLogLine="false" deliveryDate="2002-08-26" roundUpForConditionDone="false" productReplaced="false">
  <productOrderLine orderQuantity="10" roundUpForCondition="true" backLogDesired="false">
    <pharmaCode id="1336630"/>
  </productOrderLine>
  <productResponse wholesalerProductCode="1336630" description="DAFALGAN Tabl 500 mg 16 Stk" baseLinePrice="17.10" expectedLogisticServiceCost="2.75" invoiceQuantity="10" deliveryQuantity="10" campaign="false" basePiecePrice="9.10" lineAmount="58.10"/>
  <availability status="yes"/>
</productOrderLineResponse>

But, our xmlconv response only has the following attributes (compare to above)

<productOrderLineResponse lineAccepted="false" roundUpForConditionDone="false" productReplaced="false" backLogLine="false">
  <productOrderLine orderQuantity="1">
    <pharmaCode id="0879937"/>
  </productOrderLine>
  <productResponse/>
  <availability status="no"/>
</productOrderLineResponse>

Event handling in Nagios

as NOTE

If you can ssh to remote server without password and tty, and If you want to do ssh as another user. try like this.

/etc/sudoers

Cmnd_Alias STUFF=/usr/bin/sudo, /usr/bin/su
User_Alias USER=yasu
USER STUFF=NOPASSWD:STUFF

z.B.

$ sudo -u user ssh -n host ls -la
view · edit · sidebar · attach · print · history
Page last modified on May 09, 2012, at 08:04 PM