メニュー

2014年3月6日

GrowthForecastインストール手順のメモ

# GrowthForecast

see: http://kazeburo.github.io/GrowthForecast/

## yum

```
sudo yum update
sudo yum install pkgconfig glib2-devel gettext libxml2-devel pango-devel cairo-devel
sudo yum groupinstall "Development Tools"
```

## useradd

add a user
```
sudo useradd growthforecast
```

change user
```
sudo su - growthforecast
```

## perlbrew

install perlbrew
```
curl -kL http://install.perlbrew.pl | bash
echo '[[ -s "$HOME/perl5/perlbrew/etc/bashrc" ]] && source "$HOME/perl5/perlbrew/etc/bashrc"' >> .bash_profile
source $HOME/perl5/perlbrew/etc/bashrc
```

install perl
```
perlbrew available
perlbrew install perl-5.18.2
perlbrew switch perl-5.18.2
```

## cpanm

install cpanm
```
perlbrew install-cpanm
```

## growthforecast

install GrowthForecast
```
cpanm -n GrowthForecast
```

make a directory for data
```
mkdir /media/ephemeral0/growthforecast
```

## supervisor

install supervisord
```
sudo yum --enablerepo=epel install supervisor
```

/etc/supervisord.conf
```
[supervisord]
http_port=/var/tmp/supervisor.sock ; (default is to run a UNIX domain socket server)
logfile=/var/log/supervisor/supervisord.log ; (main log file;default $CWD/supervisord.log)
logfile_maxbytes=50MB       ; (max main logfile bytes b4 rotation;default 50MB)
logfile_backups=10          ; (num of main logfile rotation backups;default 10)
loglevel=info               ; (logging level;default info; others: debug,warn)
pidfile=/var/run/supervisord.pid ; (supervisord pidfile;default supervisord.pid)
nodaemon=false              ; (start in foreground if true;default false)
minfds=1024                 ; (min. avail startup file descriptors;default 1024)
minprocs=200                ; (min. avail process descriptors;default 200)

[supervisorctl]
serverurl=unix:///var/tmp/supervisor.sock ; use a unix:// URL  for a unix socket

[program:growthforecast]
command=/home/growthforecast/perl5/perlbrew/perls/perl-5.18.2/bin/perl
        /home/growthforecast/perl5/perlbrew/perls/perl-5.18.2/bin/growthforecast.pl
        --data-dir /media/ephemeral0/growthforecast
        --front-proxy=127.0.0.1
process_name=%(program_name)s
directory=/home/growthforecast
stdout_logfile=/var/log/supervisor/%(program_name)s.log
stderr_logfile=/var/log/supervisor/%(program_name)s.log
user=growthforecast
autostart=true
autorestart=true
```

make a directory for logging
```
sudo mkdir /var/log/supervisor
```

add superversord to upstart
/etc/init/supervisord.conf
```
description "supervisord"

start on runlevel [2345]
stop on runlevel [!2345]
respawn
exec /usr/bin/supervisord -n
```

start supervisord via upstart
```
initctl start supervisord
```