在Ubuntu 18.04 LTS上安装Taiga.IO项目管理工具

时间:2020-02-23 14:38:49  来源:igfitidea点击:

欢迎我们关于如何在Ubuntu 18.04上安装Taiga.io项目管理工具的教程。
Taiga.io是一个具有scrum的项目管理Web应用程序。
它建立在Django和Angularjs之上。
Taiga为我们提供了一个简单而有效的项目协作,时间跟踪,错误跟踪,Kanban Lobar,Wiki,Reporting,Backlogs 等。

Ubuntu 20.04的更新:在Ubuntu 20.04上安装Taiga项目管理平台

第1步:设置所有准备工作/依赖项

设置主机系统主机名并更新系统

sudo hostnamectl set-hostname taiga.example.com
sudo apt update

然后通过运行命令来安装taiga.io依赖包:

sudo apt -y install git pwgen automake wget curl gettext circus build-essential libgdbm-dev  binutils-doc autoconf flex gunicorn bison libjpeg-dev libzmq3-dev libfreetype6-dev zlib1g-dev libncurses5-dev libtool libxslt-dev libxml2-dev libffi-dev python3 virtualenvwrapper python3-dev python3-pip python3-dev libssl-dev circus nginx

确认Python版本安装,应为3.6

$python3 -V
Python 3.6.6

建议将PIP升级到最新版本

sudo pip3 install --upgrade setuptools pip

另一个依赖项包是node.js,用咖啡脚本节点包安装它。

curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash 
sudo apt-get install -y gcc g++ make nodejs
sudo npm install -g gulp coffee-script

我们还需要创建一个用于运行和管理Taiga.io服务的用户帐户

sudo adduser taiga
sudo adduser taiga sudo

第2步:安装和配置PostgreSQL

Taiga.io需要PostgreSQL数据库服务器。
安装并配置如下:

导入存储库签名密钥:

wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add 

添加PostgreSQL APT存储库:

echo "deb http://apt.postgresql.org/pub/repos/apt/bionic-pgdg main" | sudo tee /etc/apt/sources.list.d/pgdg.list

更新包列表并安装 postgresql软件包

sudo apt update
sudo apt -y install postgresql-10

PostgreSQ110的配置文件是:

/etc/postgresql/10/main/postgresql.conf

使用:设置PostgreSQL管理员用户的密码:

$sudo passwd postgres
Enter new UNIX password: 
Retype new UNIX password: 
passwd: password updated successfully

为Taiga.io创建数据库和用户

$sudo su - postgres
Hyman@theitroad:~$createuser taiga 
Hyman@theitroad:~$psql 
psql (10.5 (Ubuntu 10.5-2.pgdg18.04+1))
Type "help" for help.
postgres=# ALTER USER taiga WITH ENCRYPTED password 'StrongPassword';
postgres=# CREATE DATABASE taiga OWNER taiga;
postgres=# \q
Hyman@theitroad:~$exit

替换:Taiga与数据库用户名用于Taiga.iostrongPassword,具有强大的Taiga用户数据库密码。

第3步:安装Erlang并配置RabbitMQ

TAIGA消息队列由RabbitMQ处理,但默认情况下未在Ubuntu上安装。
在本节中,我们将安装Erlang和RabbitMQ。

如何在Ubuntu 18.04 LTS上安装最新的Erlang

如何在Ubuntu 18.04 LTS上安装最新的RabbitMQ服务器

安装RabbitMQ服务器后,为Taiga创建一个用户和vhost

sudo rabbitmqctl add_user taiga StrongPassword
sudo rabbitmqctl add_vhost taiga
sudo rabbitmqctl set_permissions -p taiga taiga ".*" ".*" ".*"

第4步:安装和配置Taiga后端

切换到步骤1中创建的Taiga用户帐户并创建日志文件夹

su - taiga
mkdir -p ~/logs

克隆Taiga来自GitHub的后端项目

