view · edit · sidebar · attach · print · history

20120305-separate-drb-process-by-lookandfeel-setup-daemontools

<< | Index | >>


summary

  • updated connection to drb_process by lookandfeel.
    • updated that bin/oddbd needs parameter.
    • specify drb_process from parsed parameter
  • install & tested daemontools.
    • created run script by daemons for lookandfeels.

commit (as patch)

Attach:added-drb_process-switching-by-flavor.patch.txt

index


update drb_process conneciton by lookandfeel

drb_process_by_lookandefeel

specifiy flavor by ARGV

server_uri = ODDB::Flavorlizer.server_uri_with_flavor(ARGV.first)
if server_uri == ODDB::SERVER_URI
  ODBA.cache.setup
  ODBA.cache.clean_prefetched
end
$ bin/oddbd atupri
$ bin/oddbd mymedi

connection from index.rbx

lookandfeels are called flavor in URL

z.B.

  • carenaschweiz

parse parameter and servername

  • doc/index.rbx
    • parse request-parameter in request via Apache
  • bin/oddbd
    • parse ARGV parameter in oddbd (bin/oddbd)
  1. when request comes to / (no flavor parameter)
  2. when request comes to /de/(flavor)/...

Install daemontools

installed daemontools via emerge.

  • /service directiroy
  • multilog
  • svscan

Setup daemontools

  1. $ sudo emerge daemontools
  2. $ cd /var/www/oddb.org/
  3. $ mkdir -p svc/oddb/log/main
  4. $ vim svc/oddb/log/run
      #!/bin/sh
      exec multilog t ./main 
    
  5. $ chmod 755 svc/oddb/log/run
  6. $ vim svc/oddb/run
      #!/bin/sh
      exec 2>&1
      ulimit -v 10240000
      exec sudo -u apache /usr/local/bin/ruby /var/www/oddb.org/bin/oddbd 
    
  7. $ chmod 755 svc/oddb/run
  8. $ sudo ln -s /var/www/oddb.org/svc/oddb ch.oddb
  9. $ sudo rc-update add svscan default
    • /etc/init.d/svscan {start|stop}

daemontools_usage

  • start
      svc -u /service/ch.oddb 
    
  • stop (-t + -c + no-restart)
      svc -d /service/ch.oddb 
    
  • restart
      svc -t /service/ch.oddb 
    
  • kill
      svc -k /service/ch.oddb 
    
  • log (force) rotate
      svc -a /service/ch.oddb/log 
    
  • down
      touch /serive/ch.oddb/down 
    
NOTE
  • svscan check services per 5 sec.
  • dateformot with tai64nlocal
    • z.B. tail -f /var/www/oddb.org/svc/oddb/log/main/current | tai64nlocal

I created run a script for multi daemons.
But, This way dosen't works.
I could not control each process with svc command.

/var/www/oddb.org/svc/oddb/run [this does not work]

#!/bin/sh
exec 2>&1
ulimit -v 10240000
exec sudo -u yasu /usr/local/bin/ruby /var/www/oddb.org/bin/oddbd
# lookandfeels
exec sudo -u yasu /usr/local/bin/ruby /var/www/oddb.org/bin/oddbd atupri
exec sudo -u yasu /usr/local/bin/ruby /var/www/oddb.org/bin/oddbd atupri-web
exec sudo -u yasu /usr/local/bin/ruby /var/www/oddb.org/bin/oddbd carenaschweiz
...                                                                             

We must run 1 script per 1 daemon. (we could not run also as child process)
then, created as each service.

#!/bin/sh
exec 2>&1
ulimit -v 10240000
exec sudo -u yasu /usr/local/bin/ruby /var/www/oddb.org/bin/oddbd
  • /var/www/oddb.org/svc/
    • oddbd
      • run
      • log
    • oddbd-atupri
      • run
      • log
    • oddbd-atupri-web
      • run
      • log
    • oddbd-atupri-carenaschweiz
      • run
      • log

...

We must run it by these commands.

$ svc -u /service/ch.oddbd 
$ svc -u /service/ch.oddbd-atupri
$ svc -u /service/ch.oddbd-atupri-web 
$ svc -u /service/ch.oddbd-carenaschweiz
...

refs

view · edit · sidebar · attach · print · history
Page last modified on April 09, 2012, at 10:17 AM