かんばん式プロジェクトの支援ツールとして有名なTaiga.ioをオンプレで利用したいときに必要なインストール手順をご紹介します。本家サイトでは、Ubuntベースでの記載となっておりましすが、こちらでは、CentOS7.3をベースにApacheを利用してTaiga.ioの環境を構築します。
事前インストールが必要なもの
- OpenSSL(1.0.x)をインストールする(ソースからコンパイル)for CentOS 7.3
- Apache2.4をインストールする(ソースからコンパイル) for CentOS7.2 (systemd対応)
- PostgreSQL 9.6.xをインストール(ソースからコンパイル)for CentOS 7.3
- libssh2をインストールする(ソースからコンパイル) for CentOS7.2
- Python3.xをインストール(ソースからコンパイル)for CentOS7.2
※1 /usr/local/libがライブラリパスとして見えていること(/etc/ld.so.confにパス追記)
※2 Pythonが、/usr/local/binにインストールされるので、パスが「/usr/local/bin」が追加されていること(export PATH=/usr/local/bin:$PATH)
PostgreSQLの設定変更箇所
ソケットファイルのディレクトリを「/var/run/postgresql」配下にする
mkdir /var/run/postgresql
chown postgres:postgres /var/run/postgresql
vi /usr/local/pgsql/data/postgresql.conf
以下を書き換え
unix_socket_directories = '/var/run/postgresql'
必要なライブラリーをインストールする
autoconf
cd /usr/local/src
wget http://ftp.gnu.org/gnu/autoconf/autoconf-2.69.tar.gz
tar xvzf autoconf-2.69.tar.gz
cd /usr/local/src
cd autoconf-2.69
./configure
make
make install
libjpeg
cd /usr/local/src
wget http://www.ijg.org/files/jpegsrc.v9b.tar.gz
tar xvzf jpegsrc.v9b.tar.gz
cd /usr/local/src
cd jpeg-9b
./configure --enable-shared
make
make install
linpng
cd /usr/local/src
wget --trust-server-names https://downloads.sourceforge.net/project/libpng/libpng16/1.6.29/libpng-1.6.29.tar.gz?r=http%3A%2F%2Fwww.libpng.org%2Fpub%2Fpng%2Flibpng.html&ts=1487394896&use_mirror=jaist
tar xvzf libpng-1.6.29.tar.gz
cd /usr/local/src/phpmodule
cd libpng-1.6.29
cp scripts/makefile.linux Makefile
./configure --prefix=/usr/local LDFLAGS="-L/usr/local/lib -lz"
make
make install
freetype
cd /usr/local/src
wget http://download.savannah.gnu.org/releases/freetype/freetype-2.8.tar.gz
tar xvzf freetype-2.8.tar.gz
cd /usr/local/src/phpmodule
cd freetype-2.8
./configure --enable-static
make
make install
curl
cd /usr/local/src
wget https://curl.haxx.se/download/curl-7.54.0.tar.gz
tar xvzf curl-7.54.0.tar.gz
cd /usr/local/src/phpmodule
cd curl-7.54.0
# OpenSSLの場所を明示
CPPFLAGS="-I/usr/local/ssl/include" LDFLAGS="-L/usr/local/ssl/lib"
./configure \
--enable-http \
--enable-ftp \
--enable-file \
--enable-proxy \
--enable-cookies \
--with-zlib=/usr/local \
--with-ssl=/usr/local/ssl \
--with-libssh2=/usr/local
make
make install
pixman
cd /usr/local/src
wget https://www.cairographics.org/releases/pixman-0.34.0.tar.gz
tar xvzfpixman-0.34.0.tar.gz
cd pixman-0.34.0
make
make install
cairo
export png_CFLAGS=/usr/local/include/libpng16
export png_LIBS=/usr/local/lib
export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig
cd /usr/local/src
wget https://www.cairographics.org/releases/cairo-1.14.8.tar.xz
tar xvJf cairo-1.14.8.tar.xz
cd cairo-1.14.8
./configure
make
libzmq
cd /usr/local/src
wget https://github.com/zeromq/libzmq/releases/download/v4.2.1/zeromq-4.2.1.tar.gz
tar xvzf zeromq-4.2.1.tar.gz
cd zeromq-4.2.1
./configure
make
make install
gdbm
cd /usr/local/src
wget ftp://ftp.gnu.org/gnu/gdbm/gdbm-1.13.tar.gz
tar xvzf gdbm-1.13.tar.gz
cd gdbm-1.13
./configure
make
make install
ncurses
cd /usr/local/src
wget https://ftp.gnu.org/pub/gnu/ncurses/ncurses-6.0.tar.gz
tar xvzf ncurses-6.0.tar.gz
cd ncurses-6.0
./configure #--with-shared
make
make install
libffi
cd /usr/local/src
wget ftp://sourceware.org/pub/libffi/libffi-3.2.1.tar.gz
tar xvzf libffi-3.2.1.tar.gz
cd libffi-3.2.1
./configure --enable-shared
make
make install
libevent
cd /usr/local/src
wget https://github.com/libevent/libevent/releases/download/release-2.1.8-stable/libevent-2.1.8-stable.tar.gz
tar xvzf libevent-2.1.8-stable.tar.gz
cd libevent-2.1.8-stable
ln -s /usr/local/ssl/include/openssl /usr/local/include/openssl
./configure
make
make install
tumx
cd /usr/local/src
wget https://github.com/tmux/tmux/releases/download/2.5/tmux-2.5.tar.gz
tar xvzf tmux-2.5.tar.gz
cd tmux-2.5
./configure CFLAGS="-I/usr/local/src/libevent-2.1.8-stable/incude" LDFLAGS="-L/usr/local/lib"
make
make install
gettext
cd /usr/local/src
wget https://ftp.gnu.org/pub/gnu/gettext/gettext-latest.tar.gz
tar xvzf gettext-latest.tar.gz
cd gettext-0.19.8.1
./configure
make
make install
ln -s /usr/local/lib/libgettextsrc-0.19.8.1.so /lib/libgettextsrc-0.19.8.1.so
ln -s /usr/local/lib/libgettextlib-0.19.8.1.so /lib/libgettextlib-0.19.8.1.so
Pythonの環境準備を行う
インストール用のユーザーを作成する
useradd taiga
passwd taiga
virtualenv設定をおこなう
/usr/local/bin/pip3 install virtualenvwrapper
環境変数設定を行う
taigaユーザーに変更する
su taiga
vi ~/.bashrc
以下の設定を最下部に追記する
export PATH=/usr/local/bin:$PATH
export VIRTUALENVWRAPPER_PYTHON=/usr/local/bin/python3
### Virtualenvwrapper
if [ -f /usr/local/bin/virtualenvwrapper.sh ]; then
export WORKON_HOME=$HOME/.virtualenvs
source /usr/local/bin/virtualenvwrapper.sh
fi
設定を反映
source ~/.bashrc
Taiga.ioインストールする
taiga-backインストール
# Gitから最新版を取得する
cd ~
git clone https://github.com/taigaio/taiga-back.git taiga-back
cd taiga-back
git checkout stable
# 仮想空間の作成
/usr/local/bin/virtualenvwrapper.sh
mkvirtualenv -p /usr/local/bin/python3 taiga
export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig
# 必要なライブラリのインストール
pip install -r requirements.txt
# dbmoduleを入れる
python manage.py migrate --noinput
python manage.py loaddata initial_user
python manage.py loaddata initial_project_templates
python manage.py compilemessages
python manage.py collectstatic --noinput
# サンプルデーターを入れる場合
# python manage.py sample_data
# 設定ファイルをコピー
cp ~/taiga-back/settings/local.py.example ~/taiga-back/settings/local.py
vi ~/taiga-back/settings/local.py
既存のimport分の下に追加する
from .common import *
MEDIA_URL = "http://192.168.x.x/media/"
STATIC_URL = "http://192.168.x.x/static/"
SITES["front"]["scheme"] = "http"
SITES["front"]["domain"] = "example.com"
SECRET_KEY = "theveryultratopsecretkey"
DEBUG = FalsePUBLIC_REGISTER_ENABLED = True
DEFAULT_FROM_EMAIL = "no-reply@example.com"
SERVER_EMAIL = DEFAULT_FROM_EMAIL
# Uncomment and populate with proper connection parameters
# for enable email sending. EMAIL_HOST_USER should end by @domain.tld
# EMAIL_BACKEND = "django.core.mail.backends.smtp.EmailBackend"
# EMAIL_USE_TLS = False#EMAIL_HOST = "localhost"
# EMAIL_HOST_USER = ""
# EMAIL_HOST_PASSWORD = ""#EMAIL_PORT = 25
# Uncomment and populate with proper connection parameters
# for enable github login/singin.
# GITHUB_API_CLIENT_ID = "yourgithubclientid"
# GITHUB_API_CLIENT_SECRET = "yourgithubclientsecret"
# コメント外す
MEDIA_ROOT = '/home/taiga/media'
# DBの設定も併せて変更
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql',
'NAME': 'taiga',
'USER': 'taiga',
'PASSWORD': 'taiga',
'HOST': 'localhost',
'PORT': '5432',
}
}
taiga-backの動作検証
workon taiga
python manage.py runserver
telnet locahost 8000
にて「GET /」 で返事が帰ってくるか確認
taiga-frontのインストール
cd ~
git clone https://github.com/taigaio/taiga-front-dist.git taiga-front-dist
cd taiga-front-dist
git checkout stable
cp ~/taiga-front-dist/dist/conf.example.json ~/taiga-front-dist/dist/conf.json
# 設定ファイルを編集する
vi dist/conf.json
以下の通りに変更する
{
"api": "http://192.168.x.x:8000/api/v1/", #<--あとからここを変更する
"eventsUrl": "ws://192.168.x.x:8000/events", #<--ここを変更
"eventsMaxMissedHeartbeats": 5,
"eventsHeartbeatIntervalTime": 60000,
"eventsReconnectTryInterval": 10000,
"debug": true,
"debugInfo": false,
"defaultLanguage": "en",
"themes": ["taiga"],
"defaultTheme": "taiga",
"publicRegisterEnabled": true,
"feedbackEnabled": true,
"privacyPolicyUrl": null,
"termsOfServiceUrl": null,
"maxUploadFileSize": null,
"contribPlugins": [],
"tribeHost": null,
"importers": [],
"gravatar": true
}
Apacheの設定を行う
vi /usr/local/apache2/conf/extra/httpd-vhosts.conf
以下を追加
<VirtualHost *:80>
DocumentRoot /home/taiga/taiga-front-dist/dist
ServerName taiga.toriten.oita
ErrorLog logs/taiga.toriten.oita-error_log
CustomLog logs/taiga.toriten.oita-access_log combined
Alias /static /home/taiga/taiga-back/static
Alias /media /home/taiga/taiga-back/media
ProxyPass /api http://localhost:8001/api
ProxyPassReverse /api http://localhost:8001/api
ProxyPass /admin http://localhost:8001/admin
ProxyPassReverse /admin http://localhost:8001/admin
</VirtualHost>
サービスモジュールをインストール
rootユーザーにて以下の作業を行う
※pipでは入れない(pip install circus は使わない)
# logDirectoryを作成する
mkdir /home/taiga/logs
chown -R taiga:taiga /home/taiga/logs
chmod -R 666 /home/taiga/logs
# 普通に入れる
cd /usr/local/src
wget https://pypi.python.org/packages/68/41/02c6f5edea2df80b133a12753aee3e698e9130a5c878a9b0bffcf1e17e65/circus-0.14.0.tar.gz#md5=48e6b220fb0cafca46e3ae1f6ec4bce8
tar xvzf circus-0.14.0.tar.gz
cd tar xvzf circus-0.14.0
python3 setup.py install
# サービス設定ファイル
vi /usr/local/etc/taiga.ini
[watcher:taiga]
working_dir = /home/taiga/taiga-back
cmd = gunicorn
args = -w 3 -t 60 --pythonpath=. -b 127.0.0.1:8001 taiga.wsgi
uid = taiga
numprocesses = 1
autostart = true
send_hup = true
stdout_stream.class = FileStream
stdout_stream.filename = /home/taiga/logs/gunicorn.stdout.log
stdout_stream.max_bytes = 10485760
stdout_stream.backup_count = 4
stderr_stream.class = FileStream
stderr_stream.filename = /home/taiga/logs/gunicorn.stderr.log
stderr_stream.max_bytes = 10485760
stderr_stream.backup_count = 4
[env:taiga]
PATH = /home/taiga/.virtualenvs/taiga/bin:$PATH
TERM=rxvt-256color
SHELL=/bin/bash
USER=taiga
LANG=en_US.UTF-8
HOME=/home/taiga
PYTHONPATH=/home/taiga/.virtualenvs/taiga/lib/python3.5/site-packages
サービスを起動する
/usr/local/bin/circusd /usr/local/etc/taiga.ini
# 権限設定
mkdir -p /home/taiga/taiga-back/media
chmod -R 666 /home/taiga/taiga-back/media
# Frontの最終設定
su taiga
cd ~/taiga-front-dist/dist/
vi conf.json
apiとeventsUrlのポート番号を消す
{
"api": "http://192.168.x.x/api/v1/", #<--ここの8001を消す
"eventsUrl": "ws://192.168.x.x/events", #<--ここの8001を消す
"eventsMaxMissedHeartbeats": 5,
"eventsHeartbeatIntervalTime": 60000,
"eventsReconnectTryInterval": 10000,
"debug": true,
"debugInfo": false,
"defaultLanguage": "en",
"themes": ["taiga"],
"defaultTheme": "taiga",
"publicRegisterEnabled": true,
"feedbackEnabled": true,
"privacyPolicyUrl": null,
"termsOfServiceUrl": null,
"maxUploadFileSize": null,
"contribPlugins": [],
"tribeHost": null,
"importers": [],
"gravatar": true
}
アドレスのURLを再確認
サーバーのIPアドレスもしくは、FQDNを開き確認する
以下のIP/PWがデフォルト
ID:admin
PW:123123
サービスの起動ファイル作成
cat > /usr/lib/systemd/system/circus.service << EOF
[Unit]
Description=circus
[Service]
ExecStart=/usr/local/bin/circusd /usr/local/etc/taiga.ini
EOF
自動起動の設定
systemctl start circus
systemctl enable circus
参考
http://qiita.com/maskedw/items/aaa2fd7abfd493cf2820
https://taigaio.github.io/taiga-doc/dist/setup-production.html#circus-and-gunicorn
https://tomkarho.com/installation-of-taiga-io-on-centos-7/