git clone https://github.com/taigaio/taiga-back.git
cd taiga-back
git checkout stable

创建virtualenv.

然后为taiga.io后端创建一个virtualenv并安装所需的依赖项

mkvirtualenv -p /usr/bin/python3 taiga_venv
pip3 install -r requirements.txt

使用初始基本数据填充数据库

python3 manage.py migrate --noinput
python3 manage.py loaddata initial_user
python3 manage.py loaddata initial_project_templates
python3 manage.py compilemessages
python3 manage.py collectstatic --noinput

数据将导入在上面的命令上运行的postgreSQL数据库。
这也创建了登录凭据的管理员帐户 admin密码 123123如果我们需要示例数据,则可以将其加载 python3 manage.py sample_data
这仅用于演示目的,稍后可能很难清理数据。

克里特岛配置

将以下配置复制到 ~/taiga-back/settings/local.py并使用我们自己的详细信息更新:

from .common import *
MEDIA_URL = "http://taiga.example.com/media/"
STATIC_URL = "http://taga.example.com/static/"
SITES["front"]["scheme"] = "http"
SITES["front"]["domain"] = "taiga.example.com"
SECRET_KEY = "OQOEJNSJIQHDBQNSUQEJSNNANsqQPAASQLSMSOQND"
DEBUG = False
PUBLIC_REGISTER_ENABLED = True
DEFAULT_FROM_EMAIL = "Hyman@theitroad"
SERVER_EMAIL = DEFAULT_FROM_EMAIL
#CELERY_ENABLED = True
EVENTS_PUSH_BACKEND = "taiga.events.backends.rabbitmq.EventsPushBackend"
EVENTS_PUSH_BACKEND_OPTIONS = {"url": "amqp://taiga:Hyman@theitroad:5672/taiga"}
# 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"

更改要适合环境的设置,设置RabbitMQ连接用户名和密码,Taiga.io域,密钥和可选电子邮件设置。

验证

要确保一切都有效,请发出以下命令以进行测试的开发模式下的后端:

workon taiga_venv
python manage.py runserver
curl http://127.0.0.1:8000/api/v1/

示例成功

Performing system checks...
System check identified no issues (0 silenced).
October 24, 2016 - 22:21:54
Django version 1.11.2, using settings 'settings'
Starting development server at http://127.0.0.1:8000/
Quit the server with CONTROL-C.

禁用VirtualEnv开始前端安装。

$deactivate

第5步:安装和配置Taiga Frontend

Taiga-Frant主要是在AngularJS和CoffeeScript中编写的,取决于后端。
在执行这些部分配置之前,我们需要使用Taiga后端。

切换到A. taiga用户帐号

su - taiga

克隆GitHub的项目源代码

git clone https://github.com/taigaio/taiga-front-dist.git
cd taiga-front-dist
git checkout stable

复制示例配置文件:

cp ~/taiga-front-dist/dist/conf.example.json ~/taiga-front-dist/dist/conf.json

在下面的模式下编辑示例配置(替换为我们自己的详细信息):

$cat ~/taiga-front-dist/dist/conf.json
{
    "api": "http://taiga.example.com/api/v1/",
    "eventsUrl": "ws://taiga.example.com/events",
    "eventsMaxMissedHeartbeats": 5,
    "eventsHeartbeatIntervalTime": 60000,
    "eventsReconnectTryInterval": 10000,
    "debug": true,
    "debugInfo": false,
    "defaultLanguage": "en",
    "themes": ["taiga"],
    "defaultTheme": "taiga",
    "publicRegisterEnabled": true,
    "feedbackEnabled": true,
    "supportUrl": "https://tree.taiga.io/support",
    "privacyPolicyUrl": null,
    "termsOfServiceUrl": null,
    "GDPRUrl": null,
    "maxUploadFileSize": null,
    "contribPlugins": [],
    "tribeHost": null,
    "importers": [],
    "gravatar": true,
    "rtlLanguages": ["fa"]
}

