Creating the needed helper files for a gem and support for travis-CI
Creating also a sandoz.xmlconf.bbmb.ch.conf for /etc/apache/vhosts. Converting all test/*.rb to make the run. Having to convert a few files to UTF-8, using commands like iconv -f ISO-8859-14 -t utf-8 test/test_conversion/pharmacieplus_bdd.rb -o test/test_conversion/pharmacieplus_bdd.rb
Pushed commit Added bin/admin and bin/bbmbd.
Remarked that I must install gem xlmconv and xmlconv2. But having problem with the rockit dependencies. Source war on thinpower under /var/lib/trac/trac.ywesee.com/attachments/ticket/226/rockit.tar.gz
Tried to run yus as specified in /etc/service/run via cd /usr/local/src/yus18 && sudo -u apache /home/niklaus/.rbenv/versions/1.8.6-p420/bin/ruby bin/yus
.
/home/niklaus/.rbenv/versions/1.8.6-p420/bin/gem install pg --version 0.8.0 /home/niklaus/.rbenv/versions/1.8.6-p420/bin/gem install dbd-pg --version 0.3.9
Now it fails with /home/niklaus/.rbenv/versions/1.8.6-p420/lib/ruby/gems/1.8/gems/odba-1.0.0/lib/odba/marshal.rb:15:in `load': instance of Yus::Entity needs to have method `marshal_load' (TypeError)
. The onigurama patch is missing. The patch is locally present under /usr/local/src/oniguruma_patch_for_ruby-1.8.6_p369.20100615_from_Hannes-san.tar.gz
Reinstalled via
gunzip /usr/local/src/oniguruma_patch_for_ruby-1.8.6_p369.20100615_from_Hannes-san.tar.gz
rm -rf /home/niklaus/.rbenv/versions/1.8.6-p420
rbenv install --patch 1.8.6-p420 /usr/local/src/oniguruma_patch_for_ruby-1.8.6_p369.20100615_from_Hannes-san.tar
Patching failed with
<..> 10 out of 14 hunks FAILED -- saving rejects to file re.c.rej patching file string.c Hunk #1 FAILED at 1989. Hunk #2 FAILED at 2113. 2 out of 2 hunks FAILED -- saving rejects to file string.c.rej patch unexpectedly ends in middle of line <..>
Therefore following ruby installation http://dev.ywesee.com/Yasu/20130613-setup-bbmb-sandoz-in-fastpower#ruby-1-8-6
On fastpower ruby 1.8.6 is installed under /usr/local/bin/ruby186 and was built in Juna 2013, as shown by
ngiger@fastpower ~ $ /usr/local/bin/ruby186/bin/ruby --version ruby 1.8.6 (2009-06-08 patchlevel 369) [x86_64-linux] ngiger@fastpower ~ $ ls -l /usr/local/bin/ruby186/bin/ruby -rwxr-xr-x 1 root root 11582 Jun 13 2013 /usr/local/bin/ruby186/bin/ruby
Whereas on thinpower ruby186 is under /usr/local/bin and compiled on march 2016. As show by
ywesee@thinpower ~ $ /usr/local/bin/ruby186 -v ruby 1.8.6 (2010-01-11 patchlevel 388) [x86_64-linux] ywesee@thinpower ~ $ ls -l /usr/local/bin/ruby186 -rwxr-xr-x 1 root root 1249603 19. Mär 01:43 /usr/local/bin/ruby186
But I cannot find the original tar for ruby 1.8.6-p369 on ruby-lang.org anymore. Nearest one is ruby-1.8.6-p383.tar.gz. Copied /usr/local/src/ruby-1.8.6-p369.tar.gz from fastpower and running gen_mod_ruby. Adapting the gne_mod_ruby to install everything under /usr/local/ruby-1.8.6-p388. This prevents conflicts when installing gems. Also disabling generating docs by configuring with --disable-install-doc.
This looks okay
niklaus@oddb-ci2 /u/l/s/ruby-1.8.6-p388> ls -l /usr/local/ruby-1.8.6-p388/bin/ruby18 -rwxr-xr-x 1 root root 1244904 30. Mai 09:17 /usr/local/ruby-1.8.6-p388/bin/ruby18* niklaus@oddb-ci2 /u/l/s/ruby-1.8.6-p388> /usr/local/ruby-1.8.6-p388/bin/ruby18 -v ruby 1.8.6 (2010-01-11 patchlevel 388) [x86_64-linux]
Install RubyGems 1.4.1 via git clone https://github.com/rubygems/rubygems/tree/v1.4.1 /usr/local/src/rubygems-1.4.1/. Added the lines
cd /usr/local/src/rubygems-1.4.1/ /usr/local/ruby-1.8.6-p388/bin/ruby18 setup.rbto gen_ruby_186 to install the gem18 command, too. Now the complete gen_ruby_186 looks like this Attach:gen_ruby_186-p388.sh.txt Installing needed gems like this
/usr/local/1.8.6-p388/bin/gem18 install rclconf --version=1.0.0 /usr/local/1.8.6-p388/bin/gem18 install odba --version=1.1.0 /usr/local/1.8.6-p388/bin/gem18 install dbi --version=0.4.5 /usr/local/1.8.6-p388/bin/gem18 install pg --version 0.8.0 /usr/local/1.8.6-p388/bin/gem18 install dbd-pg --version=0.3.9 /usr/local/1.8.6-p388/bin/gem18 install needle --version=1.3.0
On thinpower /service/yus/run runs /usr/bin/yusd which points to /home/ywesee/git/yus/bin/yusd whi
Changed /etc/service/run
to
exec sudo -u apache /usr/local/1.8.6-p388/bin/ruby18 bin/yusd
Trying the same on oddb-ci2 (With my Ruby 1.8.6-p388) I get
niklaus@oddb-ci2 /u/l/s/yus18> sudo -u apache /usr/local/1.8.6-p388/bin/ruby18 /home/niklaus/yus_from_thinpower/bin/yusd /home/niklaus/yus_from_thinpower/bin/yusd:5:in `require': no such file to load -- rclconf (LoadError) from /home/niklaus/yus_from_thinpower/bin/yusd:5 niklaus@oddb-ci2 /u/l/s/yus18>
Okay. The site_ruby on oddb-ci2 is not set-up as I installed gems.Looking at the situation on thinpower I see
exec sudo -u apache ruby -rubygems /usr/bin/yusd thinpower yus # ls -l /usr/lib64/ruby/site_ruby/1.8/rclconf lrwxrwxrwx 1 root root 36 6. Apr 2009 /usr/lib64/ruby/site_ruby/1.8/rclconf -> /home/ywesee/git/rclconf/lib/rclconf cd /home/ywesee/git/rclconf thinpower rclconf # git status -uno Auf Branch master zum Commit vorgemerkte Änderungen: (benutzen Sie "git reset HEAD <Datei>..." zum Entfernen aus der Staging-Area) gelöscht: History.txt gelöscht: LICENSE gelöscht: LICENSE.txt gelöscht: Manifest.txt gelöscht: README.txt gelöscht: Rakefile neue Datei: install.rb geändert: lib/rclconf.rb geändert: lib/rclconf/rclconf.rb gelöscht: rclconf.gemspec gelöscht: setup.rb Unversionierte Dateien nicht aufgelistet (benutzen Sie die Option -u, um unversionierte Dateien anzuzeigen) thinpower rclconf # git log -1 commit 81236a99736bcc7a0c69d169a0680649ff0abc6f Author: Zeno R.R. Davatz <zdavatz@ywesee.com> Date: Thu Dec 16 16:10:23 2010 +0100 Updated Manifest.txt thinpower rclconf # git diff HEAD lib/rclconf.rb lib/rclconf/rclconf.rb diff --git a/lib/rclconf.rb b/lib/rclconf.rb index 398af75..3aceced 100644 --- a/lib/rclconf.rb +++ b/lib/rclconf.rb @@ -2,7 +2,3 @@ # rclconf -- rclconf -- 21.01.2004 -- hwyss@ywesee.com require 'rclconf/rclconf' - -class Rclconf - VERSION = '1.0.0' -end diff --git a/lib/rclconf/rclconf.rb b/lib/rclconf/rclconf.rb index 21a391b..f8b848f 100644 --- a/lib/rclconf/rclconf.rb +++ b/lib/rclconf/rclconf.rb @@ -53,9 +53,6 @@ module RCLConf memo } end - def reset! - @runtime.clear - end def respond_to?(symbol) key = symbol.to_s /=$/.match(key) || [@runtime, @argv, @loaded, @defaults].any? { |coll|
After executing sudo ln -s /home/niklaus/git/rclconf/lib/rclconf.rb /usr/local/1.8.6-p388/lib/ruby/site_ruby/1.8
and sudo ln -s /home/niklaus/git/rclconf/lib/rclconf /usr/local/1.8.6-p388/lib/ruby/site_ruby/1.8
I git for sudo -u apache /usr/local/1.8.6-p388/bin/ruby18 /home/niklaus/yus_from_thinpower/bin/yusd
te error
/home/niklaus/yus_from_thinpower/lib/yus/persistence/odba.rb:4:in `require': no such file to load -- odba (LoadError) from /home/niklaus/yus_from_thinpower/lib/yus/persistence/odba.rb:4 from /home/niklaus/yus_from_thinpower/bin/yusd:43:in `require' from /home/niklaus/yus_from_thinpower/bin/yusd:43
Okay. I am on the good road. Must complete this step for the other missing gems. Creating a small batch file for it.
Changed all files to use site_ruby but I still get the error
sudo -u apache /usr/local/1.8.6-p388/bin/ruby18 /home/niklaus/yus_from_thinpower/bin/yusd FEHLER: Relation »object« existiert bereits FEHLER: Relation »prefetchable_index« existiert bereits FEHLER: Relation »extent_index« existiert bereits FEHLER: Relation »object_connection« existiert bereits FEHLER: Relation »target_id_index« existiert bereits FEHLER: Relation »collection« existiert bereits /usr/local/1.8.6-p388/lib/ruby/site_ruby/1.8/odba/marshal.rb:15:in `load': instance of Yus::Entity needs to have method `marshal_load' (TypeError) from /usr/local/1.8.6-p388/lib/ruby/site_ruby/1.8/odba/marshal.rb:15:in `load' from /usr/local/1.8.6-p388/lib/ruby/site_ruby/1.8/odba/cache.rb:629:in `restore' from /usr/local/1.8.6-p388/lib/ruby/site_ruby/1.8/odba/cache.rb:319:in `fetch_or_restore' from /usr/local/1.8.6-p388/lib/ruby/site_ruby/1.8/odba/cache.rb:314:in `call' from /usr/local/1.8.6-p388/lib/ruby/site_ruby/1.8/odba/cache.rb:314:in `fetch_or_do' from /usr/local/1.8.6-p388/lib/ruby/site_ruby/1.8/odba/cache.rb:318:in `fetch_or_restore' from /usr/local/1.8.6-p388/lib/ruby/site_ruby/1.8/odba/cache.rb:66:in `bulk_restore' from /usr/local/1.8.6-p388/lib/ruby/site_ruby/1.8/odba/cache.rb:63:in `each' ... 11 levels... from /usr/local/1.8.6-p388/lib/ruby/site_ruby/1.8/odba/cache.rb:297:in `fetch_named' from /home/niklaus/yus_from_thinpower/lib/yus/persistence/odba.rb:14:in `initialize' from /home/niklaus/yus_from_thinpower/bin/yusd:53:in `new' from /home/niklaus/yus_from_thinpower/bin/yusd:53
After dropping the yus database (a locally created database from scratch by me a long time ago) with a recent copy from thinpower made the error go away.
Now yus and oddb-ci2.dyndns.org/ start up. Did see that it takes longer than experiences before till oddb-ci2 starts up. Calling sudo -u apache /usr/local/bin/ruby193 jobs/rebuild_indices
before investigating the problem.
Now looking whether the sandoz_yus can be started. Via sudo -u apache /usr/local/1.8.6-p388/bin/ruby18 /home/niklaus/yus_from_thinpower/bin/yusd config=/var/www/sandoz.bbmb.ch/etc/yus.yml
I am getting the error
FEHLER: Relation »object« existiert bereits FEHLER: Relation »prefetchable_index« existiert bereits FEHLER: Relation »extent_index« existiert bereits FEHLER: Relation »object_connection« existiert bereits FEHLER: Relation »target_id_index« existiert bereits FEHLER: Relation »collection« existiert bereits /usr/local/1.8.6-p388/lib/ruby/site_ruby/1.8/odba/marshal.rb:15:in `load': undefined class/module Encoding:: (ArgumentError) from /usr/local/1.8.6-p388/lib/ruby/site_ruby/1.8/odba/marshal.rb:15:in `load' from /usr/local/1.8.6-p388/lib/ruby/site_ruby/1.8/odba/cache.rb:629:in `restore' from /usr/local/1.8.6-p388/lib/ruby/site_ruby/1.8/odba/cache.rb:319:in `fetch_or_restore' from /usr/local/1.8.6-p388/lib/ruby/site_ruby/1.8/odba/cache.rb:314:in `call' from /usr/local/1.8.6-p388/lib/ruby/site_ruby/1.8/odba/cache.rb:314:in `fetch_or_do' from /usr/local/1.8.6-p388/lib/ruby/site_ruby/1.8/odba/cache.rb:318:in `fetch_or_restore' from /usr/local/1.8.6-p388/lib/ruby/site_ruby/1.8/odba/cache.rb:66:in `bulk_restore' from /usr/local/1.8.6-p388/lib/ruby/site_ruby/1.8/odba/cache.rb:63:in `each' ... 11 levels... from /usr/local/1.8.6-p388/lib/ruby/site_ruby/1.8/odba/cache.rb:297:in `fetch_named' from /home/niklaus/yus_from_thinpower/lib/yus/persistence/odba.rb:14:in `initialize' from /home/niklaus/yus_from_thinpower/bin/yusd:53:in `new' from /home/niklaus/yus_from_thinpower/bin/yusd:53
On fastpower we see in /service/sandoz.bbmb.ch-yus/run that it calls sudo -u bbmb /usr/local/bin/ruby186/bin/ruby -rubygems /usr/local/share/src/yus/bin/yusd config=/var/www/sandoz.bbmb.ch/etc/yus.yml
. It uses rubygems and the following gems
/usr/local/bin/ruby186/bin/gem list --local *** LOCAL GEMS *** character-encodings (0.3.0) color (1.4.1) dbd-pg (0.3.9) dbi (0.4.5) deprecated (3.0.1, 2.0.1) fastthread (1.0.7) hpricot (0.8.6) htmlgrid (1.0.6, 1.0.3, 1.0.0) json (1.8.0) mysql (2.8.1) needle (1.3.0) odba (1.1.0) pdf-writer (1.1.8) pg (0.8.0) rclconf (1.0.0) rmagick (2.13.2) rmail (1.0.0) ruby-json (1.1.2) ruby-ole (1.2.11.6) sbsm (1.2.3) smtp_tls (1.0.3) spreadsheet (0.8.5) tmail (1.2.7.1) transaction-simple (1.4.0.2) ydim (1.0.0) yus (1.0.1)
In the site_ruby we find beside gems the directories dbd, pdfinvoice, rbconfig and rockit
ls -l /usr/local/bin/ruby186/lib/ruby/site_ruby/1.8/ total 68 drwxr-xr-x 7 root root 80 Jun 13 2013 dbd -rw-r--r-- 1 root root 1415 Jun 13 2013 gauntlet_rubygems.rb drwxrwxr-x 2 root root 4096 Aug 6 2013 mnemonic drwxr-xr-x 2 root root 16 Jun 15 2013 pdfinvoice drwxr-xr-x 2 root root 8 Jun 13 2013 rbconfig drwxr-xr-x 2 root root 4096 Mar 19 2009 rockit drwxr-xr-x 5 root root 4096 Jun 25 2013 rubygems -rw-r--r-- 1 root root 30759 Jun 13 2013 rubygems.rb -rw-r--r-- 1 root root 268 Jun 13 2013 ubygems.rb drwxr-xr-x 2 root root 1 Jun 13 2013 x86_64-linux
But Encoding is a Ruby 1.9 class. As I had converted sandoz_yus to Ruby 2.3 I must reload the original dump from fastpower.
Getting errors while installing charcter-encodings even when specifing CFLAGS=" -Wno-error"
sudo CXXFLAGS="-Wno-error" CFLAGS=" -Wno-error" /usr/local/1.8.6-p388/bin/gem18 install character-encodings --version=0.3.0 <..> rb_utf_tr.c:107:14: error: variable 'modified' set but not used [-Werror=unused-but-set-variable] bool modified = false; ^ cc1: all warnings being treated as errors Makefile:146: recipe for target 'rb_utf_tr.o' failed make: *** [rb_utf_tr.o] Error 1 Gem files will remain installed in /usr/local/1.8.6-p388/lib/ruby/gems/1.8/gems/character-encodings-0.3.0 for inspection. Results logged to /usr/local/1.8.6-p388/lib/ruby/gems/1.8/gems/character-encodings-0.3.0/ext/encoding/character/utf-8/gem_make.out
But the ruby18 installed under /usr does not have this problem and sudo gem18 install character-encodings -v 0.3.0 -- --with-cflags=\"-Wno-unused-but-set-variable\"
ran without problem. Trying to use this ruby version and calling sudo -u apache /usr/bin/ruby18 -rubygems /home/niklaus/yus_from_thinpower/bin/yusd config=/var/www/sandoz.bbmb.ch/etc/yus.yml
After executing
# Simple script to install the same gems as on fastpower to run # sandoz.bbmb.ch-yus sudo /usr/bin/gem18 install character-encodings --version=0.3.0 -with-cflags=\"-Wno-unused-but-set-variable\" sudo /usr/bin/gem18 install dbi --version=0.4.5 sudo /usr/bin/gem18 install needle --version=1.3.0 sudo /usr/bin/gem18 install pg --version=0.8.0 sudo /usr/bin/gem18 install dbd-pg --version=0.3.9 sudo /usr/local/1.8.6-p388/bin/gem18 install /home/niklaus/git/ruby-dbi/pkg/db*.gem sudo ln -s /usr/lib64/ruby/gems/1.8/gems/dbd-pg-0.3.9/lib/dbd/Pg.rb /usr/lib64/ruby/gems/1.8/gems/dbd-pg-0.3.9/lib/dbd/pg.rb
But am I using the right database? The following output confuses me.
/usr/local/1.8.6-p388/bin/ruby18 -rubygems /home/niklaus/yus_from_thinpower/bin/yus_show --config=/var/www/sandoz.bbmb.ch/etc/yus.yml hwyss@ywesee.com Password for ngiger@ywesee.com: ["hwyss@ywesee.com", ["edit", [["yus.entities"]]], ["grant", [["login"]]], ["login", [["ch.bbmb.vetoquinol.Admin"]]], ["set_password", [["everything"], ["hwyss@ywesee.com"]]]]
But adding before the config worked an I get now
usr/local/1.8.6-p388/bin/ruby18 -rubygems /home/niklaus/yus_from_thinpower/bin/yus_show --config=/var/www/sandoz.bbmb.ch/etc/yus.yml --server_url="druby://localhost:12005" ngiger@ywesee.com Password for ngiger@ywesee.com: ["ngiger@ywesee.com", ["login", [["ch.bbmb.Customer"]]], ["root", [["everything"]]], ["set_password", [["ngiger@ywesee.com"]]]] Verifying, whether I have access to the database: [@ /usr/local/1.8.6-p388/bin/ruby18 -rubygems /home/niklaus/yus_from_thinpower/bin/yus_show ngiger@ywesee.com Password for ngiger@ywesee.com: ["ngiger@ywesee.com", ["create", [["org.oddb.registration"], ["org.oddb.task.background"]]], ["credit", [["org.oddb.download"]]], ["edit", [["org.oddb.drugs"], ["org.oddb.model.!address.*"], ["org.oddb.model.!atc_class.*"], ["org.oddb.model.!company.*"], ["org.oddb.model.!galenic_group.*"], ["org.oddb.model.!indication.*"], ["org.oddb.model.!sponsor.*"], ["yus.entities"]]], ["grant", [["create"], ["credit"], ["edit"], ["view"]]], ["login", [["org.oddb.RootUser"]]], ["reset_password", []], ["set_password", [["ngiger@ywesee.com"]]], ["view", [["org.oddb.patinfo_stats"]]], ["AdminUser", "RootUser"]]
Okay. This is oddb.org. Adding the config to use the sandoz_yus failes with
niklaus@oddb-ci2 /v/w/sandoz.bbmb.ch> /usr/local/1.8.6-p388/bin/ruby18 -rubygems /home/niklaus/yus_from_thinpower/bin/yus_show config=/var/www/sandoz.bbmb.ch/etc/yus.yml ngiger@ywesee.com Password for ngiger@ywesee.com: (drbssl://localhost:9997) /home/niklaus/yus_from_thinpower/lib/yus/session.rb:160:in `find_or_fail': Unknown Entity 'config=/var/www/sandoz.bbmb.ch/etc/yus.yml' (Yus::UnknownEntityError) from (drbssl://localhost:9997) /home/niklaus/yus_from_thinpower/lib/yus/session.rb:329:in `show' from /home/niklaus/yus_from_thinpower/bin/yus_show:65
I could start /service/sandoz.bbmb.ch-yus. And see the login screen at http://sandoz.oddb-ci2.dyndns.org/. Will investigate this later, if I need to.
Installed the gems with the following commands
sudo /usr/local/bin/ruby186/bin/gem install character-encodings --version=0.3.0 -- --with-cflags=\"-Wno-unused-but-set-variable\" sudo /usr/local/bin/ruby186/bin/gem install needle --version=1.3.0 sudo /usr/local/bin/ruby186/bin/gem install pg --version=0.8.0 sudo /usr/local/bin/ruby186/bin/gem install dbd-pg --version=0.3.9 sudo /usr/local/bin/ruby186/bin/gem install rclconf --version=1.0.0 sudo /usr/local/bin/ruby186/bin/gem install odba --version=1.1.0 sudo /usr/local/bin/ruby186/bin/gem install pg --version 0.8.0 sudo /usr/local/bin/ruby186/bin/gem install dbd-pg --version=0.3.9 sudo /usr/local/bin/ruby186/bin/gem install yus --version=1.0.1
Now yusd starts when colled like this sudo -u apache /usr/local/bin/ruby186/bin/ruby -rubygems /usr/local/bin/ruby186/bin/yusd config=/var/www/sandoz.bbmb.ch/etc/yus.yml
But on fastpower I have 4 different yusd instances running
ngiger@fastpower /var/www/sandoz.bbmb.ch $ ps -ef | grep yusd apache 2989 2975 0 2015 ? 00:33:39 /usr/local/bin/ruby186/bin/ruby -rubygems /usr/local/bin/ruby186/bin/yusd bbmb 3001 2997 0 2015 ? 1-01:19:19 /usr/local/bin/ruby186/bin/ruby -rubygems /usr/local/share/src/yus/bin/yusd config=/var/www/sandoz.bbmb.ch//etc/yus.yml bbmb 3022 3019 0 2015 ? 22:53:41 /usr/local/bin/ruby186/bin/ruby -rubygems /usr/local/share/src/yus/bin/yusd config=/var/www/vetoquinol.bbmb.ch//etc/yus.yml bbmb 3034 3028 0 2015 ? 1-12:14:13 /usr/local/bin/ruby186/bin/ruby -rubygems /usr/local/share/src/yus/bin/yusd config=/var/www/virbac.bbmb.ch//etc/yus.yml
The situation in /usr/local/share/src/yus is the following. Checkout is
ngiger@fastpower /var/www/sandoz.bbmb.ch $ git log -1 commit c5f57e33a8967e9d6a9417e8af608e15215b74a4 Author: Yasuhiro Asaka <grauwoelfchen@gmail.com> Date: Sat Jun 15 02:26:07 2013 +0900 Rename pg driver name to Pg - pg(ruby-pg) gem expects 'Pg' (not 'pg') ngiger@fastpower /usr/local/share/src/yus $ git status -uno # On branch master nothing to commit (use -u to show untracked files) ngiger@fastpower /usr/local/share/src/yus $ cat .git/config [core] repositoryformatversion = 0 filemode = true bare = false logallrefupdates = true [remote "origin"] url = git://scm.ywesee.com/yus/.git fetch = +refs/heads/*:refs/remotes/origin/* [branch "master"] remote = origin merge = refs/heads/master
Checkout out the same commit as branch fastpower on /usr/local/src/yus and now /service/sandoz.bbmb.ch-yus/ starts up correctly.