view · edit · sidebar · attach · print · history

Index>

20160412-ydim-html

Summary

  • Fix error in YDIM html

Commits

Index

Keep in Mind for work to do
  • Fix dojo error http://www.sitepen.com/blog/2012/10/31/debugging-dojo-common-error-messages/#forgot-dom-ready
  • I removed on May-27 tests for ix_registrationss, fix_sequences, fix_compositions, fix_packages from test/test_plugin/swissmedic.rb,as he could not find any references for them in the src code. Did I erroneously remove stuff when cleaning up the swissmedic import earlier?
  • The whole test for older/newer Packages must be adapted to xlsx. One must compare the rows (e.g. by creating csv files) and do the same stuff in xlsx!
  • creat gem: task: input=file with ean-codes, standard output show ean-codes + atc-code. Source is Swissmedic Packungen.xlsx or XML.
  • Import via data/medreg_companies.yaml
  • Fix problem with radioactivatum 99m-technetio when parsing Wirkstoffe
  • Fix galenic_forms when parsing swissmedic.xlsx
  • Cleanup generic_type. Replace it everywhere by sl_generic_type and adapt code accordingly.
  • Get updated ATC-codes from EPha for oddb.org, too.
  • Use refdatabase for oddb.org, too.
  • Check whether we should revert the part which touche src/plugin/text_info.rb of commit 17af82ba4d76a5838683411b260de265531f9e74. We should improve test/stub/oddbapp.rb to work similar for update/pointer as the real oddbapp. In this case we would have a good Stub for plugins. May we need a different stub when working with plugins (which create/modify/destroy ODDB-Objects), when in most other cases a very simple stub is sufficient.
  • When a logged in admin user changes an atc_code of a product, the corresponding atc_class must update its sequences, too.
  • Order of entering search type and value should not matter. Both should show long URL with search
  • Remove parser for minifi (but keep the minifi)
  • BSV-Plugin does not send mail. Is it sending two mails at once?
  • remove obsolete pdf_patinfo in model, admin/views

Fix error in YDIM html

Must fix my local error

 sudo -u apache /usr/bin/ruby18 -rubygems /var/www/ydim.ywesee.com/bin/ydim-htmld
/usr/local/lib64/ruby/gems/1.8/gems/htmlgrid-1.0.7/lib/htmlgrid/grid.rb:28: warning: already initialized constant VERSION
could not find htmlgrid.so, falling back to pure-ruby class
/var/www/ydim.ywesee.com/lib/ydim/html/view/htmlgrid.rb:17: warning: already initialized constant HTTP_HEADERS
/var/www/ydim.ywesee.com/lib/ydim/html/view/htmlgrid.rb:80: warning: already initialized constant STRIPED_BG
/usr/lib64/ruby/site_ruby/1.8/rubygems/core_ext/kernel_require.rb:53:in `gem_original_require': no such file to load -- mail (LoadError)
        from /usr/lib64/ruby/site_ruby/1.8/rubygems/core_ext/kernel_require.rb:53:in `require'
        from /usr/local/lib64/ruby/gems/1.8/gems/sbsm-1.2.5/lib/sbsm/validator.rb:27
        from /usr/lib64/ruby/site_ruby/1.8/rubygems/core_ext/kernel_require.rb:53:in `gem_original_require'
        from /usr/lib64/ruby/site_ruby/1.8/rubygems/core_ext/kernel_require.rb:53:in `require'
        from /var/www/ydim.ywesee.com/lib/ydim/html/util/validator.rb:4
        from /usr/lib64/ruby/site_ruby/1.8/rubygems/core_ext/kernel_require.rb:53:in `gem_original_require'
        from /usr/lib64/ruby/site_ruby/1.8/rubygems/core_ext/kernel_require.rb:53:in `require'
        from /var/www/ydim.ywesee.com/lib/ydim/html/util/server.rb:7
        from /usr/lib64/ruby/site_ruby/1.8/rubygems/core_ext/kernel_require.rb:53:in `gem_original_require'
        from /usr/lib64/ruby/site_ruby/1.8/rubygems/core_ext/kernel_require.rb:53:in `require'
        from /var/www/ydim.ywesee.com/bin/ydim-htmld:11

On thinpower I found the following link /usr/lib64/ruby/site_ruby/1.8/sbsm -> /home/ywesee/git/sbsm/lib/sbsm. Under /home/ywesee/git/sbsm I find a checkout of commit 4ce6ce435563662d6b35bad1f0b0e4666963efbc with many changes.