代替 taiga.example.com使用Taiga实际域名。
我们还可以更改其他参数以适合使用。

第6步:安装Taiga事件

Taiga-Events是TAIGA WebSocket服务器,它允许Taiga-Fort显示积压,任务牌,角板和问题的实时更改。
Taiga-Events使用RabbitMQ作为消息代理。

cd ~
git clone https://github.com/taigaio/taiga-events.git taiga-events
cd taiga-events

安装所需JavaScript依赖项

npm install
sudo npm install -g coffee-script

创建Taiga事件的配置文件。

cp config.example.json config.json

编辑文件 config.json和更新 rabbitmq urisecret key.

$cat ~/taiga-events/config.json
{
    "url": "amqp://taiga:Hyman@theitroad:5672/taiga",
    "secret": "OQOEJNSJIQHDBQNSUQEJSNNANQPAASQLSMSOQND",
    "webSocketServer": {
        "port": 8888
    }
}

代替 StrongPassword使用rabbitmq taiga用户密码和 OQOEJNSJIQHDBQNSUQEJSNNANQPAASQLSMSOQND使用秘密密钥生成并先前配置。

第7步:配置马戏团

Circus是一个Python应用程序,用于运行Taiga后端和事件。

sudo vim /etc/circus/conf.d/taiga-events.ini

添加:

[watcher:taiga-events]
working_dir = /home/taiga/taiga-events
cmd = /usr/bin/coffee
args = index.coffee
uid = taiga
numprocesses = 1
autostart = true
send_hup = true
stdout_stream.class = FileStream
stdout_stream.filename = /home/taiga/logs/taigaevents.stdout.log
stdout_stream.max_bytes = 10485760
stdout_stream.backup_count = 12
stderr_stream.class = FileStream
stderr_stream.filename = /home/taiga/logs/taigaevents.stderr.log
stderr_stream.max_bytes = 10485760
stderr_stream.backup_count = 12

也为Taiga创造一个 /etc/circus/conf.d/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_venv/bin:$PATH
TERM=rxvt-256color
SHELL=/bin/bash
USER=taiga
LANG=en_US.UTF-8
HOME=/home/taiga
PYTHONPATH=/home/taiga/.virtualenvs/taiga_venv/lib/python3.6/site-packages

重新加载CIRCUSD配置:

sudo systemctl restart circusd 
sudo systemctl status circusd

要验证服务是否正在运行,问题:

$circusctl status
circusd-stats: active
plugin:flapping: active
taiga: active
taiga-events: active

步骤8:配置nginx

最后一步是为Taiga创建一个新的nginx Virtualhost。

sudo vim /etc/nginx/conf.d/taiga.conf

添加以下数据:

server {
    listen 80;
    server_name taiga.example.com;
    large_client_header_buffers 4 32k;
    client_max_body_size 50M;
    charset utf-8;
    access_log /var/log/nginx/taiga.access.log;
    error_log /home/taiga/logs/taiga.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 http://127.0.0.1:8001/api;
        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 http://127.0.0.1:8001$request_uri;
        proxy_redirect off;
    }
    # Static files
    location /static {
        alias /home/taiga/taiga-back/static;
    }
    # Media files
    location /media {
        alias /home/taiga/taiga-back/media;
    }
	# Taiga-events
	location /events {
	proxy_pass http://127.0.0.1:8888/events;
	proxy_http_version 1.1;
	proxy_set_header Upgrade $http_upgrade;
	proxy_set_header Connection "upgrade";
	proxy_connect_timeout 7d;
	proxy_send_timeout 7d;
	proxy_read_timeout 7d;
	}
}

确认配置语法:

$sudo nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful

现在,我们可以重新启动nginx服务

sudo systemctl restart nginx
sudo systemctl status nginx

现在我们应该有服务并运行 http://example.com/
使用用户名管理员和密码123123登录。