[Perl]
Perlのアプリサーバ起動管理
carton
- cpanfileを扱うのはcartonのほうがよさそうに見える
# yum install perl-App-cpanminus # cpanm Carton
- ライブラリのインストール
- もっぱらrubyのbundlerのような形で使える
$ carton install
- ./local/lib/perl5以下にライブラリがインストールされる
Proclet / Server::Starter
- Proclet - minimalistic Supervisor
- Server::Starter - a superdaemon for hot-deploying server programs - metacpan.org
- これでPerlの起動停止をやりたい
// 起動 $ carton exec start_server \ # Server::Starterを起動 --daemonize --log-file=/tmp/fswiki.log \ # デーモン化とログ出力先を指示 --pid-file=/tmp/fswiki.pid --status-file=/tmp/fswiki.status \ # pidファイル等を出力する -- starman --workers 4 app.psgi # starmanをworkerとして動作させる // 停止 $ carton exec start_server \ # Server::Starterを起動 --stop --pid-file=/tmp/fswiki.pid \ # pidファイルを指定してstopを指示
supervisord(お蔵入り)
- supervisordを使って、上記のServer::Starter + Starmanの起動管理をやりたかったのだが
- pipから入れたもの(supervisor-4.2.0)がうまく動作しない。挙動が変わってしまったかソースがダメなのか。
- supervisor-3.4.0で検証
- http://blog.hatak.net/2012/08/08/14714/
- https://stackoverflow.com/questions/20683425/supervisor-and-perlbrew
- https://stackoverflow.com/questions/22248755/how-to-use-environment-variables-in-supervisord-commands
- https://stackoverflow.com/questions/20683425/supervisor-and-perlbrew
- https://unix.stackexchange.com/questions/247995/centos-7-1-supervisord-terminates-if-run-with-systemctl
- https://github.com/Supervisor/supervisor/issues/140