view · edit · sidebar · attach · print · history

Index>

20161004-mysql-davaz

Summary

  • www.steinwies.ch or www.davaz.com show sometimes an empty page
  • Keep in Mind

Commits

Index

Must setup the mysql database. Used the following steps

  • Set the root password with sudo emerge --config =dev-db/mysql-5.5.52
  • Create the database running mysql -u root -h localhost -p (Using username/password from etc/db_connection_data.yml
  mysql> create database davaz2;
  Query OK, 1 row affected (0.00 sec)

  mysql> grant all privileges on davaz2.* to davaz@localhost identified by 'top-secret';
  Query OK, 0 rows affected (0.00 sec)

  mysql> flush privileges;
  Query OK, 0 rows affected (0.00 sec)

Now after restarting the davaz.com I see in the errorlog DRb::DRbConnError - drbssl://localhost:9997, which means it cannot connect to the yus daemon. This is a problem because on my gentoo server I already have a YUS database for oddb.org. And as Yasuhiro pointed out: "yus database and its relation objects's owner must be yus user. (not only database)".

Using psql -U postgres and emit \l to list all databases on fastpower I find the following ones containing yus in their name

 bbmb_yus           | postgres | UTF8     | C         | C     | 
 sandoz_yus         | postgres | UTF8     | C         | C     | 
 virbac_yus         | postgres | UTF8     | C         | C     | 
 yus                | postgres | UTF8     | C         | C     | 

Why didn't Yasu use a name like davaz_yus for the database? I will try to create a /var/www/davaz.com/etc/yus.yml.
The page begins to show. See

On oddb-ci2 we used /usr/lib64/apache2/modules/mod_ruby.so which comes from /usr/local/src/mod_ruby/mod_ruby.so. Getting mod_ruby.so from fastpower. Now I get an "Internal Server Error" when looking at (steinwies|davaz).ngiger.ch. But I had copied the file from thinpower, not fastpower. After copying it from fastpower(size 494703), apache2 does not start and emits the error

 * apache2 has detected an error in your setup:
apache2: Syntax error on line 155 of /etc/apache2/httpd.conf: Syntax error on line 4 of /etc/apache2/modules.d/21_mod_ruby.conf: Cannot load /usr/lib64/apache2/modules/mod_ruby.so into server: libruby.so.1.8: cannot open shared object file: No such file or directory
 * ERROR: apache2 failed to stop

even when the file /usr/lib64/apache2/modules/mod_ruby.so exists.

Ran ./gen_mod_ruby_193p547 in /usr/local/src to compile mod_ruby using Ruby 1.9.3.

Had to kill -9 all apache process, remove /var/run/apache2.pid and restart apache. Now the both pages display fine again.

On fastpower we use mod_ruby compiled against Ruby 1.8.6 as seen be lines like RubyAddPath /usr/local/bin/ruby186/lib/ruby in /etc/apache2/modules.d/21_mod_ruby.conf

Why do the image not display correctly? The link points to http://davaz.ngiger.ch/en/personal/life/null. Why?

In the error_log I find

15086 [Tue Oct 04 09:52:01 2016] [error] mod_ruby: error in ruby
15087 [Tue Oct 04 09:52:01 2016] [error] mod_ruby: /usr/local/lib/ruby/site_ruby/1.9.1/rubygems/basic_specification.rb:62:in `file?': Insecure operation - file? (SecurityError)
15088 [Tue Oct 04 09:52:01 2016] [error] mod_ruby:   from /usr/local/lib/ruby/site_ruby/1.9.1/rubygems/basic_specification.rb:62:in `block (2 levels) in contains_requirable_file?'
15089 [Tue Oct 04 09:52:01 2016] [error] mod_ruby:   from /usr/local/lib/ruby/site_ruby/1.9.1/rubygems/basic_specification.rb:62:in `each'
15090 [Tue Oct 04 09:52:01 2016] [error] mod_ruby:   from /usr/local/lib/ruby/site_ruby/1.9.1/rubygems/basic_specification.rb:62:in `any?'
15091 [Tue Oct 04 09:52:01 2016] [error] mod_ruby:   from /usr/local/lib/ruby/site_ruby/1.9.1/rubygems/basic_specification.rb:62:in `block in contains_requirable_file?'
15092 [Tue Oct 04 09:52:01 2016] [error] mod_ruby:   from /usr/local/lib/ruby/site_ruby/1.9.1/rubygems/basic_specification.rb:60:in `each'
15093 [Tue Oct 04 09:52:01 2016] [error] mod_ruby:   from /usr/local/lib/ruby/site_ruby/1.9.1/rubygems/basic_specification.rb:60:in `any?'
15094 [Tue Oct 04 09:52:01 2016] [error] mod_ruby:   from /usr/local/lib/ruby/site_ruby/1.9.1/rubygems/basic_specification.rb:60:in `contains_requirable_file?'
15095 [Tue Oct 04 09:52:01 2016] [error] mod_ruby:   from /usr/local/lib/ruby/site_ruby/1.9.1/rubygems/specification.rb:925:in `block in find_inactive_by_path'
15096 [Tue Oct 04 09:52:01 2016] [error] mod_ruby:   from /usr/local/lib/ruby/site_ruby/1.9.1/rubygems/specification.rb:924:in `each'
15097 [Tue Oct 04 09:52:01 2016] [error] mod_ruby:   from /usr/local/lib/ruby/site_ruby/1.9.1/rubygems/specification.rb:924:in `find'
15098 [Tue Oct 04 09:52:01 2016] [error] mod_ruby:   from /usr/local/lib/ruby/site_ruby/1.9.1/rubygems/specification.rb:924:in `find_inactive_by_path'
15099 [Tue Oct 04 09:52:01 2016] [error] mod_ruby:   from /usr/local/lib/ruby/site_ruby/1.9.1/rubygems.rb:185:in `try_activate'
15100 [Tue Oct 04 09:52:01 2016] [error] mod_ruby:   from /usr/local/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:132:in `rescue in require'
15101 [Tue Oct 04 09:52:01 2016] [error] mod_ruby:   from /usr/local/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:144:in `require'
15102 [Tue Oct 04 09:52:01 2016] [error] mod_ruby:   from /var/www/steinwies.ch/vendor/ruby/2.3.0/gems/sbsm-1.3.0/lib/sbsm/trans_handler.rb:127:in `uri_parser'
15103 [Tue Oct 04 09:52:01 2016] [error] mod_ruby:   from /var/www/steinwies.ch/vendor/ruby/2.3.0/gems/sbsm-1.3.0/lib/sbsm/trans_handler.rb:76:in `parse_uri'
15104 [Tue Oct 04 09:52:01 2016] [error] mod_ruby:   from /var/www/steinwies.ch/vendor/ruby/2.3.0/gems/sbsm-1.3.0/lib/sbsm/trans_handler.rb:107:in `translate_uri'

Looking at the source code it does a require parser_path

When going to http://davaz.ngiger.ch/en/personal/home I see in the log/access_log every 4 seconds an entry like

  127.0.0.1 - - [04/Oct/2016:11:00:49 +0200] "GET /en/personal/undefined HTTP/1.1" 200 7572 "http://davaz.ngiger.ch/en/personal/home" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/54.0.2840.34 Safari/537.36"

Create database in sudo -u postgres psql via

postgres=# create database davaz_yus  WITH ENCODING 'UTF8' TEMPLATE = template0;
CREATE DATABASE

postgres=# create role davaz with password 'davaz';
CREATE ROLE

postgres=# ALTER ROLE "davaz" CREATEDB  LOGIN;
ALTER ROLE

postgres=# ALTER database "davaz_yus" owner to "davaz";
ALTER DATABASE

Loaded database dump via zcat 22:00-postgresql_database-yus-backup.gz | psql --host localhost -U davaz davaz_yus. Tested in psql --host localhost -U davaz davaz_yus to verify that select count(*) from object_connection; returns 6.

Remarked that visting http://davaz.com/en/communication/links/ returns an error saying NoMethodError undefined method `title' for #. The console output shows

error in SBSM::Session#to_html: /en/communication/links/
NoMethodError
undefined method `title' for #<DaVaz::Model::Link:0x0000000221fd20>
/var/www/davaz.com/src/view/_partial/textblock.rb:185:in `title_to_html'
/var/www/davaz.com/src/view/_partial/textblock.rb:194:in `to_html'
/var/www/davaz.com/vendor/ruby/2.3.0/gems/htmlgrid-1.1.3/lib/htmlgrid/divcomposite.rb:42:in `block (3 levels) in to_html'
/var/www/davaz.com/vendor/ruby/2.3.0/gems/htmlgrid-1.1.3/lib/htmlgrid/divcomposite.rb:40:in `each'
/var/www/davaz.com/vendor/ruby/2.3.0/gems/htmlgrid-1.1.3/lib/htmlgrid/divcomposite.rb:40:in `inject'
/var/www/davaz.com/vendor/ruby/2.3.0/gems/htmlgrid-1.1.3/lib/htmlgrid/divcomposite.rb:40:in `block (2 levels) in to_html'

After copying 150MB from /var/www/new.davaz.com/doc/resources/uploads/ on fastpower to oddb-ci2, all images and movies displayed correctly.

I propose to switch mod_ruby on fastpower from running under Ruby 1.8.6 to Ruby 1.9.3 and to adapt the /etc/apache2/modules.d/21_mod_ruby.conf as soon as bbmb and vetoquinol run under Ruby 1.9.

The script gen_mod_ruby_193 calls "make install", which copies files like ruby-run.rb to the sub-directory src/mod_ruby/lib/apache of the installation path defined by the --prefix argument passed to configure.rb. The default is /usr/. E.g

 ls -l1 /usr/local/src/mod_ruby/lib/apache/*.rb
-rw-r--r-- 1 zdavatz zdavatz  3680 15. Mai 22:34 /usr/local/src/mod_ruby/lib/apache/erb-run.rb
-rw-r--r-- 1 zdavatz zdavatz  3381 15. Mai 22:34 /usr/local/src/mod_ruby/lib/apache/eruby-debug.rb
-rw-r--r-- 1 zdavatz zdavatz  3315 15. Mai 22:34 /usr/local/src/mod_ruby/lib/apache/eruby-run.rb
-rw-r--r-- 1 zdavatz zdavatz  6148 15. Mai 22:34 /usr/local/src/mod_ruby/lib/apache/query.rb
-rw-r--r-- 1 zdavatz zdavatz 14581 15. Mai 22:34 /usr/local/src/mod_ruby/lib/apache/rails-dispatcher.rb
-rw-r--r-- 1 zdavatz zdavatz  3626 15. Mai 22:34 /usr/local/src/mod_ruby/lib/apache/rd2html.rb
-rw-r--r-- 1 zdavatz zdavatz  2353 15. Mai 22:34 /usr/local/src/mod_ruby/lib/apache/registry.rb
-rw-r--r-- 1 zdavatz zdavatz  3428 15. Mai 22:34 /usr/local/src/mod_ruby/lib/apache/ruby-debug.rb
-rw-r--r-- 1 zdavatz zdavatz  3956 15. Mai 22:34 /usr/local/src/mod_ruby/lib/apache/ruby-profile.rb
-rw-r--r-- 1 zdavatz zdavatz  2531 15. Mai 22:34 /usr/local/src/mod_ruby/lib/apache/ruby-run.rb
ls -l /usr/local/lib/ruby/1.9.1/apache/
insgesamt 56
-rw-r--r-- 1 root root  3680  4. Okt 13:54 erb-run.rb
-rw-r--r-- 1 root root  3381  4. Okt 13:54 eruby-debug.rb
-rw-r--r-- 1 root root  3315  4. Okt 13:54 eruby-run.rb
-rw-r--r-- 1 root root  6148  4. Okt 13:54 query.rb
-rw-r--r-- 1 root root 14581  4. Okt 13:54 rails-dispatcher.rb
-rw-r--r-- 1 root root  3626  4. Okt 13:54 rd2html.rb
-rw-r--r-- 1 root root  2353  4. Okt 13:54 registry.rb
-rw-r--r-- 1 root root  3428  4. Okt 13:54 ruby-debug.rb
-rw-r--r-- 1 root root  3956  4. Okt 13:54 ruby-profile.rb
-rw-r--r-- 1 root root  2531  4. Okt 13:54 ruby-run.rb

Calling sudo rm -rf /usr/local/lib64/ruby/1.9.1/apache/. After an apache restart, steinwies.ngiger.ch still works.

Looking for erb-run.rb I found a duplicate in /usr/lib64/ruby/1.9.1/apache/erb-run.rb.

Calling sudo rm -rf /usr/lib64/ruby/1.9.1/apache/. After an apache restart, steinwies.ngiger.ch still works.

Calling sudo rm -rf /usr/local/lib64/ruby/1.8/apache. After an apache restart, steinwies.ngiger.ch still works.

Calling sudo rm -rf /usr/local/bin/ruby186/lib/ruby/1.8/apache. After an apache restart, steinwies.ngiger.ch does not work anymore. In the log/error_log I find (eval):127: (eval):127: uninitialized constant Apache::RubyRun (NameError)

But this can be explained, as I found a lines like RubyAddPath /usr/local/bin/ruby186/lib/ in /etc/apache2/modules.d/21_mod_ruby.conf. Removing these lines.

After calling sudo ./gen_mod_ruby_193p547 Apache2 does not start, as says:

  apache2: Syntax error on line 155 of /etc/apache2/httpd.conf: Syntax error on line 4 of /etc/apache2/modules.d/21_mod_ruby.conf:   Cannot load /usr/lib64/apache2/modules/mod_ruby.so into server: /usr/lib64/apache2/modules/mod_ruby.so: undefined symbol: rb_exc_new2

This is bizarr, as I found in https://docs.ruby-lang.org/en/2.1.0/ChangeLog.html that in error.c (rb_exc_new_cstr) as renamed from rb_exc_new2.

Recompiling 1.9.3 from source using gen_ruby_193-p547. And installing mod_ruby again. After restarting apache2 I can access , but not .

In the /var/www/davaz.com/log/error_log I find

[Tue Oct 04 14:29:47 2016] [error] mod_ruby: error in ruby
[Tue Oct 04 14:29:47 2016] [error] mod_ruby: /usr/local/lib/ruby/site_ruby/1.9.1/rubygems/basic_specification.rb:62:in `file?': Insecure operation - file? (SecurityError)
[Tue Oct 04 14:29:47 2016] [error] mod_ruby:   from /usr/local/lib/ruby/site_ruby/1.9.1/rubygems/basic_specification.rb:62:in `block (2 levels) in contains_requirable_file?'
[Tue Oct 04 14:29:47 2016] [error] mod_ruby:   from /usr/local/lib/ruby/site_ruby/1.9.1/rubygems/basic_specification.rb:62:in `each'
[Tue Oct 04 14:29:47 2016] [error] mod_ruby:   from /usr/local/lib/ruby/site_ruby/1.9.1/rubygems/basic_specification.rb:62:in `any?'
[Tue Oct 04 14:29:47 2016] [error] mod_ruby:   from /usr/local/lib/ruby/site_ruby/1.9.1/rubygems/basic_specification.rb:62:in `block in contains_requirable_file?'
[Tue Oct 04 14:29:47 2016] [error] mod_ruby:   from /usr/local/lib/ruby/site_ruby/1.9.1/rubygems/basic_specification.rb:60:in `each'
[Tue Oct 04 14:29:47 2016] [error] mod_ruby:   from /usr/local/lib/ruby/site_ruby/1.9.1/rubygems/basic_specification.rb:60:in `any?'
[Tue Oct 04 14:29:47 2016] [error] mod_ruby:   from /usr/local/lib/ruby/site_ruby/1.9.1/rubygems/basic_specification.rb:60:in `contains_requirable_file?'
[Tue Oct 04 14:29:47 2016] [error] mod_ruby:   from /usr/local/lib/ruby/site_ruby/1.9.1/rubygems/specification.rb:925:in `block in find_inactive_by_path'
[Tue Oct 04 14:29:47 2016] [error] mod_ruby:   from /usr/local/lib/ruby/site_ruby/1.9.1/rubygems/specification.rb:924:in `each'
[Tue Oct 04 14:29:47 2016] [error] mod_ruby:   from /usr/local/lib/ruby/site_ruby/1.9.1/rubygems/specification.rb:924:in `find'
[Tue Oct 04 14:29:47 2016] [error] mod_ruby:   from /usr/local/lib/ruby/site_ruby/1.9.1/rubygems/specification.rb:924:in `find_inactive_by_path'
[Tue Oct 04 14:29:47 2016] [error] mod_ruby:   from /usr/local/lib/ruby/site_ruby/1.9.1/rubygems.rb:185:in `try_activate'
[Tue Oct 04 14:29:47 2016] [error] mod_ruby:   from /usr/local/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:132:in `rescue in require'
[Tue Oct 04 14:29:47 2016] [error] mod_ruby:   from /usr/local/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:144:in `require'
[Tue Oct 04 14:29:47 2016] [error] mod_ruby:   from /var/www/steinwies.ch/vendor/ruby/2.3.0/gems/sbsm-1.3.0/lib/sbsm/trans_handler.rb:129:in `uri_parser'
[Tue Oct 04 14:29:47 2016] [error] mod_ruby:   from /var/www/steinwies.ch/vendor/ruby/2.3.0/gems/sbsm-1.3.0/lib/sbsm/trans_handler.rb:76:in `parse_uri'
[Tue Oct 04 14:29:47 2016] [error] mod_ruby:   from /var/www/steinwies.ch/vendor/ruby/2.3.0/gems/sbsm-1.3.0/lib/sbsm/trans_handler.rb:107:in `translate_uri'

Here the paths are messed up. Accessing davaz.ngiger.ch should use the gems from /var/www/davaz.com and not from /var/www/steinwies.ch.

But the SecurityError can probably be circumvented. Trying the solution from https://github.com/rubygems/rubygems/issues/1265.

Adding .untaint to the request_path in /usr/local/lib/ruby/gems/1.9.1/gems/sbsm-1.3.0/lib/sbsm/trans_handler.rb did not help.

After adding a RubyAddPath for each lib directory under /var/www/davaz.com/vendor/ruby/2.3.0/ to the /etc/apache2/vhosts.d/davaz.com.conf I got another error

[Tue Oct 04 15:25:51 2016] [error] mod_ruby: error in ruby                                                                                                                                                
[Tue Oct 04 15:25:51 2016] [error] mod_ruby: /usr/local/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:55:in `require': wrong argument type Apache::Request (expected File) (TypeError)             
[Tue Oct 04 15:25:51 2016] [error] mod_ruby:   from /usr/local/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:55:in `require'                                                                       
[Tue Oct 04 15:25:51 2016] [error] mod_ruby:   from /usr/local/lib/ruby/gems/1.9.1/gems/debugger-1.6.8/lib/ruby-debug/interface.rb:104:in `<class:LocalInterface>'                                       
[Tue Oct 04 15:25:51 2016] [error] mod_ruby:   from /usr/local/lib/ruby/gems/1.9.1/gems/debugger-1.6.8/lib/ruby-debug/interface.rb:45:in `<module:Debugger>'                           
[Tue Oct 04 15:25:51 2016] [error] mod_ruby:   from /usr/local/lib/ruby/gems/1.9.1/gems/debugger-1.6.8/lib/ruby-debug/interface.rb:1:in `<top (required)>'               
[Tue Oct 04 15:25:51 2016] [error] mod_ruby:   from /usr/local/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:55:in `require'                                                    
[Tue Oct 04 15:25:51 2016] [error] mod_ruby:   from /usr/local/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:55:in `require'                           
[Tue Oct 04 15:25:51 2016] [error] mod_ruby:   from /usr/local/lib/ruby/gems/1.9.1/gems/debugger-1.6.8/lib/ruby-debug/processor.rb:1:in `<top (required)>'                          
[Tue Oct 04 15:25:51 2016] [error] mod_ruby:   from /usr/local/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:55:in `require'                                      
[Tue Oct 04 15:25:51 2016] [error] mod_ruby:    ... 25 levels...                                                                                         
[Tue Oct 04 15:25:51 2016] [error] mod_ruby:   from /usr/local/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:55:in `require'                     
[Tue Oct 04 15:25:51 2016] [error] mod_ruby:   from /var/www/davaz.com/vendor/ruby/2.3.0/gems/sbsm-1.3.0/lib/sbsm/trans_handler.rb:116:in `uri_parser'                   
[Tue Oct 04 15:25:51 2016] [error] mod_ruby:   from /var/www/davaz.com/vendor/ruby/2.3.0/gems/sbsm-1.3.0/lib/sbsm/trans_handler.rb:76:in `parse_uri'                             
[Tue Oct 04 15:25:51 2016] [error] mod_ruby:   from /var/www/davaz.com/vendor/ruby/2.3.0/gems/sbsm-1.3.0/lib/sbsm/trans_handler.rb:107:in `translate_uri'                   

Copyied the davaz.com.conf to ~/davaz.com.conf.all_vendor (for later inspection if needed).

Changed davaz.com.conf to contain only the following RubyAddPath

RubyAddPath /usr/local/lib/ruby/gems/1.9.1/gems/sbsm-1.3.0/lib
RubyAddPath /usr/local/lib/ruby/gems/1.9.1/gems/rclconf-1.0.0/lib
RubyAddPath /var/www/davaz.com/src

After restarting apache and davaz I get the following error

[Tue Oct 04 15:36:51 2016] [error] mod_ruby: error in ruby
[Tue Oct 04 15:36:51 2016] [error] mod_ruby: /usr/local/lib/ruby/site_ruby/1.9.1/rubygems/basic_specification.rb:62:in `file?': Insecure operation - file? (SecurityError)
[Tue Oct 04 15:36:51 2016] [error] mod_ruby:   from /usr/local/lib/ruby/site_ruby/1.9.1/rubygems/basic_specification.rb:62:in `block (2 levels) in contains_requirable_file?'
[Tue Oct 04 15:36:51 2016] [error] mod_ruby:   from /usr/local/lib/ruby/site_ruby/1.9.1/rubygems/basic_specification.rb:62:in `each'
[Tue Oct 04 15:36:51 2016] [error] mod_ruby:   from /usr/local/lib/ruby/site_ruby/1.9.1/rubygems/basic_specification.rb:62:in `any?'
[Tue Oct 04 15:36:51 2016] [error] mod_ruby:   from /usr/local/lib/ruby/site_ruby/1.9.1/rubygems/basic_specification.rb:62:in `block in contains_requirable_file?'
[Tue Oct 04 15:36:51 2016] [error] mod_ruby:   from /usr/local/lib/ruby/site_ruby/1.9.1/rubygems/basic_specification.rb:60:in `each'
[Tue Oct 04 15:36:51 2016] [error] mod_ruby:   from /usr/local/lib/ruby/site_ruby/1.9.1/rubygems/basic_specification.rb:60:in `any?'
[Tue Oct 04 15:36:51 2016] [error] mod_ruby:   from /usr/local/lib/ruby/site_ruby/1.9.1/rubygems/basic_specification.rb:60:in `contains_requirable_file?'
[Tue Oct 04 15:36:51 2016] [error] mod_ruby:   from /usr/local/lib/ruby/site_ruby/1.9.1/rubygems/specification.rb:925:in `block in find_inactive_by_path'
[Tue Oct 04 15:36:51 2016] [error] mod_ruby:   from /usr/local/lib/ruby/site_ruby/1.9.1/rubygems/specification.rb:924:in `each'
[Tue Oct 04 15:36:51 2016] [error] mod_ruby:   from /usr/local/lib/ruby/site_ruby/1.9.1/rubygems/specification.rb:924:in `find'
[Tue Oct 04 15:36:51 2016] [error] mod_ruby:   from /usr/local/lib/ruby/site_ruby/1.9.1/rubygems/specification.rb:924:in `find_inactive_by_path'
[Tue Oct 04 15:36:51 2016] [error] mod_ruby:   from /usr/local/lib/ruby/site_ruby/1.9.1/rubygems.rb:185:in `try_activate'
[Tue Oct 04 15:36:51 2016] [error] mod_ruby:   from /usr/local/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:132:in `rescue in require'
[Tue Oct 04 15:36:51 2016] [error] mod_ruby:   from /usr/local/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:144:in `require'
[Tue Oct 04 15:36:51 2016] [error] mod_ruby:   from /usr/local/lib/ruby/gems/1.9.1/gems/sbsm-1.3.0/lib/sbsm/trans_handler.rb:128:in `uri_parser'
[Tue Oct 04 15:36:51 2016] [error] mod_ruby:   from /usr/local/lib/ruby/gems/1.9.1/gems/sbsm-1.3.0/lib/sbsm/trans_handler.rb:76:in `parse_uri'
[Tue Oct 04 15:36:51 2016] [error] mod_ruby:   from /usr/local/lib/ruby/gems/1.9.1/gems/sbsm-1.3.0/lib/sbsm/trans_handler.rb:108:in `translate_uri'

Changing DRb.start_service('druby://localhost:0') to ::DRb.start_service('druby://localhost:0') did not help neither.

Decided to invest a couple of hours of my spare time to see whether I can switch to another Ruby web framework. These steps were done:

  • sudo emerge nginx
  • created /etc/nginx/sites-enabled/rack_test with the following content
server { 
        listen 8752;
        location / {
          proxy_pass http://localhost:9292;
  }
}
  • sudo /etc/init.d/nginx restart
  • cd /var/www && sudo -u apache git clone https://github.com/rack/rack
  • cd /var/www/rack && sudo -u apache /usr/local/bin/ruby231 -Ilib lib/rack/lobster.rb

And now http://localhost:8752/ displays:

Now my next task is to get the functionality of davaz.com/doc/index.rbx into a copy of the lobster.rb which I put into davaz.com/doc/index_rack.rb.

Now adding /etc/nginx/sites-enabled/davaz_rack with

server { 
        listen 8751;
        location / {
          proxy_pass http://localhost:9191;
  }
}

And starting the doc/index_rack.rb via sudo -u apache /usr/local/bin/bundle exec doc/index_rack.rb

When calling http://localhost:8751/ and passing the request directly as SBSM::Request.new(DaVaz.config.server_uri).process to sbsm 1.3.0 I get a ruby error NameError at /uninitialized constant Apache with a nice callback. Also adding a binding.pry works find.

I will fix this error tomorrow and I think it should be quite easy to adapt it for the use with rack. The index_rack.rb can be found as Attach:index_rack.rb.txt

view · edit · sidebar · attach · print · history
Page last modified on October 04, 2016, at 06:58 PM