在CentOS 8上安装Taiga项目管理工具
Taiga是面向小型和大型企业的开源敏捷项目管理平台。它的功能与Jira和Trello等商业项目管理解决方案并驾齐驱。 Taiga平台基于Python,Django,AngularJS和CoffeeScript构建。通过使用基于云的产品,我们可以轻松地开始使用Taiga,也可以采用艰难的方式将其安装在内部基础架构上。在今天的指南中,我们将深入介绍在CentOS 8上的Taiga项目管理工具的安装和配置。
使用Taiga,我们可以极大地改善工作流程并节省内部团队内部以及与客户之间的大量管理和沟通时间。票务系统非常出色,可以成为快速响应客户需求的主要方式。
Taiga平台具有三个主要模块,分别是:
taiga-back用Python和Djangotaiga-front-dist编写,用AngularJS和CoffeeScripttaiga-events用JavaScript编写。
我们需要重新安装CentOS 8服务器才能进行此设置。通过运行以下命令,确保服务器已更新。
sudo dnf -y update
更新完成后,请考虑重新启动。
sudo systemctl reboot
将SELinux放宽,并设置服务器主机名
如果已将服务器SELinux设置为Enforcing,则将其置于Permissive模式:
sudo setenforce 0 sudo sed -i 's/^SELINUX=.*/SELINUX=permissive/g' /etc/selinux/config
在服务器上设置FQDN主机名。
fqdn_hostname="projects.hirebestengineers.com" sudo hostnamectl set-hostname ${fqdn_hostname} --static sudo hostnamectl set-hostname ${fqdn_hostname} --transient
确认主机名设置。
$hostnamectl Static hostname: projects.hirebestengineers.com Icon name: computer-vm Chassis: vm Machine ID: 5ba3065ca48e47fca70cdbaf22866fc7 Boot ID: 15a036b5710f4bb4a6c6da83ac6c05eb Virtualization: kvm Operating System: CentOS Linux 8 (Core) CPE OS Name: cpe:/o:centos:centos:8 Kernel: Linux 4.18.0-193.19.1.el8_2.x86_64 Architecture: x86-64
将正确的IP地址和FQDN添加到/etc/hosts目录。
95.217.216.7 projects.hirebestengineers.com
校验:
$sudo dnf -y install bind-utils $host projects.hirebestengineers.com projects.hirebestengineers.com has address 95.217.216.7
还要在DNS服务器中添加A记录。
确认是否可以从本地计算机查询记录。
$dig A projects.hirebestengineers.com ; <<>> DiG 9.11.13-RedHat-9.11.13-6.el8_2.1 <<>> A projects.hirebestengineers.com ;; global options: +cmd ;; Got answer: ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 57153 ;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1 ;; OPT PSEUDOSECTION: ; EDNS: version: 0, flags:; udp: 4096 ;; QUESTION SECTION: ;projects.hirebestengineers.com. IN A ;; ANSWER SECTION: projects.hirebestengineers.com. 273 IN A 95.217.216.7 ;; Query time: 0 msec ;; SERVER: 213.133.98.98#53(213.133.98.98) ;; WHEN: Fri Oct 02 21:10:27 CEST 2017 ;; MSG SIZE rcvd: 75
安装依赖项程序包
让我们在CentOS 8上安装基本的标准软件包。
sudo dnf -y install epel-release sudo dnf config-manager --set-enabled PowerTools sudo dnf -y install git wget curl bash-completion vim pwgen
安装Python软件包:
sudo dnf -y install @python38 python38-devel virtualenv sudo pip3 install virtualenvwrapper
安装Nginx Web服务器:
sudo dnf -y install nginx
安装Redis,RabbitMQ和Node.js
安装Redis:
sudo dnf -y install @redis sudo systemctl enable --now redis
安装RabbitMQ:
curl -s https://packagecloud.io/install/repositories/rabbitmq/rabbitmq-server/script.rpm.sh | sudo bash sudo dnf -y install rabbitmq-server sudo systemctl enable --now rabbitmq-server.service
安装RabbitMQ服务器后,为Taiga创建用户和虚拟主机:
$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
sudo dnf -y install @nodejs
安装和配置PostgreSQL
Taiga要求PostgreSQL数据库服务器保留数据。运行以下命令以在CentOS 8上安装PostgreSQL数据库服务器。
sudo dnf install -y @postgresql
初始化数据库服务器:
sudo /usr/bin/postgresql-setup initdb
启动并启用PostgreSQL数据库服务。
sudo systemctl enable --now postgresql
使用以下命令设置PostgreSQL管理员用户密码:
$sudo passwd postgres Enter new UNIX password: Retype new UNIX password: passwd: password updated successfully
为Taiga创建数据库和用户。
$sudo su - postgres theitroad@localhost:~$createuser taiga theitroad@localhost:~$psql psql (10.14) Type "help" for help. postgres=# ALTER USER taiga WITH ENCRYPTED password 'StrongPassword'; postgres=# CREATE DATABASE taiga OWNER taiga; postgres=# \q theitroad@localhost:~$exit
用Taiga.ioStrongPassword数据库用户名替换taiga,并使用taiga用户的强数据库密码替换。
安装和配置Taiga后端
在CentOS Linux上创建专用的taiga用户。
$sudo adduser taiga $sudo passwd taiga Changing password for user taiga. New password: Retype new password: passwd: all authentication tokens updated successfully. $sudo usermod -aG wheel taiga
切换到Taiga用户帐户并创建日志文件夹
$su - taiga $mkdir -p ~/logs $ls logs
Github的克隆Taiga后端项目
$git clone https://github.com/taigaio/taiga-back.git Cloning into 'taiga-back'... remote: Enumerating objects: 40, done. remote: Counting objects: 100% (40/40), done. remote: Compressing objects: 100% (31/31), done. remote: Total 37230 (delta 13), reused 26 (delta 8), pack-reused 37190 Receiving objects: 100% (37230/37230), 18.97 MiB | 5.50 MiB/s, done. Resolving deltas: 100% (25889/25889), done. $cd taiga-back $git checkout stable
升级pip3:
sudo pip3 install --upgrade pip
使用pip安装Python依赖项:
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.
创建配置
将以下配置复制到~/taiga-back/settings/local.py中:
$vim ~/taiga-back/settings/local.py
复制并更新以下内容:
from .common import * MEDIA_URL = "http://projects.hirebestengineers.com/media/" STATIC_URL = "http://projects.hirebestengineers.com/static/" SITES["front"]["scheme"] = "http" SITES["front"]["domain"] = "projects.hirebestengineers.com" SECRET_KEY = "OQOEJNSJIQHDBQNSUQEJSNNANsqQPAASQLSMSOQND" DEBUG = False PUBLIC_REGISTER_ENABLED = True DEFAULT_FROM_EMAIL = "theitroad@localhost" SERVER_EMAIL = DEFAULT_FROM_EMAIL #CELERY_ENABLED = True EVENTS_PUSH_BACKEND = "taiga.events.backends.rabbitmq.EventsPushBackend" EVENTS_PUSH_BACKEND_OPTIONS = {"url": "amqp://taiga:theitroad@localhost: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"
更改设置以适合环境,设置:兔子MQ连接用户名和密码Taiga域名密钥和可选电子邮件设置。
为了确保一切正常,请发出以下命令以开发模式运行后端进行测试:
python3 manage.py runserver
示例成功输出:
Trying import local.py settings... Trying import local.py settings... Performing system checks... System check identified no issues (0 silenced). October 02, 2017 - 20:53:40 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/
安装和配置Taiga前端
在安装了Taiga并确认可以正常工作的情况下,我们可以继续安装Taiga前端模块。
切换到Taiga用户帐户
su - taiga
从Github克隆项目源代码
$git clone https://github.com/taigaio/taiga-front-dist.git Cloning into 'taiga-front-dist'... remote: Enumerating objects: 807, done. remote: Counting objects: 100% (807/807), done. remote: Compressing objects: 100% (686/686), done. remote: Total 8580 (delta 374), reused 526 (delta 101), pack-reused 7773 Receiving objects: 100% (8580/8580), 62.04 MiB | 7.13 MiB/s, done. Resolving deltas: 100% (3616/3616), done. $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://projects.hirebestengineers.com/api/v1/", "eventsUrl": "ws://projects.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"] }
我们应该用DNS名称替换" projects.hirebestengineers.com"。
安装Taiga活动
Taiga-events是Taiga网络套接字服务器,它允许taiga-front在积压,任务板,看板和问题列表中显示实时更改。 Taiga事件使用Rabbitmq作为消息代理。
$cd ~ $git clone https://github.com/taigaio/taiga-events.git taiga-events Cloning into 'taiga-events'... remote: Enumerating objects: 107, done. remote: Counting objects: 100% (107/107), done. remote: Compressing objects: 100% (72/72), done. remote: Total 245 (delta 38), reused 90 (delta 28), pack-reused 138 Receiving objects: 100% (245/245), 44.87 KiB | 553.00 KiB/s, done. Resolving deltas: 100% (113/113), done. $cd taiga-events
安装所需的JavaScript依赖项:
npm install
为Taiga活动创建配置文件。
cp config.example.json config.json
编辑配置文件,并设置rabbitmq URL和密钥:
$vim config.json { "url": "amqp://taiga:theitroad@localhost:5672/taiga", "secret": "OQOEJNSJIQHDBQNSUQEJSNNANsqQPAASQLSMSOQND", "webSocketServer": { "port": 8888 } }
密码inconfig.json必须与~/taiga-back/settings/local.py中的SECRET_KEY相同!
将taiga事件添加到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
重新加载Systemd并启动服务:
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: disabled) Active: active (running) since Fri 2017-10-02 23:01:00 CEST; 12s ago Main PID: 15170 (node) Tasks: 7 (limit: 24392) Memory: 38.6M CGroup: /system.slice/taiga_events.service └─15170 node node_modules/coffeescript/bin/coffee index.coffee Oct 02 23:01:00 projects.hirebestengineers.com systemd[1]: Started taiga_events.
启动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/.local/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: disabled) Active: active (running) since Fri 2017-10-02 23:03:48 CEST; 50s ago Main PID: 15494 (gunicorn) Tasks: 5 (limit: 24392) Memory: 298.5M CGroup: /system.slice/taiga.service ├─15494 /usr/bin/python3.6 /home/taiga/.local/bin/gunicorn --workers 4 --timeout 60 -b 127.0.0.1:8001 taiga.wsgi ├─15497 /usr/bin/python3.6 /home/taiga/.local/bin/gunicorn --workers 4 --timeout 60 -b 127.0.0.1:8001 taiga.wsgi ├─15498 /usr/bin/python3.6 /home/taiga/.local/bin/gunicorn --workers 4 --timeout 60 -b 127.0.0.1:8001 taiga.wsgi ├─15501 /usr/bin/python3.6 /home/taiga/.local/bin/gunicorn --workers 4 --timeout 60 -b 127.0.0.1:8001 taiga.wsgi └─15502 /usr/bin/python3.6 /home/taiga/.local/bin/gunicorn --workers 4 --timeout 60 -b 127.0.0.1:8001 taiga.wsgi Oct 02 23:03:49 projects.hirebestengineers.com gunicorn[15494]: [2017-10-02 23:03:49 +0200] [15494] [INFO] Listening at: http://127.0.0.1:8001 (15494) Oct 02 23:03:49 projects.hirebestengineers.com gunicorn[15494]: [2017-10-02 23:03:49 +0200] [15494] [INFO] Using worker: sync Oct 02 23:03:49 projects.hirebestengineers.com gunicorn[15494]: [2017-10-02 23:03:49 +0200] [15497] [INFO] Booting worker with pid: 15497 Oct 02 23:03:49 projects.hirebestengineers.com gunicorn[15494]: [2017-10-02 23:03:49 +0200] [15498] [INFO] Booting worker with pid: 15498 Oct 02 23:03:49 projects.hirebestengineers.com gunicorn[15494]: [2017-10-02 23:03:49 +0200] [15501] [INFO] Booting worker with pid: 15501 Oct 02 23:03:49 projects.hirebestengineers.com gunicorn[15494]: [2017-10-02 23:03:49 +0200] [15502] [INFO] Booting worker with pid: 15502 Oct 02 23:03:49 projects.hirebestengineers.com gunicorn[15494]: Trying import local.py settings... Oct 02 23:03:49 projects.hirebestengineers.com gunicorn[15494]: Trying import local.py settings... Oct 02 23:03:49 projects.hirebestengineers.com gunicorn[15494]: Trying import local.py settings... Oct 02 23:03:49 projects.hirebestengineers.com gunicorn[15494]: Trying import local.py settings...
步骤9:配置Nginx
NGINX用作静态文件Web服务器,以服务taiga-front-dist并将代理请求发送到taiga-back。首先删除默认的Nginx配置文件。
为Taiga创建NGINX虚拟主机:
sudo vim /etc/nginx/conf.d/taiga.conf
相应地修改配置文件。
server { listen 80; server_name projects.hirebestengineers.com www.projects.hirebestengineers.com; # 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
设置权限:
sudo chown -R taiga:taiga /home/taiga/ sudo chmod o+x /home/taiga/ sudo chmod o+rx ~taiga/taiga-back/media
如果一切正常,请启动nginx服务:
sudo systemctl daemon-reload sudo systemctl restart nginx taiga sudo systemctl enable nginx taiga
检查状态:
$systemctl status nginx ● nginx.service - The nginx HTTP and reverse proxy server Loaded: loaded (/usr/lib/systemd/system/nginx.service; enabled; vendor preset: disabled) Active: active (running) since Fri 2017-10-02 23:14:06 CEST; 5s ago Process: 16260 ExecStart=/usr/sbin/nginx (code=exited, status=0/SUCCESS) Process: 16257 ExecStartPre=/usr/sbin/nginx -t (code=exited, status=0/SUCCESS) Process: 16255 ExecStartPre=/usr/bin/rm -f /run/nginx.pid (code=exited, status=0/SUCCESS) Main PID: 16261 (nginx) Tasks: 3 (limit: 24392) Memory: 5.4M CGroup: /system.slice/nginx.service ├─16261 nginx: master process /usr/sbin/nginx ├─16262 nginx: worker process └─16263 nginx: worker process Oct 02 23:14:06 projects.hirebestengineers.com systemd[1]: Starting The nginx HTTP and reverse proxy server... Oct 02 23:14:06 projects.hirebestengineers.com nginx[16257]: nginx: the configuration file /etc/nginx/nginx.conf syntax is ok Oct 02 23:14:06 projects.hirebestengineers.com nginx[16257]: nginx: configuration file /etc/nginx/nginx.conf test is successful Oct 02 23:14:06 projects.hirebestengineers.com systemd[1]: Started The nginx HTTP and reverse proxy server.
0:访问Taiga Web登录信息中心
打开我们喜欢的Web浏览器,然后转到:
http://your_taiga_domain.com
我们应该在Taiga页面下方看到。
使用以下默认凭据登录:
Username: admin Password: 123123
然后在管理员>更改密码上更改管理员密码
1:使用SSL安全安装
请按照下面的指南使用SSL证书加强Taiga的安装。
让我们加密SSL的安全Taiga项目管理平台
如何禁用自我注册
要禁用自我用户注册,请编辑文件~/taiga-back/settings/local.py并将PUBLIC_REGISTER_ENABLED的值设置为false。
$su - taiga $vim ~/taiga-back/settings/local.py PUBLIC_REGISTER_ENABLED = False
更改Taiga前端的设置:
$vim ~/taiga-front-dist/dist/conf.json "publicRegisterEnabled": false
更新配置后,重新启动所有Taiga服务:
sudo systemctl restart 'taiga*'
重新加载nginx:
sudo systemctl reload nginx