DBDEV

Subversion

Adjustment for running myrecordbk

Add Bk.pm in own perllib folder.

 $MYRECORD_HOST = "myrecordbk.cehd.tamu.edu";
 $DBWEB_HOST = "dbwebbk.cehd.tamu.edu";
 $CAS_HOST = "cas-dev.tamu.edu";
 $DBHOST = "127.0.0.1";
 $DBUSER = "";
 $DBPASS = "";

perl lib path configuration

In apache vhost conf file, add:

PerlOptions +Parent PerlSwitches -I/disks/www/perllibbk/

This will cause Apache use pm files in the specified directory (perllibbk), before the pm files in standard locations.

Also, what's important is that this setup affects only this vhost.

(If you use "use lib /disks/www/perllibbk/;" in startup.pl, it affects other vhosts too. So startup.pl does not work for our purpose.)

svn

SVN will be used for code repository.

The svn repo will be on dbdev server, and on apache.

Repo url

 https://dbdev.cehd.tamu.edu/repos/myrecord
 https://dbdev.cehd.tamu.edu/repos/dbweb
 https://dbdev.cehd.tamu.edu/repos/modules

Dev server will run two sites:

 myrecorddev.cehd.tamu.edu 
 dbdev.cehd.tamu.edu

Dev server will run a postgresql server. It is up to the developer to use it for test connection.

 But, any file using the local server should not be committed to the repo.

Both production and dev will share one repo.

 This means that if any url or database connection string needs to be modified
 for testing, or for local server, they must be changed back
 to production setting, before being committed.

svn setup and rules

  • Archives folders will be included in the svn repos. This way, something archived on one server can be propagated to other servers.
  • /etc/subversion/config
 [miscellany]
 global-ignores = *.gif *.bak *.jpg *.png *.1 *.2 *.doc *.xls *.docx *.xlsx      Thumbs.db *.pdf *.zip *.rtf *.docm *.dot *.dat
  • Access is limited by basic auth. See ssl.conf file.

svn import

dbdev

on dbdev

Since it's CentOS 5, 1.4.2 is the one to go with.

 sudo \rm -rf /disks/www/svn/myrecord/
 svnadmin create /disks/www/svn/myrecord/
 sudo chown -R apache.apache  /disks/www/svn
 sudo chcon -R system_u:object_r:httpd_sys_script_rw_t:s0 /disks/www/svn/myrecord/
 svnadmin create /disks/www/svn/modules/
 sudo chcon -R system_u:object_r:httpd_sys_script_rw_t:s0 /disks/www/svn/dbweb/
 sudo chcon -R system_u:object_r:httpd_sys_script_rw_t:s0 /disks/www/svn/modules/

on dbdev

 cd /disks/www
 \rm -rf myrecord/Archives
 \rm -rf myrecord/cs
 sudo find myrecord/ -name '.svn' -exec \rm -rf {} \;
 sudo find myrecord/ -name 'Archi*' -exec \rm -rf {} \;
 svn import -m "init" myrecord https://dbdev.cehd.tamu.edu/repos/myrecord
 svn import -m "init" dbweb https://dbdev.cehd.tamu.edu/repos/dbweb

Since 1.4.2 won't take --force for checkout,

 sudo mv myrecord myrecord-orig
 sudo svn co https://dbdev.cehd.tamu.edu/repos/myrecord
 sudo mv dbweb dbweb-orig
 sudo svn co https://dbdev.cehd.tamu.edu/repos/dbweb

on myrecord

 export perllib and myrecord web to dbweb.

perllib permission

 chgrp dbweb *pm
 chmod g+w *pm

svn info

 URL: https://dbdev.cehd.tamu.edu/repos/perllib
 Repository Root: https://dbdev.cehd.tamu.edu/repos/perllib

on dbweb

mount from myrecord

 /usr/lib/perl5/site_perl/5.8.8/i386-linux-thread-multi --> /disks/perllib/myrecord
 /disks/www/myrecord --> /disks/www/myrecord

perllib permission

 chgrp dbweb *pm
 chmod g+w *pm

svn info

 URL: https://dbdev.cehd.tamu.edu/repos/perllib
 Repository Root: https://dbdev.cehd.tamu.edu/repos/perllib

embperl

setup on CentOS

Embperl does not exist in yum repos. We have to run cpan and do

 install Embperl2

The main setup goes into /etc/httpd/conf.d/perl.conf.

 LoadModule perl_module modules/mod_perl.so
 LoadModule embperl_module /usr/lib/perl5/site_perl/5.8.8/i386-linux-thread-multi/auto/Embperl/Embperl.so
 PerlModule Embperl
 <FilesMatch ".*\.epl$">
    SetHandler  perl-script
    PerlHandler Embperl
    Options     FollowSymLinks ExecCGI
 </FilesMatch>
 PerlSetEnv EMBPERL_MAIL_ERRORS_TO bkim@tamu.edu
 PerlSetEnv EMBPERL_OPTIONS 262144
 PerlSetEnv EMBPERL_FILESMATCH \.epl$
 PerlSetEnv EMBPERL_ESCMODE 0
 PerlSetEnv EMBPERL_LOG "/disks/www/logs/embperl_log"
 PerlSetEnv EMBPERL_DEBUG 10477
 AddType text/html .epl

issues

error 500 on missing files

Missing files generate 500 errors, because of Embperl 2's file based object oriented structure. To avoid it, these are the settings that go into perl.conf.

 PerlSetEnv EMBPERL_MAIL_ERRORS_TO bkim@tamu.edu
 PerlSetEnv EMBPERL_OPTIONS 262144

In 500.epl (see actual code), you can get the error code this way.

 if ($req_rec && ($prev = $req_rec->prev)) {
   $errors_p = $prev->pnotes('EMBPERL_ERRORS');
   @errors_a = @{$errors_p}; 

However, this DOES NOT work for spawned apache processes. I.e. it seems to work only for 8 times, if StartServers is 8 in httpd.conf (Prefork MPM).

So it's best to add a static page that shows a courtesy message, and have the email sent to admins.

Taxonomy: