<< Masa.20101110-setup-eshop | 2010 | Masa.20101108-sample-ebook-setup-eshop >>
Comparison of differences between git source and production server source
Production server
/var/.../bbmb $ ls bin chroot-jail data doc etc lib LICENSE log svc test var webalizer
Local
masa@masa ~/ywesee/bbmb $ ls bin lib LICENSE test
Notes
Links
Setting daemontools on production server
/service/bbmb $ cat run #!/bin/sh DIR=/var/.../bbmb/ exec 2>&1 exec sudo -u xxx /usr/bin/ruby -rubygems $DIR/bin/bbmbd config=$DIR/etc/config.yml
Check config.yml on production server
/var/.../bbmb/etc $ ls config.yml polling.yml bbmb.crt bbmb.csr bbmb.key ydim.yml yus.yml
Modify config.yml
--- error_recipients: - mhatakeyama@ywesee.com bbmb_dir: /home/masa/ywesee/bbmb db_name: sanxxx_bbmb db_user: sanxxx db_pass: sanxxx log_level: DEBUG mail_order_to: mhatakeyama@ywesee.com mail_order_from: mhatakeyama@ywesee.com name: "Bbmb(Masa)" smtp_server: mail.ywesee.com smtp_authtype: :plain smtp_user: 'mhatakeyama@ywesee.com' smtp_pass: xxxx target_format: csv inject_error_body: | inject_error_body inject_error_subject: 'Bestellung "%s" mit fehlendem Kunden: "%s"' inject_error_from: 'mhatakeyama@ywesee.com' inject_error_to: 'mhatakeyama@ywesee.com' mail_confirm_from: 'mhatakeyama@ywesee.com' mail_confirm_reply_to: 'mhatakeyama@ywesee.com' mail_confirm_subject: "Masa: Auftragsbestätigung %s" mail_confirm_lines: - "%3i x %-40s ā %6.2f, total %7.2f" - "%3i x %-40s ā %6.2f, total %7.2f" - "%3i x %-40s a %6.2f, totale %7.2f" mail_confirm_body: | mail_confirm_body confirm_error_body: | confirm_error_body confirm_error_subject: Kunde "%s" ohne hinterlegte Email-Adresse im Sandoz E-shop confirm_error_from: 'mhatakeyama@ywesee.com' confirm_error_to: 'mhatakeyama@ywesee.com'
Test run bbmbd
masa@masa ~/ywesee/bbmb $ bin/bbmbd config="config.yml" ERROR: relation "object" already exists ERROR: relation "prefetchable_index" already exists ERROR: relation "extent_index" already exists ERROR: relation "object_connection" already exists ... D, [2010-11-09T09:38:26.294681 #5631] DEBUG -- config: #<RCLConf::RCLConf:0x7f2358fd0b10 @argv={"config"=>"config.yml"}, @defaults= {"confirm_error_body"=> "Customer %s does not have an email address configured", "mail_confirm_reply_to"=>nil, "update?"=>true, ... @loaded= {"confirm_error_from"=>"mhatakeyama@ywesee.com", "confirm_error_subject"=> "Kunde \"%s\" ohne hinterlegte Email-Adresse im Masa E-shop", ... /usr/lib64/ruby/1.8/pp.rb:214: command not found: cg-object-id D, [2010-11-09T09:38:26.299072 #5631] DEBUG -- updater: sleeping 48093.70 seconds D, [2010-11-09T09:38:26.299717 #5631] DEBUG -- invoicer: sleeping 1866093.70 seconds I, [2010-11-09T09:38:26.299771 #5631] INFO -- start: starting bbmb-server on druby://localhost:12000
Notes
Check source code to start updater and invoicer daemons
... begin @server = BBMB::Util::Server.new(@persistence) @server.extend(DRbUndumped) if(@config.update?) @server.run_updater end if(@config.invoice?) @server.run_invoicer end ...
Added config.yml
invoice?: false update?: false
Test run bbmbd
masa@masa ~/ywesee/bbmb $ bin/bbmbd config="config.yml" ... @loaded= {"invoice?"=>false, "update?"=>false, ... I, [2010-11-09T09:45:35.310876 #5736] INFO -- start: starting bbmb-server on druby://localhost:12000
Notes
/etc/apache2/vhosts.d/04_bbmb_vhost.conf
<Directory /home/masa/ywesee/bbmb/doc> Options ExecCGI FollowSymlinks Indexes AllowOverride None Order allow,deny Allow from all # SSLRequireSSL # ErrorDocument 403 https://masa.bbmb.ch </Directory> <VirtualHost *:80> DocumentRoot /home/masa/ywesee/bbmb/doc ServerName bbmb.masa.ch DirectoryIndex index.rbx RubyAddPath /home/masa/ywesee/bbmb/src RubyRequire 'sbsm/trans_handler' SetHandler ruby-object RubyTransHandler SBSM::TransHandler.instance # ErrorLog "|/usr/sbin/cronolog -l /home/masa/ywesee/bbmb/log/error_log # /home/masa/ywesee/bbmb/log/%Y/%m/%d/error_log" # CustomLog "|/usr/sbin/cronolog -l /home/masa/ywesee/bbmb/log/access_log # /home/masa/ywesee/bbmb/log/%Y/%m/%d/access_log" combined # SetEnv DEFAULT_FLAVOR masa_bbmb SetEnv DRB_SERVER druby://localhost:12000 </VirtualHost>
Copy doc directory
masa@masa ~/ywesee/sandoz.bbmb.ch $ cp -r doc ../bbmb
Restart
$ 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 [ok]
Check it with Firefox
Update /etc/hosts
... 127.0.0.1 bbmb.masa.ch ...
Check with firefox
Check /var/log/apache2/error_log
[Tue Nov 09 11:31:47 2010] [error] mod_ruby: error in ruby [Tue Nov 09 11:31:47 2010] [error] mod_ruby: /home/masa/ywesee/bbmb/doc/index.rbx:5:in `require': no such file to load -- encoding/character/utf-8 (LoadError) [Tue Nov 09 11:31:47 2010] [error] mod_ruby: from /home/masa/ywesee/bbmb/doc/index.rbx:5 [Tue Nov 09 11:31:47 2010] [error] mod_ruby: from /usr/lib64/ruby/1.8/apache/ruby-run.rb:53:in `load' [Tue Nov 09 11:31:47 2010] [error] mod_ruby: from /usr/lib64/ruby/1.8/apache/ruby-run.rb:53:in `handler' [Tue Nov 09 11:31:47 2010] [error] [client 127.0.0.1] File does not exist: /home/masa/ywesee/bbmb/doc/favicon.ico [Tue Nov 09 11:31:50 2010] [error] [client 127.0.0.1] File does not exist: /home/masa/ywesee/bbmb/doc/favicon.ico
Download favicon.ico from production server
Run and check with firefox
Check /var/log/apache2/error_log
[Tue Nov 09 11:47:04 2010] [error] mod_ruby: error in ruby [Tue Nov 09 11:47:04 2010] [error] mod_ruby: /home/masa/ywesee/bbmb/doc/index.rbx:5:in `require': no such file to load -- encoding/character/utf-8 (LoadError) [Tue Nov 09 11:47:04 2010] [error] mod_ruby: from /home/masa/ywesee/bbmb/doc/index.rbx:5 [Tue Nov 09 11:47:04 2010] [error] mod_ruby: from /usr/lib64/ruby/1.8/apache/ruby-run.rb:53:in `load' [Tue Nov 09 11:47:04 2010] [error] mod_ruby: from /usr/lib64/ruby/1.8/apache/ruby-run.rb:53:in `handler'
Notes
Next
Update index.rbx
require 'rubygems'
Check with firefox
Check /var/log/apache2/error_log
[Tue Nov 09 11:57:48 2010] [error] access to / failed for (null), reason: Tue Nov 09 11:57:48 +0100 2010 - 70092332391380 - ArgumentError - drbsession_uri not specified [Tue Nov 09 11:57:48 2010] [error] access to / failed for (null), reason: /usr/lib64/ruby/site_ruby/1.8/cgi/drbsession.rb:12:in `initialize' [Tue Nov 09 11:57:48 2010] [error] access to / failed for (null), reason: /usr/lib64/ruby/1.8/cgi/session.rb:274:in `new' [Tue Nov 09 11:57:48 2010] [error] access to / failed for (null), reason: /usr/lib64/ruby/1.8/cgi/session.rb:274:in `initialize' [Tue Nov 09 11:57:48 2010] [error] access to / failed for (null), reason: /usr/lib64/ruby/site_ruby/1.8/sbsm/request.rb:98:in `new' [Tue Nov 09 11:57:48 2010] [error] access to / failed for (null), reason: /usr/lib64/ruby/site_ruby/1.8/sbsm/request.rb:98:in `drb_process' [Tue Nov 09 11:57:48 2010] [error] access to / failed for (null), reason: /usr/lib64/ruby/site_ruby/1.8/sbsm/request.rb:71:in `process' [Tue Nov 09 11:57:48 2010] [error] access to / failed for (null), reason: /home/masa/ywesee/bbmb/doc/index.rbx:11 [Tue Nov 09 11:57:48 2010] [error] access to / failed for (null), reason: /usr/lib64/ruby/1.8/apache/ruby-run.rb:53:in `load' [Tue Nov 09 11:57:48 2010] [error] access to / failed for (null), reason: /usr/lib64/ruby/1.8/apache/ruby-run.rb:53:in `handler' [Tue Nov 09 11:57:48 2010] [warn] [client 127.0.0.1] mod_include: Options +Includes (or IncludesNoExec) wasn't set, INCLUDES filter removed
Last night, the report mail was not sent again.
The log says
ywesee@thinpower /var/www/oddb.org/log/oddb/debug/2010 $ tail 11.log 2010-11-09 03:43:49 CET @files={} 2010-11-09 03:43:49 CET start outgoing process 2010-11-09 03:43:49 CET before send_mail(outgoing) 2010-11-09 03:43:49 CET getin send_mail 2010-11-09 03:43:49 CET @recipients=["xxx"] 2010-11-09 03:43:53 CET @files={} 2010-11-09 03:43:53 CET start outgoing process 2010-11-09 03:43:53 CET before send_mail(outgoing) 2010-11-09 03:43:53 CET getin send_mail 2010-11-09 03:43:53 CET @recipients=["xxx"]
The last line comes from the line 107 in oddb.org/src/util/log.rb http://scm.ywesee.com/?p=oddb.org/.git;a=blob;f=src/util/log.rb;h=75f707b510096bd0659b2b686ea08505c2b6d2c6;hb=HEAD#l105
def send_mail(multipart) LogFile.append('oddb/debug', " getin send_mail", Time.now) LogFile.append('oddb/debug', " @recipients=" +
@recipients.inspect.to_s, Time.now) #<= HERE
config = ODDB.config Net::SMTP.start(config.smtp_server, config.smtp_port, config.smtp_domain, config.smtp_user, config.smtp_pass, config.smtp_authtype) { |smtp| @recipients.each { |recipient| LogFile.append('oddb/debug', " recipient=" + recipient.to_s, Time.now) multipart.to = [recipient] smtp.sendmail(multipart.encoded, @mail_from || config.smtp_user, recipient) } } end
The next logging code
LogFile.append('oddb/debug', " recipient=" + recipient.to_s, Time.now)
did not run.
If this send_mail method runs correctly, the output will be as follows:
2010-11-09 03:43:41 CET @files={} 2010-11-09 03:43:41 CET start outgoing process 2010-11-09 03:43:41 CET before send_mail(outgoing) 2010-11-09 03:43:41 CET getin send_mail 2010-11-09 03:43:41 CET @recipients=["aaa","bbb","ccc"] 2010-11-09 03:43:43 CET recipient=aaa 2010-11-09 03:43:46 CET recipient=bbb 2010-11-09 03:43:48 CET recipient=ccc
This result means
config = ODDB.config
or
Net::SMTP.start(config.smtp_server, config.smtp_port, config.smtp_domain, config.smtp_user, config.smtp_pass, config.smtp_authtype) { |smtp|
did not run, but
config = ODDB.config
is not so complex process, which just reads the configuration file, that is
Net::SMTP.start(config.smtp_server, config.smtp_port, config.smtp_domain, config.smtp_user, config.smtp_pass, config.smtp_authtype) { |smtp|
did not run, according to my consideration. However, it is difficult to think why this does not work, since this worked in the other process.
Commit
The following error happens once per minute after the bbmbd running
[Tue Nov 09 14:25:39 2010] [error] access to / failed for (null), reason: Tue Nov 09 14:25:39 +0100 2010 - 70092332137120 - ArgumentError - drbsession_uri not specified [Tue Nov 09 14:25:39 2010] [error] access to / failed for (null), reason: /usr/lib64/ruby/site_ruby/1.8/cgi/drbsession.rb:12:in `initialize' [Tue Nov 09 14:25:39 2010] [error] access to / failed for (null), reason: /usr/lib64/ruby/1.8/cgi/session.rb:274:in `new' [Tue Nov 09 14:25:39 2010] [error] access to / failed for (null), reason: /usr/lib64/ruby/1.8/cgi/session.rb:274:in `initialize' [Tue Nov 09 14:25:39 2010] [error] access to / failed for (null), reason: /usr/lib64/ruby/site_ruby/1.8/sbsm/request.rb:98:in `new' [Tue Nov 09 14:25:39 2010] [error] access to / failed for (null), reason: /usr/lib64/ruby/site_ruby/1.8/sbsm/request.rb:98:in `drb_process' [Tue Nov 09 14:25:39 2010] [error] access to / failed for (null), reason: /usr/lib64/ruby/site_ruby/1.8/sbsm/request.rb:71:in `process' [Tue Nov 09 14:25:39 2010] [error] access to / failed for (null), reason: /home/masa/ywesee/bbmb/doc/index.rbx:11 [Tue Nov 09 14:25:39 2010] [error] access to / failed for (null), reason: /usr/lib64/ruby/1.8/apache/ruby-run.rb:53:in `load' [Tue Nov 09 14:25:39 2010] [error] access to / failed for (null), reason: /usr/lib64/ruby/1.8/apache/ruby-run.rb:53:in `handler' [Tue Nov 09 14:25:39 2010] [warn] [client 127.0.0.1] mod_include: Options +Includes (or IncludesNoExec) wasn't set, INCLUDES filter removed
#!/usr/bin/env ruby # index.rbx -- bbmb.ch -- hwyss@ywesee.com require 'rubygems' require 'sbsm/request' require 'encoding/character/utf-8' DRb.start_service('druby://localhost:0') begin SBSM::Request.new(ENV["DRB_SERVER"]).process #<= HERE rescue Exception => e $stderr << "Client Error: " << e.message << "\n" $stderr << e.class << "\n" $stderr << e.backtrace.join("\n") << "\n" end
Experiment
#!/usr/bin/env ruby # index.rbx -- bbmb.ch -- hwyss@ywesee.com require 'rubygems' require 'sbsm/request' require 'encoding/character/utf-8' DRb.start_service('druby://localhost:0') $stderr << 'ENV["DRB_SERVER"]=' << ENV["DRB_SERVER"].inspect.to_s begin SBSM::Request.new(ENV["DRB_SERVER"]).process rescue Exception => e $stderr << "Client Error: " << e.message << "\n" $stderr << e.class << "\n" $stderr << e.backtrace.join("\n") << "\n" end
Result
ENV["DRB_SERVER"]=nil
Update /etc/apache2/vhosts.d/04_bbmb_vhost.conf
<Directory /home/masa/ywesee/bbmb/doc> Options ExecCGI FollowSymlinks Indexes AllowOverride None Order allow,deny Allow from all </Directory> <VirtualHost *:80> DocumentRoot /home/masa/ywesee/bbmb/doc ServerName bbmb.masa.ch DirectoryIndex index.rbx SetEnv DRB_SERVER druby://localhost:12000 </VirtualHost>
Notes
Restart apache2
Result
ENV["DRB_SERVER"]="druby://localhost:12000"Client Error: no such file to load -- bbmb/html/util/lookandfeel LoadError (druby://localhost:12000) /usr/lib64/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require' (druby://localhost:12000) /usr/lib64/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require' (druby://localhost:12000) /home/masa/ywesee/bbmb/lib/bbmb/html/util/session.rb:31:in `lookandfeel' (druby://localhost:12000) /usr/lib64/ruby/site_ruby/1.8/htmlgrid/component.rb:127:in `initialize' (druby://localhost:12000) /usr/lib64/ruby/site_ruby/1.8/sbsm/state.rb:272:in `new' (druby://localhost:12000) /usr/lib64/ruby/site_ruby/1.8/sbsm/state.rb:272:in `view' (druby://localhost:12000) /usr/lib64/ruby/site_ruby/1.8/sbsm/state.rb:192:in `to_html' (druby://localhost:12000) /usr/lib64/ruby/site_ruby/1.8/sbsm/session.rb:496:in `to_html' (druby://localhost:12000) /usr/lib64/ruby/site_ruby/1.8/sbsm/redirector.rb:33:in `to_html' (druby://localhost:12000) /usr/lib64/ruby/site_ruby/1.8/sbsm/session.rb:174:in `drb_process' (druby://localhost:12000) /usr/lib64/ruby/site_ruby/1.8/sbsm/session.rb:171:in `synchronize' (druby://localhost:12000) /usr/lib64/ruby/site_ruby/1.8/sbsm/session.rb:171:in `drb_process' /usr/lib64/ruby/site_ruby/1.8/sbsm/request.rb:112:in `drb_process' /usr/lib64/ruby/site_ruby/1.8/sbsm/request.rb:71:in `process' /home/masa/ywesee/bbmb/doc/index.rbx:13 /usr/lib64/ruby/1.8/apache/ruby-run.rb:53:in `load' /usr/lib64/ruby/1.8/apache/ruby-run.rb:53:in `handler'
Notes
Copy lookandfeel.rb from sandoz.bbmb.ch project
masa@masa ~/ywesee/bbmb/lib/bbmb/html/util $ cp /home/masa/ywesee/sandoz.bbmb.ch/lib/bbmb/html/util/lookandfeel.rb .
Result /var/log/apache2/error_log
ENV["DRB_SERVER"]="druby://localhost:12000"
Note
If I input an account information, then
The 'Anmelden' click links to 'http://bbmb.masa.ch/de'
<FORM ACCEPT-CHARSET="UTF-8" NAME="login" METHOD="POST" ENCTYPE="application/x-www-form-urlencoded" ACTION="http://bbmb.masa.ch/de" ID="login">
Just for my information (directory tree)