view · edit · sidebar · attach · print · history

20160702-setup-davaz-com

<< 20160704-migrate-davaz-com-to-ruby-231 | Index | 20160701-setup-davaz-com >>


Summary

  • Setup davaz.com in local machine
    • Ruby 1.8.6 + Patches, mod_ruby compiled with this Ruby 1.8.6
    • Setup apache config files
    • Yus database (PostgreSQL)
    • MySQL data
    • Setup dojo and htmlgrid

Commits / Patches / Pull Requests, Scripts

Index


Setup ruby/mod_ruby davaz.com

rb_block_lambda undefined issue

rb_block_lambda issue is fixed at here:
http://dev.ywesee.com/Yasu/20160319-fix-and-setup-ruby186-apps-with-modRuby-compiled-against-ruby193#avoid-rb-block_lambda-undefiend-issue-as-patch

So, I've created a patch (for this request.c). And attached here:
http://dev.ywesee.com/Ruby186/Patches

This is a patch:
http://dev.ywesee.com/uploads/att/mod_ruby-ruby186-request.c.patch.txt

Then I've updated mod_ruby build script:
Attach:gen-mod_ruby-with-ruby-186oniguruma-patch.sh.txt

Now davaz.com works on my local machine!

  • ruby 1.8.6 + oniguruma patch + additional patch (openssl, syck)
  • mod_ruby + requst.c patch (above) compiled with ruby 1.8.6
  • sbsm 1.2.3

This is apache config file for davaz.com:

<Directory /var/www/davaz.com/doc>                                              
Options ExecCGI                                                                 
AllowOverride None                                                              
Order allow,deny                                                                
Allow from all                                                                  
</Directory>                                                                    

<VirtualHost *:80>                                                              
ServerName 127.0.0.1                                                            

DocumentRoot /var/www/davaz.com/doc                                             
DirectoryIndex index.html index.rbx                                             

RubyAddPath /var/www/davaz.com/src                                              
# change paht your location (like: /usr/local)                                                                    
RubyAddPath /path/to/lib/ruby/gems/1.8/gems/mysql-2.8.1/lib
RubyAddPath /path/to/lib/ruby/gems/1.8/gems/rclconf-1.0.0/lib
RubyAddPath /path/to/lib/ruby/gems/1.8/gems/sbsm-1.2.3/lib

RubyRequire 'sbsm/trans_handler'                                                
SetHandler ruby-object                                                          
RubyTransHandler SBSM::ZoneTransHandler.instance                                
ErrorLog  "|/usr/sbin/cronolog -l /var/www/davaz.com/log/error_log /var/www/davaz.com/log/%Y/%m/%d/error_log"
CustomLog "|/usr/sbin/cronolog -l /var/www/davaz.com/log/access_log /var/www/davaz.com/log/%Y/%m/%d/access_log" combined
</VirtualHost>

Setup data for davaz.com

PostgreSQL

davaz.com uses Postgresql using yusd.

postgres=# ALTER ROLE postgres WITH PASSWORD 'XXXXX';
ALTER ROLE
postgres=# CREATE DATABASE "yus" WITH ENCODING 'UTF8' TEMPLATE = template0;
CREATE DATABASE
postgres=# CREATE ROLE "yus";
CREATE ROLE
postgres=# ALTER ROLE yus WITH PASSWORD 'xxxxx';
ALTER ROLE
postgres=# ALTER ROLE "yus" CREATEDB REPLICATION LOGIN;
ALTER ROLE
postgres=# ALTER DATABASE "yus" OWNER TO "yus";
ALTER DATABASE

Then I've downloaded yus database from backup:
July-2016/2016-07-01/22:00-postgresql_database-yus-backup.gz

% zcat 22:00-postgresql_database-yus-backup.gz | psql -U yus yus

I would like to use another database name :)

postgres=# ALTER DATABASE yus RENAME TO yus_davaz;
ALTER DATABASE

Note

yus database and its relation objects's owner must be yus user. (not only database)
The dumped backup data might contain its objects owned by postgres user.

MySQL

davaz.com stores content data into MySQL database.

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

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

I've downloaded mysql database from backup:
bak.mysql.2016-07-01_22.00.35_.tar.gz