Replacing sbsm 1.2.5 by 1.2.3 fixed the problem. Now it cannot find hpricot. Fixed with sudo gem18 install hpricot --version=0.8.2. Now I fails because of a missing config file with

sudo -u apache /usr/bin/ruby18 -rubygems /var/www/ydim.ywesee.com/bin/ydim-htmld
/usr/local/lib64/ruby/gems/1.8/gems/htmlgrid-1.0.7/lib/htmlgrid/grid.rb:28: warning: already initialized constant VERSION
could not find htmlgrid.so, falling back to pure-ruby class
/var/www/ydim.ywesee.com/lib/ydim/html/view/htmlgrid.rb:17: warning: already initialized constant HTTP_HEADERS
/var/www/ydim.ywesee.com/lib/ydim/html/view/htmlgrid.rb:80: warning: already initialized constant STRIPED_BG
/var/www/ydim.ywesee.com/lib/ydim/html.rb:3: warning: already initialized constant VERSION
/var/www/ydim.ywesee.com/lib/ydim/html/util/server.rb:18:in `read': can't convert nil into String (TypeError)
        from /var/www/ydim.ywesee.com/lib/ydim/html/util/server.rb:18:in `initialize'
        from /var/www/ydim.ywesee.com/bin/ydim-htmld:32:in `new'
        from /var/www/ydim.ywesee.com/bin/ydim-htmld:32

Creating a DSY key with sudo ssh-keygen -t dsa -f /etc/ydim/id_dsa. Passphrase noted. Changing ownership via sudo chown -R apache /etc/ydim.

Creating a md5 pasword via ruby18 -e "require 'digest/md5'; p Digest::MD5::hexdigest(ARGV[0])" xxx

Now the etc/ydim.yml looks like

---
email: ngiger@ywesee.com
md5_pass: 'f561aaf6ef0bf14d4208bb46a4ccb3ad'
root_key: '/etc/ydim/id_dsa'

Now sudo -u apache /usr/bin/ruby18 -rubygems /var/www/ydim.ywesee.com/bin/ydim-htmld begins to work. But it still does show only the Apache2 default instead of the ydim login screen under http:ydim.oddbc-i2.dyndns.org.

Also the ch.oddb service no longer starts, as I found the following error in /service/ch.oddb/log/main/current

@40000000570ce8c536fcd9d4 /usr/local/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:55:in `require': cannot load such file -- ydim/config (LoadError)
@40000000570ce8c536fced5c       from /usr/local/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:55:in `require'
@40000000570ce8c536fcf144       from /var/www/oddb.org/src/plugin/ydim.rb:6:in `<top (required)>'
@40000000570ce8c536fcf144       from /usr/local/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:55:in `require'
@40000000570ce8c536fcf52c       from /usr/local/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:55:in `require'
@40000000570ce8c536fd6674       from /var/www/oddb.org/src/util/ipn.rb:6:in `<top (required)>'
@40000000570ce8c536fd6a5c       from /usr/local/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:55:in `require'
@40000000570ce8c536fd6a5c       from /usr/local/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:55:in `require'
@40000000570ce8c536fd6e44       from /var/www/oddb.org/src/util/oddbapp.rb:18:in `<top (required)>'
@40000000570ce8c536fd7de4       from /usr/local/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:55:in `require'
@40000000570ce8c536fd7de4       from /usr/local/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:55:in `require'
@40000000570ce8c536fd81cc       from bin/oddbd:13:in `<main>'

Fixed this problem with sudo /usr/local/bin/gem install ydim --version=1.0.0 After fixing the IP address in the apache2.conf I see the following error in /var/www/ydim.ywesee.com/log/error_log

[Tue Apr 12 14:46:28 2016] [error] [client 172.25.1.60] access to /var/www/ydim.ywesee.com/doc/index.rbx failed, reason: SSL connection required
[Tue Apr 12 14:47:05 2016] [error] mod_ruby: error in ruby
[Tue Apr 12 14:47:05 2016] [error] mod_ruby: /var/www/ydim.ywesee.com/etc/config.rb:4:in `require': no such file to load -- rclconf (LoadError)
[Tue Apr 12 14:47:05 2016] [error] mod_ruby:   from /var/www/ydim.ywesee.com/etc/config.rb:4
[Tue Apr 12 14:47:05 2016] [error] mod_ruby:   from /var/www/ydim.ywesee.com/doc/index.rbx:5:in `load'
[Tue Apr 12 14:47:05 2016] [error] mod_ruby:   from /var/www/ydim.ywesee.com/doc/index.rbx:5
[Tue Apr 12 14:47:05 2016] [error] mod_ruby:   from /usr/lib64/ruby/1.8/apache/ruby-run.rb:53:in `load'
[Tue Apr 12 14:47:05 2016] [error] mod_ruby:   from /usr/lib64/ruby/1.8/apache/ruby-run.rb:53:in `handler'

Added the following lines to /var/www/ydim.ywesee.com/etc/config.rb

require 'rubygems'
puts Gem::Specification.all_names.join("\n<br>")

Now https://ydim.oddb-ci2.dyndns.org/ outputs

abstract-1.0.0 
atomic-1.1.14 
bundle-0.0.1 
bundler-1.6.5 
bundler-1.3.5 
coderay-1.1.0 
color-1.8 
columnize-0.3.6 
currency-0.4.11 
dbd-pg-0.3.9 
dbi-0.4.5 
debugger-linecache-1.2.0 
debugger-ruby_core_source-1.3.1 
deprecated-2.0.1 
diff-lcs-1.2.5 
erubis-2.7.0 
facter-1.7.3 
fastthread-1.0.7 
ffi-1.9.3 
flexmock-1.3.2 
hiera-1.2.1 
hoe-3.7.1 
hoe-2.13.0 
hpricot-0.8.2 
htmlgrid-1.0.7 
i18n-0.6.9 
json-1.8.1 
log4r-1.1.10 
minitest-5.0.8 
minitest-4.7.5 
multi_json-1.8.4 
needle-1.3.0 
nokogiri-1.6.0 
odba-1.1.0 
pdf-writer-1.1.8 
pg-0.17.1 
racc-1.4.11 
rake-10.1.0 
rake-0.9.6 
rclconf-1.0.0 
rdoc-4.0.1 
rexical-1.0.5 
rkj-character-encodings-0.4.1 
rmail-1.0.0 
rrba-1.0.0 
ruby-ole-1.2.12 
ruby-password-0.15.5 
ruby-termios-0.9.6 
sbsm-1.2.3 
thread_safe-0.1.3 
tmail-1.2.7.1 
transaction-simple-1.4.0.2 
tzinfo-0.3.38 
yard-0.8.7.3 
yus-1.0.1

And I am even more puzzled why the require 'rclconf' failed. But after uncommenting the puts and leaving only require 'rubygems' https://ydim.oddb-ci2.dyndns.org/ now display the login prompt. And the login with ngiger@ywesee.com works fine, too. But creating a new customer fails because I see in the ydim output E, [2016-04-12T15:10:52.040147 #24444] ERROR -- unknown user: RuntimeError - Invalid Email

Adapting http://dev.ywesee.com/uploads/att/setup.ydim.sh.txt to my needs.

Dropped and recreated ydim database. Then starting it with sudo -u apache /usr/bin/ruby18 -rubygems /usr/bin/ydimd config=/etc/ydim/ydimd.yml. Still getting Invalid Email. After starting ydim-html as sudo -u apache /usr/bin/ruby18 -rubygems /var/www/ydim.ywesee.com/bin/ydim-htmld config=/etc/ydim/ydimd.yml I am unable to login. Why? Okay. The mail_from address in /etc/ydim/ydimd.yml had a "'", too much. Sometimes one should take an error message for serious, without having to revert to debuggers!

Now I am able to create debitors, but unable to create an invoice. See

I dropped the database and loaded the ydim from thinpower. Also in this case I am unable

Same behaviour for chromium and firefox. I don't see any errors on ydim and ydim-html.

I think we have problem that ydim/ydim-html are based on ruby 1.8 and not based on gems but on what is laying around under site_ruby. But the mod_ruby is now ruby 1.9 where the rubygems are enable by default (as far as I remember). As we have drb calls from one ruby to another the dependency hell gets even bigger. (And is close to impossible to reproduce locally on oddb-ci2. If we want to reproduce it we should simply dump thinpowers root partition (around 150GB) to a an external USB disk and use this to boot here.)

But to resolve the problem I suggest creating a VM/docker container or whatever which should contain all needed stuff for running ydim, which would include:

  • Ruby 1.8.x (with some patches applied)
  • Postgresql 8.3.8 using the DB-dump
  • YDIM and YDIM-HTML with some additional Gemfile to be able use bundle install && bundle exec for easily reproducing using build dependencies
  • Apache2 with mod_ruby 1.8

Once this is running I would add redirect all https to ydim.ywesee.com to this new instance.

PS. ydim-html cannot be ported to Ruby >= 2.1 without rewriting pdfinvoice and replacing the pdf-writer gem by something like prawn. The other gems seem not have bigger problems under 2.3.0.

view · edit · sidebar · attach · print · history
Page last modified on April 12, 2016, at 05:36 PM