在Ubuntu 20.04上安装Taiga项目管理平台
我们将介绍在Ubuntu 20.04上设置Taiga项目管理平台所需的所有步骤。
TAIGA是一个开源项目管理Web应用程序,具有为小型和大型团队设计的Scrum。
Taiga.io建于Python,Django,Angularjs和CoffeeScript之上。
此项目管理工具为我们提供了一种简单而有效的方法来管理项目,改进协作,时间跟踪,错误跟踪,Kanban板,Wiki,报告,积压和更多。
TAIGA平台由三个主要模块组成,每个模块都有自己的依赖性,它们都在编译时和运行时:
taiga-back - 这是后端/api moduletaiga-front-dist - 为用户提供portal.taiga-events - WebSockets Gateway。
这是可选的,可以安装或者跳过。
本教程假设我们正在进行新安装的Ubuntu 20.04服务器。
确保所有软件包都更新为最新版本。
sudo apt update sudo apt upgrade -y
继续在使用下一个安装步骤之前重新启动系统。
sudo reboot
第1步:设置服务器主机名和DNS
让我们首先设置正确的服务器主机名:
sudo hostnamectl set-hostname taiga.hirebestengineers.com --static
确认主机名设置。
$hostnamectl
Static hostname: taiga.hirebestengineers.com
Icon name: computer-vm
Chassis: vm
Machine ID: be43a41780154ad0b9148af9afe95a4e
Boot ID: 94c4e0892cf54c6baea75be6ff7387ba
Virtualization: kvm
Operating System: Ubuntu 20.04.1 LTS
Kernel: Linux 5.4.0-48-generic
Architecture: x86-64
将正确的IP地址和FQDN添加到/etc目录中的主机文件。
135.181.102.168 taiga.hirebestengineers.com
核实:
$host taiga.hirebestengineers.com taiga.hirebestengineers.com has address 135.181.102.168
还会在DNS服务器中添加一个记录。
确认是否可以从本地计算机查询记录。
$dig A taiga.hirebestengineers.com +short 135.181.102.168
第2步:安装依赖性包
下一步是安装运行Taiga项目管理平台所需的所有依赖性包。
安装Git,Python3和其他软件包:
sudo apt update sudo apt -y install git pwgen automake wget curl gettext 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 tmux
安装nginx Web服务器:
sudo apt -y install nginx
安装Redis和RabbitMQ:
sudo apt -y install rabbitmq-server redis-server
安装RabbitMQ服务器后,为TAIGA创建用户和VHOST:
$sudo rabbitmqctl add_user taiga StrongPassword Adding user "taiga" ... $sudo rabbitmqctl add_vhost taiga Adding vhost "taiga" ... $sudo rabbitmqctl set_permissions -p taiga taiga ".*" ".*" ".*" Setting permissions for user "taiga" in vhost "taiga" ...
安装node.js.
curl -sL https://deb.nodesource.com/setup_12.x | sudo -E bash sudo apt -y install nodejs
第3步:安装和配置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/focal-pgdg main" | sudo tee /etc/apt/sources.list.d/pgdg.list
更新包列表并安装 postgresql软件包
sudo apt update sudo apt install postgresql -y
使用:设置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 (12.4 (Ubuntu 12.4-1.pgdg20.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用户数据库密码。
第4步:安装和配置Taiga后端
创建Taiga用户:
$sudo adduser taiga Adding user `taiga' ... Adding new group `taiga' (1000) ... Adding new user `taiga' (1000) with group `taiga' ... Creating home directory `/home/taiga' ... Copying files from `/etc/skel' ... New password: Retype new password: passwd: password updated successfully Changing the user information for taiga Enter the new value, or press ENTER for the default Full Name []: Room Number []: Work Phone []: Home Phone []: Other []: Is the information correct? [Y/n] y $sudo adduser taiga sudo Adding user `taiga' to group `sudo' ... Adding user taiga to group sudo Done.
切换到Taiga用户帐户并创建日志文件夹
$su - taiga $mkdir -p ~/logs $ls 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
如果我们收到错误消息"mkvirtualenv:命令找不到命令"请参阅以下教程:
修复ubuntu上找不到的mkvirtualenv命令
使用初始基本数据填充数据库
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:
$vim ~/taiga-back/settings/local.py
复制并更新以下内容:
from .common import *
MEDIA_URL = "http://taiga.hirebestengineers.com/media/"
STATIC_URL = "http://taiga.hirebestengineers.com/static/"
SITES["front"]["scheme"] = "http"
SITES["front"]["domain"] = "taiga.hirebestengineers.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连接用户名和PasswordTaiga域名ChareCRET密钥和可选电子邮件设置。
配置验证
要确保一切都有效,请发出以下命令以进行测试的开发模式下的后端:
workon taiga_venv python manage.py runserver
示例成功
Trying import local.py settings... Trying import local.py settings... Performing system checks... System check identified no issues (0 silenced). September 30, 2017 - 20:29:24 Django version 2.2.16, using settings 'settings' Starting development server at http://127.0.0.1:8000/ Quit the server with CONTROL-C.
打开一个不同的shell并尝试卷曲:
curl http://127.0.0.1:8000/api/v1/
禁用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 vim ~/taiga-front-dist/dist/conf.json
在下面的模式下编辑示例配置(替换为我们自己的详细信息):
{
"api": "http://taiga.hirebestengineers.com/api/v1/",
"eventsUrl": "ws://taiga.hirebestengineers.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.hirebestengineers.com用你的DNS名称。
第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
创建Taiga事件的配置文件。
cp config.example.json config.json
编辑配置文件并设置RabbitMQ URL和秘密密钥:
$vim config.json
{
"url": "amqp://taiga:Hyman@theitroad:5672/taiga",
"secret": "OQOEJNSJIQHDBQNSUQEJSNNANsqQPAASQLSMSOQND",
"webSocketServer": {
"port": 8888
}
}
config.json中的秘密值必须与~/taiga-back/settings/local.py中的secret_key相同!
将Taiga-Events添加到SystemD配置:
sudo tee /etc/systemd/system/taiga_events.service<<EOF [Unit] Description=taiga_events After=network.target [Service] User=taiga WorkingDirectory=/home/taiga/taiga-events ExecStart=/bin/bash -c "node_modules/coffeescript/bin/coffee index.coffee" Restart=always RestartSec=3 [Install] WantedBy=default.target EOF
重新加载系统并启动服务:
sudo systemctl daemon-reload sudo systemctl start taiga_events sudo systemctl enable taiga_events
检查服务是否处于运行状态:
$systemctl status taiga_events.service
● taiga_events.service - taiga_events
Loaded: loaded (/etc/systemd/system/taiga_events.service; enabled; vendor preset: enabled)
Active: active (running) since Wed 2017-09-30 22:51:07 CEST; 3min 17s ago
Main PID: 18269 (node)
Tasks: 7 (limit: 4567)
Memory: 18.8M
CGroup: /system.slice/taiga_events.service
└─18269 node node_modules/coffeescript/bin/coffee index.coffee
第7步:启动Taiga服务
创建一个新的taiga systemd文件:
sudo tee /etc/systemd/system/taiga.service<<EOF [Unit] Description=taiga_back After=network.target [Service] User=taiga Environment=PYTHONUNBUFFERED=true WorkingDirectory=/home/taiga/taiga-back ExecStart=/home/taiga/.virtualenvs/taiga_venv/bin/gunicorn --workers 4 --timeout 60 -b 127.0.0.1:8001 taiga.wsgi Restart=always RestartSec=3 [Install] WantedBy=default.target EOF
重新加载SystemD守护程序并启动Taiga服务:
sudo systemctl daemon-reload sudo systemctl start taiga sudo systemctl enable taiga
执行以下命令以检查服务是否正在运行。
$sudo systemctl status taiga
● taiga.service - taiga_back
Loaded: loaded (/etc/systemd/system/taiga.service; enabled; vendor preset: enabled)
Active: active (running) since Wed 2017-09-30 22:58:28 CEST; 7s ago
Main PID: 19087 (gunicorn)
Tasks: 5 (limit: 4567)
Memory: 266.1M
CGroup: /system.slice/taiga.service
├─19087 /home/taiga/.virtualenvs/taiga_venv/bin/python /home/taiga/.virtualenvs/taiga_venv/bin/gunicorn --workers 4 --timeout 60 -b 127.0.0.1:8001 t>
├─19109 /home/taiga/.virtualenvs/taiga_venv/bin/python /home/taiga/.virtualenvs/taiga_venv/bin/gunicorn --workers 4 --timeout 60 -b 127.0.0.1:8001 t>
├─19110 /home/taiga/.virtualenvs/taiga_venv/bin/python /home/taiga/.virtualenvs/taiga_venv/bin/gunicorn --workers 4 --timeout 60 -b 127.0.0.1:8001 t>
├─19111 /home/taiga/.virtualenvs/taiga_venv/bin/python /home/taiga/.virtualenvs/taiga_venv/bin/gunicorn --workers 4 --timeout 60 -b 127.0.0.1:8001 t>
└─19112 /home/taiga/.virtualenvs/taiga_venv/bin/python /home/taiga/.virtualenvs/taiga_venv/bin/gunicorn --workers 4 --timeout 60 -b 127.0.0.1:8001 t>
Sep 30 22:58:28 taiga.hirebestengineers.com gunicorn[19087]: /usr/lib/python3.8/os.py:1023: RuntimeWarning: line buffering (buffering=1) isn't supported in binar>
Sep 30 22:58:28 taiga.hirebestengineers.com gunicorn[19087]: return io.open(fd, *args, **kwargs)
Sep 30 22:58:28 taiga.hirebestengineers.com gunicorn[19109]: [2017-09-30 22:58:28 +0200] [19109] [INFO] Booting worker with pid: 19109
Sep 30 22:58:28 taiga.hirebestengineers.com gunicorn[19110]: [2017-09-30 22:58:28 +0200] [19110] [INFO] Booting worker with pid: 19110
Sep 30 22:58:28 taiga.hirebestengineers.com gunicorn[19109]: Trying import local.py settings...
Sep 30 22:58:28 taiga.hirebestengineers.com gunicorn[19110]: Trying import local.py settings...
Sep 30 22:58:28 taiga.hirebestengineers.com gunicorn[19111]: [2017-09-30 22:58:28 +0200] [19111] [INFO] Booting worker with pid: 19111
Sep 30 22:58:28 taiga.hirebestengineers.com gunicorn[19112]: [2017-09-30 22:58:28 +0200] [19112] [INFO] Booting worker with pid: 19112
Sep 30 22:58:28 taiga.hirebestengineers.com gunicorn[19111]: Trying import local.py settings...
Sep 30 22:58:29 taiga.hirebestengineers.com gunicorn[19112]: Trying import local.py settings...
步骤8:配置nginx
Taiga-Front-Dist和Taiga背面都必须使用代理/静态文件Web服务器暴露在外部。
为此目的,Taiga使用nginx。
nginx用作静态文件Web服务器,以提供Taiga-Front-Dist并将代理请求发送到Taiga-Back。
首先删除默认的nginx配置文件。
sudo rm /etc/nginx/sites-enabled/default
为TAIGA创建Nginx VirtualHost:
sudo vim /etc/nginx/conf.d/taiga.conf
相应地修改配置文件。
server {
listen 80 default_server;
server_name _; # See http://nginx.org/en/docs/http/server_names.html
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 http://127.0.0.1:8001/api;
proxy_redirect off;
}
# 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;
}
# 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;
}
}
验证nginx配置:
$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
检查状态:
$systemctl status nginx
● nginx.service - A high performance web server and a reverse proxy server
Loaded: loaded (/lib/systemd/system/nginx.service; enabled; vendor preset: enabled)
Active: active (running) since Wed 2017-09-30 23:21:51 CEST; 27s ago
Docs: man:nginx(8)
Process: 20262 ExecStartPre=/usr/sbin/nginx -t -q -g daemon on; master_process on; (code=exited, status=0/SUCCESS)
Process: 20276 ExecStart=/usr/sbin/nginx -g daemon on; master_process on; (code=exited, status=0/SUCCESS)
Main PID: 20277 (nginx)
Tasks: 3 (limit: 4567)
Memory: 3.5M
CGroup: /system.slice/nginx.service
├─20277 nginx: master process /usr/sbin/nginx -g daemon on; master_process on;
├─20278 nginx: worker process
└─20279 nginx: worker process
Sep 30 23:21:51 taiga.hirebestengineers.com systemd[1]: Starting A high performance web server and a reverse proxy server...
Sep 30 23:21:51 taiga.hirebestengineers.com systemd[1]: Started A high performance web server and a reverse proxy server.
第9步:访问Taiga Web登录仪表板
打开我们喜欢的Web浏览器并转到:
http://your_taiga_domain.com
我们应该获取登录屏幕。
使用以下默认凭据登录:
Username: admin Password: 123123
然后在管理员上更改管理员密码>更改密码
第10步:使用SSL安全安装
请按照下面的教程以使用SSL证书来硬化Taiga安装。
使用Let's Encrypt SSL保护Taiga项目管理平台
如何禁用自我注册
为防止用户注册,请编辑文件~/taiga-back/settings/local.py并将public_register_enabled的值设置为false。
$su - taiga $vim ~/taiga-back/settings/local.py PUBLIC_REGISTER_ENABLED = False
Taiga Frontend的更改设置:
$vim ~/taiga-front-dist/dist/conf.json "publicRegisterEnabled": false
更新配置后重新启动所有Taiga服务:
sudo systemctl restart 'taiga*'
重新加载nginx:
sudo systemctl reload nginx

