当前位置: 首页 > 工具软件 > taiga-back > 使用案例 >

Centos7.6配置Taiga

西门嘉澍
2023-12-01

先决条件

sudo yum install -y epel-release

sudo yum update -y

sudo yum install -y firefox

sudo yum -y install nginx

安装PostgreSQL

sudo yum install -y https://download.postgresql.org/pub/repos/yum/reporpms/EL-7-x86_64/pgdg-redhat-repo-latest.noarch.rpm

sudo yum install -y postgresql95 postgresql95-devel postgresql95-contrib postgresql95-docs postgresql95-server

sudo /usr/pgsql-9.5/bin/postgresql95-setup initdb

systemctl start postgresql-9.5
systemctl enable postgresql-9.5

sudo su - postgres

createuser taiga
psql

ALTER USER taiga WITH ENCRYPTED password 'qweasdzxc';

CREATE DATABASE taiga OWNER taiga;

\q
exit

安装Python 3

sudo yum -y install gcc autoconf flex bison libjpeg-turbo-devel freetype-devel zlib-devel zeromq3-devel gdbm-devel ncurses-devel automake libtool libffi-devel curl git tmux libxml2-devel libxslt-devel openssl-devel gcc-c++

wget https://www.python.org/ftp/python/3.6.3/Python-3.6.3.tar.xz

tar xf Python-3.6.3.tar.xz

cd Python-3.6.3
./configure --enable-optimizations --prefix=/usr

sudo make altinstall

sudo pip3.6 install virtualenv virtualenvwrapper
sudo pip3.6 install --upgrade setuptools pip

安装Taiga后端

sudo useradd -s /bin/bash taiga
sudo su - taiga

mkdir -p ~/logs

git clone https://github.com/taigaio/taiga-back.git /usr/share/nginx/html/taiga/taiga-back

cd /usr/share/nginx/html/taiga/taiga-back
git checkout stable

echo "VIRTUALENVWRAPPER_PYTHON='/bin/python3.6'" >> ~/.bashrc
echo "source /usr/bin/virtualenvwrapper.sh" >> ~/.bashrc

source ~/.bashrc

mkvirtualenv -p /bin/python3.6 taiga
pip3.6 install --upgrade setuptools

cd /usr/share/nginx/html/taiga/taiga-back/
pip3.6 install -r requirements.txt

sudo chown -R taiga:taiga /usr/share/nginx/html/

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

nano /usr/share/nginx/html/taiga/taiga-back/settings/local.py

/usr/share/nginx/html/taiga/taiga-back/settings/local.py中填充如下内容

from .common import *

MEDIA_URL = "http://taiga.quaner.co/media/"
STATIC_URL = "http://taiga.quaner.co/static/"

SITES["front"]["scheme"] = "http"
SITES["front"]["domain"] = "taiga.quaner.co"

SECRET_KEY = "GMX4mE4uygyFtVMFRYbrjrh7q4JOe4U4EYMfuALh9BC487iEbe4Dgg5DGxk6GZdN"

DEBUG = False
PUBLIC_REGISTER_ENABLED = True

DEFAULT_FROM_EMAIL = "no-reply@taiga.quaner.co"
SERVER_EMAIL = DEFAULT_FROM_EMAIL

#CELERY_ENABLED = True

EVENTS_PUSH_BACKEND = "taiga.events.backends.rabbitmq.EventsPushBackend"
EVENTS_PUSH_BACKEND_OPTIONS = {"url":"amqp://taiga:qweasdzxc@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"

关闭虚拟环境

deactivate

安装前端

git clone https://github.com/taigaio/taiga-front-dist.git /usr/share/nginx/html/taiga/taiga-front-dist

cd /usr/share/nginx/html/taiga/taiga-front-dist
git checkout stable

sudo nano /usr/share/nginx/html/taiga/taiga-front-dist/dist/conf.json

​在/usr/share/nginx/html/taiga/taiga-front-dist/dist/conf.json中填充如下内容

{
    "api": "http://taiga.quaner.co/api/v1/",
    "eventsUrl": "ws://taiga.quaner.co/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
}

配置马戏团

exit

sudo pip3.6 install circus

sudo mkdir /etc/circus
sudo mkdir /etc/circus/conf.d
sudo mkdir /usr/share/nginx/html/taiga/logs
sudo touch /usr/share/nginx/html/taiga/logs/gunicorn.stdout.log
sudo touch /usr/share/nginx/html/taiga/logs/gunicorn.stderr.log

sudo nano /etc/circus/circus.ini

​在/etc/circus/circus.ini中填充如下内容

[circus]
check_delay = 5
endpoint = tcp://127.0.0.1:5555
pubsub_endpoint = tcp://127.0.0.1:5556
include = /etc/circus/conf.d/*.ini

sudo nano /etc/circus/conf.d/taiga.ini

​在/etc/circus/circus.ini中填充如下内容

[watcher:taiga]
working_dir = /usr/share/nginx/html/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 = /usr/share/nginx/html/taiga/logs/gunicorn.stdout.log
stdout_stream.max_bytes = 10485760
stdout_stream.backup_count = 4
stderr_stream.class = FileStream
stderr_stream.filename = /usr/share/nginx/html/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.6/site-packages
​
sudo nano /etc/systemd/system/circus.service

/etc/systemd/system/circus.service中填充如下内容

[Unit]
Description=Circus process manager
After=syslog.target network.target nss-lookup.target

[Service]
Type=simple
ExecReload=/usr/bin/circusctl reload
ExecStart=/usr/bin/circusd /etc/circus/circus.ini
Restart=always
RestartSec=5

[Install]
WantedBy=default.target

赋予权限

# sudo chmod -R 777 /home/taiga/

sudo systemctl start circus
sudo systemctl enable circus

circusctl status

将Nginx安装为反向代理

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

/etc/nginx/conf.d/taiga.conf中填充如下内容

server { 
    listen 80;
    server_name taiga.quaner.co;
    
    large_client_header_buffers 4 32k;
    client_max_body_size 50M;
    charset utf-8;
   
    # Frontend
    location / {
        root /usr/share/nginx/html/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 /usr/share/nginx/html/taiga/taiga-back/static;
    }
    
    # Media files
    location /media {
        alias /usr/share/nginx/html/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

sudo systemctl restart nginx
sudo systemctl status nginx

sudo chown -R taiga:taiga /usr/share/nginx/html/
sudo chmod o+x /usr/share/nginx/html/


sudo systemctl stop firewalld.service
sudo systemctl disable firewalld.service

错误记录

  1. 允许HTTPPD脚本和模块使用TCP连接到网络
sudo setsebool -P httpd_can_network_connect 1
  1. 上面一个错误主要出现的原因是selinux的开启,所以如果出现take me home的情况,请将selinux进行关闭。防火墙也记得要关闭,这也是可能导致taiga无法访问的原因之一。(关于这一点因为能力不足,所以没有办法进行深入的解释,等深入以后希望能有更好的解释)

  2. 如果出现Nginx的Welcome To Nginx页面可以访问,但是本身页面无法访问的情况,我的解决办法是将taiga的配置文件放入/usr/share/nginx/html/的下面。因为既然Nginx的主页可以访问,就说明/usr/share/nginx/html/的下面是可以被Nginx访问到的,所以在git克隆taiga-back和taiga-front-dist的时候选择了放入/usr/share/nginx/html/下面。

 类似资料: