view · edit · sidebar · attach · print · history

20110615-setup-globo_xmlconv_bbmb_ch

<< | Index | >>


  1. Setup globo.xmlconv.bbmb.ch
  2. Setup apache for globo.xmlconv.bbmb.ch
  3. Check order process

Goal/Estimate/Evaluation
  • setup globo.xmlconv.bbmb.ch / 70% / 100%
Milestones
Summary
Commits
Next

Setup globo.xmlconv.bbmb.ch

Refer: http://dev.ywesee.com/wiki.php/Masa/20110223-output-order-bbmb#Xmlconv

  1. git get xmlconv (ver.1)
  2. git get globo.xmlconv.bbmb.ch
  3. copy all the file of globo.xmlconv.bbmb.ch to xmlconv
  4. add one line bin/xmlconvd
$: << File.expand_path("../lib", File.dirname(__FILE__))
  1. Download the sql archive from the server (/var/backup/xxx/db/postgresql/June-2011/2011-06-14/21:00-postgresql_database-globo_xmlconv-backup.gz)
  2. Create database: sudo -u postgres createdb -E UTF8 -T template0 globo_xmlconv
 To check databases on server
 > psql -U postgres
 # \l
  1. Create a new user for the database (if there is not 'xmlconv2' user for the database 'globo_xmlconv')
masa@masa ~ $ su postgres
Passwort: 
postgres@masa ~ $ createuser
Geben Sie den Namen der neuen Rolle ein: xmlconv2
Soll die neue Rolle ein Superuser sein? (j/n) n
Soll die neue Rolle Datenbanken erzeugen dürfen? (j/n) j
Soll die neue Rolle weitere neue Rollen erzeugen dürfen? (j/n) j
  1. Restore the data: zcat postgresql_database-globo_xmlconv-backup.gz |psql -U postgres globo_xmlconv
  2. Make xmlconv.yml and put it in etc directory
---
domain: ch.bbmb.xmlconv.hatapharm
log_level: DEBUG
db_name: globo_xmlconv
db_user: xmlconv2
server_url: "druby://localhost:10012"
  1. Run
masa@masa ~/work/xmlconv $ bin/xmlconvd config="etc/xmlconv.yml"
I, [2011-06-15T09:03:29.289838 #3476]  INFO -- XmlConv2: #<RCLConf::RCLConf:0x7ff824c3cbd8
...
D, [2011-06-15T09:03:29.289934 #3476] DEBUG -- XmlConv2: checking directory '/home/masa/.xmlconv/plugin/conversion' for plugins
D, [2011-06-15T09:03:29.289987 #3476] DEBUG -- XmlConv2: checking directory '/home/masa/.xmlconv/plugin/postprocess' for postprocs
ERROR:  relation "object" 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, [2011-06-15T09:03:29.429885 #3476]  INFO -- XmlConv2: drb-service listening on druby://localhost:10012

Experiment (lib/xmlconv/util/application.rb#masa)

module XmlConv
  module Util
    class Application
...
      def masa
        'masa'
      end
masa@masa ~/work/xmlconv $ bin/admin config="etc/xmlconv.yml"
ch.bbmb.xmlconv.hatapharm> masa
-> masa
masa@masa ~/work/xmlconv $ bin/admin server_url='druby://localhost:10012'
ch.xmlconv> masa
-> masa

Note

  • Looks working

Setup apache for globo.xmlconv.bbmb.ch

Setup a new virtual host

masa@masa /etc/apache2/vhosts.d $ cat 08_globo_xmlconv_vhost.conv 
<Directory /home/masa/ywesee/globo.xmlconv.bbmb.ch/doc>
Options ExecCGI
AllowOverride None
Order allow,deny
Allow from all
</Directory>

<VirtualHost *:80>
DocumentRoot /home/masa/ywesee/globo.xmlconv.bbmb.ch/doc
ServerName masapharm.xmlconv.bbmb.ch
DirectoryIndex index.rbx
RubyAddPath /home/masa/ywesee/globo.xmlconv.bbmb.ch/
RubyRequire 'sbsm/trans_handler'
SetHandler ruby-object
RubyTransHandler SBSM::FlavoredTransHandler.instance
</VirtualHost>

Restart apache

masa@masa /etc/apache2/vhosts.d $ sudo /etc/init.d/apache2 restart
* 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        

Reload on browser

Result

Question

  • How do I set the login password?

pass_hash.rb

require 'digest/md5'
p Digest::MD5::hexdigest(ARGV[0])

or

ruby -rmd5 -e "p Digest::MD5::hexdigest('passwd')"

or

alias pass_hash='ruby -rmd5 -e "p Digest::MD5::hexdigest(ARGV[0])"'

Experiment (etc/xmlconv.yml)

---
domain: ch.bbmb.xmlconv.masapharm
log_level: DEBUG
db_name: globo_xmlconv
db_user: xmlconv2
server_url: "druby://localhost:10012"
pass_hash: "9415cb40b7edf3886ed28b07d7c07610"

Login

  • Success but error
ArgumentError
undefined class/module XmlConv::Model::Delivery

Console log

error in SBSM::Session#to_html: /de
ArgumentError
undefined class/module XmlConv::Model::Delivery
/usr/lib64/ruby/site_ruby/1.8/odba/marshal.rb:15:in `load'
/usr/lib64/ruby/site_ruby/1.8/odba/marshal.rb:15:in `load'
/usr/lib64/ruby/site_ruby/1.8/odba/cache.rb:616:in `restore'
/usr/lib64/ruby/site_ruby/1.8/odba/cache.rb:336:in `fetch_or_restore'
/usr/lib64/ruby/site_ruby/1.8/odba/cache.rb:330:in `call'
/usr/lib64/ruby/site_ruby/1.8/odba/cache.rb:330:in `fetch_or_do'
/usr/lib64/ruby/site_ruby/1.8/odba/cache.rb:335:in `fetch_or_restore'
/usr/lib64/ruby/site_ruby/1.8/odba/cache.rb:628:in `restore_object'
/usr/lib64/ruby/site_ruby/1.8/odba/cache.rb:589:in `load_object'
/usr/lib64/ruby/site_ruby/1.8/odba/cache.rb:232:in `fetch'
/usr/lib64/ruby/site_ruby/1.8/odba/cache.rb:330:in `call'
/usr/lib64/ruby/site_ruby/1.8/odba/cache.rb:330:in `fetch_or_do'
/usr/lib64/ruby/site_ruby/1.8/odba/cache.rb:231:in `fetch'
/usr/lib64/ruby/site_ruby/1.8/odba/stub.rb:51:in `odba_instance'
/usr/lib64/ruby/site_ruby/1.8/odba/stub.rb:141:in `method_missing'
/home/masa/ywesee/globopharm.xmlconv.bbmb.ch/lib/xmlconv/util/transaction.rb:102:in `status'
/usr/lib64/ruby/site_ruby/1.8/odba/stub.rb:141:in `send'
/usr/lib64/ruby/site_ruby/1.8/odba/stub.rb:141:in `method_missing'
/home/masa/ywesee/globopharm.xmlconv.bbmb.ch/lib/xmlconv/view/transactions.rb:53:in `status_comparable'
/usr/lib64/ruby/site_ruby/1.8/htmlgrid/composite.rb:66:in `send'
/usr/lib64/ruby/site_ruby/1.8/htmlgrid/composite.rb:66:in `create'
/usr/lib64/ruby/site_ruby/1.8/htmlgrid/composite.rb:280:in `compose_component'
/usr/lib64/ruby/site_ruby/1.8/htmlgrid/composite.rb:209:in `_compose'
/usr/lib64/ruby/site_ruby/1.8/htmlgrid/composite.rb:203:in `each'
/usr/lib64/ruby/site_ruby/1.8/htmlgrid/composite.rb:203:in `_compose'
/usr/lib64/ruby/site_ruby/1.8/htmlgrid/list.rb:67:in `compose_list'
/usr/lib64/ruby/1.8/delegate.rb:136:in `each_with_index'
/usr/lib64/ruby/site_ruby/1.8/htmlgrid/list.rb:65:in `each'
/usr/lib64/ruby/site_ruby/1.8/htmlgrid/list.rb:65:in `each_with_index'
/usr/lib64/ruby/site_ruby/1.8/htmlgrid/list.rb:65:in `compose_list'
/usr/lib64/ruby/site_ruby/1.8/htmlgrid/list.rb:54:in `compose'
/usr/lib64/ruby/site_ruby/1.8/htmlgrid/composite.rb:55:in `init'
/usr/lib64/ruby/site_ruby/1.8/htmlgrid/list.rb:129:in `init'
/usr/lib64/ruby/site_ruby/1.8/htmlgrid/component.rb:138:in `initialize'
/home/masa/ywesee/globopharm.xmlconv.bbmb.ch/lib/xmlconv/view/transactions.rb:82:in `new'
/home/masa/ywesee/globopharm.xmlconv.bbmb.ch/lib/xmlconv/view/transactions.rb:82:in `transactions'
/usr/lib64/ruby/site_ruby/1.8/htmlgrid/composite.rb:66:in `send'
/usr/lib64/ruby/site_ruby/1.8/htmlgrid/composite.rb:66:in `create'
/usr/lib64/ruby/site_ruby/1.8/htmlgrid/composite.rb:280:in `compose_component'
/usr/lib64/ruby/site_ruby/1.8/htmlgrid/composite.rb:209:in `compose'
/usr/lib64/ruby/site_ruby/1.8/htmlgrid/composite.rb:203:in `each'
/usr/lib64/ruby/site_ruby/1.8/htmlgrid/composite.rb:203:in `compose'
/usr/lib64/ruby/site_ruby/1.8/htmlgrid/composite.rb:55:in `init'
/usr/lib64/ruby/site_ruby/1.8/htmlgrid/component.rb:138:in `initialize'
/usr/lib64/ruby/site_ruby/1.8/htmlgrid/template.rb:67:in `new'
/usr/lib64/ruby/site_ruby/1.8/htmlgrid/template.rb:67:in `__standard_component'
/usr/lib64/ruby/site_ruby/1.8/htmlgrid/template.rb:54:in `content'
/usr/lib64/ruby/site_ruby/1.8/htmlgrid/composite.rb:141:in `send'
/usr/lib64/ruby/site_ruby/1.8/htmlgrid/composite.rb:141:in `create'
/usr/lib64/ruby/site_ruby/1.8/htmlgrid/divcomposite.rb:33:in `compose'
/usr/lib64/ruby/site_ruby/1.8/htmlgrid/divcomposite.rb:13:in `each'
/usr/lib64/ruby/site_ruby/1.8/htmlgrid/divcomposite.rb:13:in `compose'
/usr/lib64/ruby/site_ruby/1.8/htmlgrid/composite.rb:55:in `init'
/usr/lib64/ruby/site_ruby/1.8/htmlgrid/component.rb:138:in `initialize'
/usr/lib64/ruby/site_ruby/1.8/sbsm/state.rb:279:in `new'
/usr/lib64/ruby/site_ruby/1.8/sbsm/state.rb:279:in `view'
/usr/lib64/ruby/site_ruby/1.8/sbsm/state.rb:196:in `to_html'
/usr/lib64/ruby/site_ruby/1.8/sbsm/session.rb:515:in `to_html'
/usr/lib64/ruby/site_ruby/1.8/sbsm/session.rb:177:in `drb_process'
/usr/lib64/ruby/site_ruby/1.8/sbsm/session.rb:174:in `synchronize'
/usr/lib64/ruby/site_ruby/1.8/sbsm/session.rb:174:in `drb_process'
/usr/lib64/ruby/1.8/drb/drb.rb:1555:in `__send__'
/usr/lib64/ruby/1.8/drb/drb.rb:1555:in `perform_without_block'
/usr/lib64/ruby/1.8/drb/drb.rb:1515:in `perform'
/usr/lib64/ruby/1.8/drb/drb.rb:1589:in `main_loop'
/usr/lib64/ruby/1.8/drb/drb.rb:1585:in `loop'
/usr/lib64/ruby/1.8/drb/drb.rb:1585:in `main_loop'
/usr/lib64/ruby/1.8/drb/drb.rb:1581:in `start'
/usr/lib64/ruby/1.8/drb/drb.rb:1581:in `main_loop'
/usr/lib64/ruby/1.8/drb/drb.rb:1430:in `run'
/usr/lib64/ruby/1.8/drb/drb.rb:1427:in `start'
/usr/lib64/ruby/1.8/drb/drb.rb:1427:in `run'
/usr/lib64/ruby/1.8/drb/drb.rb:1347:in `initialize'
/usr/lib64/ruby/1.8/drb/drb.rb:1627:in `new'
/usr/lib64/ruby/1.8/drb/drb.rb:1627:in `start_service'
bin/xmlconvd:37
XmlConv::View::TransactionsList::COMPONENTS[[4, 0]] in create(status_comparable)
XmlConv::View::TransactionsComposite::COMPONENTS[[0, 1]] in create(transactions)
XmlConv::View::Transactions::COMPONENTS[[0, 0]] in create(content)
error in SBSM::Session#http_headers: /de
ArgumentError
undefined class/module XmlConv::Model::Delivery
/usr/lib64/ruby/site_ruby/1.8/odba/marshal.rb:15:in `load'
/usr/lib64/ruby/site_ruby/1.8/odba/marshal.rb:15:in `load'
/usr/lib64/ruby/site_ruby/1.8/odba/cache.rb:616:in `restore'
/usr/lib64/ruby/site_ruby/1.8/odba/cache.rb:336:in `fetch_or_restore'
/usr/lib64/ruby/site_ruby/1.8/odba/cache.rb:330:in `call'

Experiment (bin/xmlconvd)

 #!/usr/bin/env ruby
 # XmlConv -- xmlconv2 -- 07.06.2004 -- hwyss@ywesee.com

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

 require 'xmlconv/model/delivery'
 require 'xmlconv/model/delivery_item'
 require 'xmlconv/model/party'
 require 'xmlconv/model/name'
 require 'xmlconv/model/address'
 require 'xmlconv/model/bsr'

Reboot

  • bin/xmlconvd config="etc/xmlconv.yml"

Login

Result

Note

  • I do not know still why I can log in
  • because the online server does not require those libraries

Check order process

  1. 'Polling' is the process to ask if there is an order to mail.ywesee.com by email,
  2. and it convert the received data by a converter,
  3. then 'Postprocess' sends the converted data to the ftp server by ftp.

Refer: etc/polling.xml

Note

  • The 'reader' in the poling.yml indicates the converter class

Next

  • Check the behavior of converter class locally with the actual input data
  • Simulate the order process locally
  • Think if it is possible to insert an ean-code during the convert process

Test

view · edit · sidebar · attach · print · history
Page last modified on June 15, 2011, at 04:45 PM