This tar ball contains following backup files for davaz.com:
bak.mysql.2016-07-01_22.00.35/bak.mysql.2016-07-01_22.00.35_DBNAME.artgroups.sql
bak.mysql.2016-07-01_22.00.35/bak.mysql.2016-07-01_22.00.35_DBNAME.artobjects.sql
bak.mysql.2016-07-01_22.00.35/bak.mysql.2016-07-01_22.00.35_DBNAME.countries.sql
bak.mysql.2016-07-01_22.00.35/bak.mysql.2016-07-01_22.00.35_DBNAME.currencies.sql
bak.mysql.2016-07-01_22.00.35/bak.mysql.2016-07-01_22.00.35_DBNAME.guestbook.sql
bak.mysql.2016-07-01_22.00.35/bak.mysql.2016-07-01_22.00.35_DBNAME.links.sql       
bak.mysql.2016-07-01_22.00.35/bak.mysql.2016-07-01_22.00.35_DBNAME.links_artobjects.sql
bak.mysql.2016-07-01_22.00.35/bak.mysql.2016-07-01_22.00.35_DBNAME.materials.sql
bak.mysql.2016-07-01_22.00.35/bak.mysql.2016-07-01_22.00.35_DBNAME.oneliner.sql 
bak.mysql.2016-07-01_22.00.35/bak.mysql.2016-07-01_22.00.35_DBNAME.series.sql   
bak.mysql.2016-07-01_22.00.35/bak.mysql.2016-07-01_22.00.35_DBNAME.tags.sql        
bak.mysql.2016-07-01_22.00.35/bak.mysql.2016-07-01_22.00.35_DBNAME.tags_artobjects.sql
bak.mysql.2016-07-01_22.00.35/bak.mysql.2016-07-01_22.00.35_DBNAME.tools.sql
% mysql -u USER --database DBNAME -p < ./bak.mysql.2016-07-01_22.00.35_DBNAME*
mysql> show tables;
+------------------+
| Tables_in_davaz  |
+------------------+
| artgroups        |
| artobjects       |
| countries        |
| currencies       |
| guestbook        |
| links            |
| links_artobjects |
| materials        |
| oneliner         |
| series           |
| tags             |
| tags_artobjects  |
| tools            |
+------------------+
13 rows in set (0.00 sec)

Setup is almost done :)

Setup dojo

Next, setup dojo for davaz.com.

;; errors in error_log.
[Sat Jul 02 14:17:00 2016] [error] [client 127.0.0.1] File does not exist: /var/www/davaz.com/doc/resources/dojo, referer: xxx
[Sat Jul 02 14:17:00 2016] [error] [client 127.0.0.1] File does not exist: /var/www/davaz.com/doc/resources/dojo, referer: xxx
[Sat Jul 02 14:17:00 2016] [error] [client 127.0.0.1] File does not exist: /var/www/davaz.com/doc/resources/dojo, referer: xxx

Dojo's download page is here:
http://download.dojotoolkit.org/

It seems that production davaz.com uses dojo-0.3.0 or dojo-0.3.1.
But its versions are already gone (not downloadable).

So, I've tried 0.3.3.

Download and Replace as dojo .
Use release, not dojo source. dojo needs Java (ant) to build.

% cd /path/to/davaz.com/doc/resources
% curl -LO http://download.dojotoolkit.org/release-1.3.3/dojo-release-1.3.3.tar.gz
% tar -zxvf dojo-release-1.3.3.tar.gz
% mv dojo-release-1.3.3 dojo

It seems hat dojo works.
But some error in javascript console.

Debug dojo and JavaScript

At first, htlmlgrid-1.0.6 was too new. I've downgrade to 1.0.0 same as production (davaz.com).

Updated gem install script:
Attach:gem-install-davaz.com.sh.txt

Following Errors are still there.

  • dijit.MasterTooltip is undefined.
  • ticker window works, but it's hidden.

htmlgrid-1.0.0 might be old. (but 1.0.6 is too new)

% grep -ran1  MasterTooltip ../../../../lib/ruby/gems/1.8/gems
../../../../lib/ruby/gems/1.8/gems/htmlgrid-1.0.0/widget/Tooltip.js-23-      if(!dijit._masterTT){
../../../../lib/ruby/gems/1.8/gems/htmlgrid-1.0.0/widget/Tooltip.js:24:        dijit._masterTT=new dijit._MasterTooltip();
../../../../lib/ruby/gems/1.8/gems/htmlgrid-1.0.0/widget/Tooltip.js-25-      }

htmlgrid-1.0.6 + dojo 1.3.3:

htmlgrid-1.0.0 (and 1.0.3) + dojo 1.3.3:

In production, there are 3 htmlgrid versions. (1.0.0, 1.0.3, 1.0.6). But davazd is booted via daemontools, with -I /path/to/htmlgrid-1.0.3/lib .

I've swithed htmlgrid to 1.0.3 . And dojo-1.3.3 does also not match source code of davaz.com. Then I've copied dojo (1.3.0) from production.

then it works all fine :)

  • ruby 1.8.6
  • mod_ruby compiled ruby 1.8.6
  • htmlgrid 1.0.3
  • dojo 1.3.0

Above versions are almost same with current production.

Update ruby 2.3.1

Update davaz.com (davazd) application's ruby to 2.3.1.
(mod_ruby is stil compiled against ruby 1.8.6)

view · edit · sidebar · attach · print · history
Page last modified on July 14, 2016, at 03:03 PM