Taiga是一种项目管理器,网络上关于taiga的安装部署资料特别少,本人在安装taiga过程中也碰了不少壁,为方便大家安装taiga,我自己写了份安装手册如下:
(原文是用txt文件写的,放在论坛上可能不太好看)
官方安装手册(英文):http://taigaio.github.io/taiga-doc/dist/setup-production.html
*原文中标注“选装”(optional)的,本文档都没有涉及。
系统环境 Ubuntu 14.04
*注意:请不要在root用户下进行安装;前台和后端的安装相互独立
一、后端的安装
1.1安装依赖包
sudo apt-get install -y build-essential binutils-doc autoconf flex bison libjpeg-dev
sudo apt-get install -y libfreetype6-dev zlib1g-dev libzmq3-dev libgdbm-dev libncurses5-dev
sudo apt-get install -y automake libtool libffi-dev curl git tmux gettext
1.2安装postgresql(版本不低于9.3)数据库
sudo apt-get install -y postgresql-9.3 postgresql-contrib-9.3
sudo apt-get install -y postgresql-doc-9.3 postgresql-server-dev-9.3
创建数据库及用户
sudo -u postgres createuser [此处填写ubuntu系统用户名]
sudo -u postgres createdb [也是用户名] -O [也是用户名]
例:我的用户名是ubuntu(前面说了不要在root用户下安装) 因此是 sudo -u postgres createuser ubuntu,
例:sudo -u postgres createdb ubuntu -O ubuntu
*注意:上面的“O”是大写的字母O;
1.3安装python环境
sudo apt-get install -y python3 python3-pip python-dev python3-dev python-pip virtualenvwrapper
sudo apt-get install libxml2-dev libxslt-dev
**下面修改数据库配置文件在官方文档中没有
修改配置文件:
sudo vi ~/etc/postgresql/9.3/main/pg_hba.conf
找到
local all postgres peer
改为:
local all postgres trust
下面跟着官方文档
安装到这一步,在进行下一步安装前需要重启操作系统。
下载代码:
cd ~ ##回目录
git clone <a href="https://github.com/taigaio/taiga-back.git" target="_blank">https://github.com/taigaio/taiga-back.git</a> taiga-back
cd taiga-back
git checkout stable
创建新的虚拟环境并取名taiga(最好取这个名,否则完全按照本文档容易报错):
mkvirtualenv -p /usr/bin/python3.4 taiga
安装依赖包:
pip install -r requirements.txt #这一步要在目录~/taiga-back 下执行,否则报错
初始化数据库数据:
python manage.py migrate
python manage.py loaddata initial_user
python manage.py loaddata initial_project_templates
python manage.py loaddata initial_role
python manage.py compilemessages
python manage.py collectstatic
*此处有大量的安装,请不要敲错代码。如果直接复制粘贴代码,建议找上面提到的官方文档来复制代码。
在~/taiga-back/settings下新建文档local.py
绝对路径:~/taiga-back/settings/local.py
新建文档中加入:
from .common import *
MEDIA_URL = "<a href="http://localhost/media/" target="_blank">http://localhost/media/</a>" ##作者注:请注意官方文档中的example.com(这是官方文档中配置用到的主机名)
STATIC_URL = "<a href="http://localhost/static/" target="_blank">http://localhost/static/</a>" ##此处我用localhost代替了,经测试localhost能满足本机或服务器提供服务的情况,用localhost即可
ADMIN_MEDIA_PREFIX = "<a href="http://localhost/static/admin/" target="_blank">http://localhost/static/admin/</a>"
SITES["front"]["scheme"] = "http"
SITES["front"]["domain"] = "localhost"
SECRET_KEY = "theveryultratopsecretkey"
DEBUG = False
TEMPLATE_DEBUG = False
PUBLIC_REGISTER_ENABLED = True
DEFAULT_FROM_EMAIL = "<a href="mailto:no-reply@example.com" target="_blank">no-reply@example.com</a>" ##作者注:电邮部分在本文档中没有配置(官方文档中属于选装)
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"
上述步骤完成后,
输入:
workon taiga
在目录~/taiga-back下
执行:
python manage.py runserver 192.168.33.139:8000
*解释下192.168.33.139,是我所用服务器的内网IP,在搭建的时候请改成你们自己机器的IP
*如果只是在本机使用直接用python manage.py runserver 或者是python manage.py runserver 127.0.0.1:8000即可
执行后打开http://192.168.33.139:8000/api/v1/(同样192.168.33.139换成自己的IP)成功证明安装完成。
打开[url=http://[IP]:8000/admin/]http://[IP]:8000/admin/[/url]后 用户名:Admin 密码:123123 可登陆后台。
二、前端安装
下载代码:
cd ~
git clone <a href="https://github.com/taigaio/taiga-front-dist.git" target="_blank">https://github.com/taigaio/taiga-front-dist.git</a> taiga-front-dist
cd taiga-front-dist
git checkout stable
然后复制文件conf.example.json到conf.json
cp ~/taiga-front-dist/dist/conf.example.json ~/taiga-front-dist/dist/conf.json
打开conf.json更改配置:
sudo vi ~/taiga-front-dist/dist/conf.json
修改为如下:
{
"api": "<a href="http://example.com/api/v1/" target="_blank">http://example.com/api/v1/</a>", ##example.com改为你想提供服务的ip,要和上面的一样
"eventsUrl": "ws://example.com/events", ##同样改掉example.com
"debug": "true",
"publicRegisterEnabled": true,
"feedbackEnabled": true,
"privacyPolicyUrl": null,
"termsOfServiceUrl": null,
"maxUploadFileSize": null,
"contribPlugins": []
}
至此,前端配置完成。
三、最后一步
Circus安装:
sudo pip2 install circus
如果文件~/conf/不存在就创建它:(cd ~/conf/报错才执行这一步)
mkdir -p ~/conf/
初始配置文件~/conf/circus.ini
sudo vi ~/conf/circus.ini
如下:
[circus]
check_delay = 5
endpoint = tcp://127.0.0.1:5555
pubsub_endpoint = tcp://127.0.0.1:5556
statsd = true
[watcher:taiga]
working_dir = /home/taiga/taiga-back ##/home/taiga taiga是文档中安装的用户名,要改为自己的
#作者注:我的是working_dir = /home/ubuntu/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.filename = /home/ubuntu/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.filename = /home/ubuntu/logs/gunicorn.stderr.log
stderr_stream.max_bytes = 10485760
stderr_stream.backup_count = 4
[env:taiga]
PATH = /home/taiga/.virtualenvs/taiga/bin:$PATH
##改掉,我的是PATH = /home/ubuntu/.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.4/site-packages
##改掉,我的是PYTHONPATH=/home/ubuntu/.virtualenvs/taiga/lib/python3.4/site-packages
修改初始化文件:
sudo vi /etc/init/circus.conf
写为如下内容:
start on filesystem and net-device-up IFACE=lo
stop on runlevel [016]
respawn
exec /usr/local/bin/circusd /home/taiga/conf/circus.ini ##/home/taiga又出现了,请改掉
启动circus服务:
sudo service circus start
安装Nginx:
sudo apt-get install -y nginx
配置文件:/etc/nginx/sites-available/taiga
sudo vi /etc/nginx/sites-available/taiga
写入如下内容:
**注意文件中所有的/home/taiga改为/home/[你的用户名]
**127.0.0.1这一IPA改成你上面用到的IP
server {
listen 80 default_server;
server_name _;
large_client_header_buffers 4 32k;
client_max_body_size 50M;
charset utf-8;
access_log /home/taiga/logs/nginx.access.log;
error_log /home/taiga/logs/nginx.error.log;
# Frontend
location / {
root /home/taiga/taiga-front-dist/dist/;
try_files $uri $uri/ /index.html;
}
# Backend
location /api {
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Scheme $scheme;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass <a href="http://127.0.0.1:8001/api" target="_blank">http://127.0.0.1:8001/api</a>;
proxy_redirect off;
}
# Django admin access (/admin/)
location /admin {
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Scheme $scheme;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass <a href="http://127.0.0.1:8001$request_uri" target="_blank">http://127.0.0.1:8001$request_uri</a>;
proxy_redirect off;
}
# Static files
location /static {
alias /home/taiga/taiga-back/static;
}
# Media files
location /media {
alias /home/taiga/taiga-back/media;
}
移除默认配置文件:
sudo rm /etc/nginx/sites-enabled/default
再执行:
sudo ln -s /etc/nginx/sites-available/taiga /etc/nginx/sites-enabled/taiga
使虚拟主机能够工作
可用 sudo nginx -t 检查出错情况
再执行
sudo service nginx restart
进行服务重启
提供服务的代码步骤是:
sudo service nginx restart
workon taiga
cd ~/taiga-back
python manage.py runserver 192.168.33.139:8000
然后在http://192.168.33.139/上登录(当然这是我的IP,改成你主机的),成功后的界面与taiga官网界面一样。
官网地址:https://taiga.io/
**安装中出错,大多数是在配置文件中,请检查配置文件
**安装软件包出错的可能性小
本人所写,原载于www.bigdatafnl.com