2014年12月15日月曜日

phpenv on Debian

installation of PHP 5.6.3

curl https://raw.githubusercontent.com/CHH/phpenv/master/bin/phpenv-install.sh | bash
git clone git://github.com/CHH/php-build.git ~/.phpenv/plugins/php-build
echo 'export PATH="$HOME/.phpenv/bin:$PATH"' >> ~/.bashrc
echo 'eval "$(phpenv init -)"' >> ~/.bashrc
exec $SHELL -l
sudo aptitude install bison re2c libcurl4-openssl-dev libjpeg8-dev libpng-dev libmcrypt-dev libreadline-dev libtidy-dev libxslt1-dev libltdl-dev autoconf
phpenv install -l
phpenv install 5.6.3
phpenv versions
phpenv global 5.6.3

2014年12月1日月曜日

Supervisor+Starman on Debian


installation of supervisor


aptitude install supervisor


setting of supervisor


vim /etc/supervisor/conf.d/programname.conf

[program:programname]
user=username
directory=/home/username/programname
command=/home/username/programname/script/run.sh
autostart=true
autorestart=true
stopsignal=QUIT
stdout_logfile=/var/log/supervisor/programname.log
stderr_logfile=/var/log/supervisor/programname_error.log


creating a run script


vim /home/username/programname/script/run.sh

#!/bin/bash

cd /home/username/programname/
export HOME=/home/username
exec /home/username/perl5/perlbrew/perls/perl-5.20.1/bin/start_server \
    --port 3000 \
    --interval 2 \
    -- /home/username/perl5/perlbrew/perls/perl-5.20.1/bin/plackup \
    -Ilib -s Starman \
    -E production \
    /home/username/programname/webapp.pl \
    --workers 6


restart of supervisor


/etc/init.d/supervisor restart


Check Status


supervisorctl status


supervisorctl start, stop, reload


supervisorctl start programname
supervisorctl stop programname
supervisorctl reread


Confirmation


pkill starman
ps aux | grep starman


reference materials: