[PYTHON] I installed Taiga.IO on CentOS7 (I made a script while I was there)

What is Taiga.IO?

Agile project management tools Compatible with Kanban and Scrum Simple and beautiful UI https://taiga.io/ http://qiita.com/kgmyshin/items/2ac2ad7e6be8425ec60e

youtube tutorial https://www.youtube.com/playlist?list=PLgsasMWN5JssgHHHHI50xkz_kzXg-dElt

reference

--Official http://taigaio.github.io/taiga-doc/dist/setup-production.html

--CentOS6, pioneer of Fedora 21+ https://gist.github.com/ss-abramchuk/fd77fe4aa823d92c15e9 https://gist.github.com/ssplatt/42393b7d9c876a027aaa

Installed

Really minimal movement

script

https://gist.github.com/skliber/50e7f389407d3de25b0f There are many black magics, but I was able to do it for the time being

How to use

  1. Replace the string YOURIP in the script with your own IP sed -i -e 's/YOURIP/192.168.x.x/g' setup-taiga-centos.sh

  2. Become root and execute with source command source setup-taiga-centos.sh

Commentary

  1. yum Put all the things you need together Add epel repository to include libzmq
yum install -y epel-release

yum install -y gcc autoconf flex bison libjpeg-turbo-devel
yum install -y freetype-devel zlib-devel zeromq3-devel gdbm-devel ncurses-devel
yum install -y automake libtool libffi-devel curl git tmux
yum install -y libxml2-devel libxslt-devel
yum install -y wget openssl-devel gcc-c++
  1. PostgreSQL 9.5 After installing PostgreSQL 9.5, make the initial settings of db and start it.
wget http://yum.postgresql.org/9.5/redhat/rhel-7-x86_64/pgdg-centos95-9.5-3.noarch.rpm
rpm -ivh pgdg-centos95-9.5-3.noarch.rpm
yum install -y postgresql95-server postgresql95-devel postgresql95-contrib
export PATH=$PATH:/usr/pgsql-9.5/bin
postgresql95-setup initdb
systemctl start postgresql-9.5.service
  1. Python 3.5.2 Taiga.IO requires Python 3.4 or higher, but it's not in the CentOS repository, so install the latest version from source This time I set the installation destination to / opt / python3.5
wget https://www.python.org/ftp/python/3.5.2/Python-3.5.2.tar.xz
tar xvf Python-3.5.2.tar.xz
cd Python-3.5.2/
./configure --prefix=/opt/python3.5
make
make install
export PATH=$PATH:/opt/python3.5/bin

4. DB settings for PostgreSQL Taiga.IO

Go to a place where user postgres can execute commands with black magic cd / home, Create a database with users

cd /home su postgres -c "createuser taiga" su postgres -c "createdb taiga -O taiga"

5. Install virtualenv and virtualenvwrapper

These seem to create and manage Python's unique environment http://qiita.com/caad1229/items/325ca5c8ad198b0ebce7 http://qiita.com/_rdtr/items/5f3a9a9e2cb5a24f284e

If the mkvirtualenv command is successful, it will automatically enter the unique environment. I'll be in trouble later, so deactivate it ~~ What? What does it mean to create an environment? ~~ I can't hear you

pip3.5 install virtualenv virtualenvwrapper
VIRTUALENVWRAPPER_PYTHON=/opt/python3.5/bin/python3.5
source /opt/python3.5/bin/virtualenvwrapper.sh
mkvirtualenv -p /opt/python3.5/bin/python3.5 taiga
deactivate
  1. taiga-back Add user taiga first The main Taiga.IO directories are expanded under / home / taiga /

check out the stable version of taiga-back

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

6.1. requirements.txt taiga-back requirements.txt has a tagged git address, Apparently this tag doesn't exist on github right now and trying to install it just fails So, add the address that succeeds with the sed command and then install

sed -i -e '34a git+https://github.com/Xof/django-pglocks.git' requirements.txt

pip3.5 install -r requirements.txt

6.2. Correct the owner + minor code correction

Since the / home / taiga / taiga-back / directory is created at the root, Fix the owner under the home directory manage.py needs to be run by user taiga, so you can't operate it without fixing it

Also, CentOS7 has Python2 installed by default, If you start manage.py as it is, it will start with Python 2 and it is inconvenient Modify the sed command to use Python 3.5

chown -R taiga:taiga /home/taiga/

sed -i -e '1a #!/opt/python3.5/bin/python3.5' -e '1d' manage.py

7. Initial setting of taiga-back

If you set the YOURIP part to "localhost" or "127.0.0.1", Please note that you can only access it from yourself It seems good to set a domain name, global IP or private IP See also: https://github.com/taigaio/taiga-scripts/issues/10

su taiga -c "python3.5 manage.py migrate --noinput"
su taiga -c "python3.5 manage.py loaddata initial_user"
su taiga -c "python3.5 manage.py loaddata initial_project_templates"
su taiga -c "python3.5 manage.py loaddata initial_role"
su taiga -c "python3.5 manage.py compilemessages"
su taiga -c "python3.5 manage.py collectstatic --noinput"

cat > /home/taiga/taiga-back/settings/local.py << EOF
from .development import *
from .common import *

MEDIA_URL = "http://YOURIP/media/"
STATIC_URL = "http://YOURIP/static/"
ADMIN_MEDIA_PREFIX = "http://YOURIP/static/admin/"
SITES["front"]["scheme"] = "http"
SITES["front"]["domain"] = "YOURIP"

SECRET_KEY = "theveryultratopsecretkey"

DEBUG = False
TEMPLATE_DEBUG = False
PUBLIC_REGISTER_ENABLED = True

DEFAULT_FROM_EMAIL = "[email protected]"
SERVER_EMAIL = DEFAULT_FROM_EMAIL
EOF
  1. taiga-front Need to make json for configuration Set your own IP in conf.example.json and copy as it is
cd /home/taiga
git clone https://github.com/taigaio/taiga-front-dist.git taiga-front-dist
cd taiga-front-dist/
git checkout stable
cd dist/
sed -e 's/localhost/YOURIP/' conf.example.json > conf.json
  1. Circus Install Circus with pip
cd /home/taiga
pip3.5 install circus

mkdir -p /home/taiga/conf
cat > /home/taiga/conf/circus.ini << EOF
[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
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/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.5/site-packages
EOF

mkdir -p /home/taiga/logs
touch /home/taiga/logs/gunicorn.stdout.log
touch /home/taiga/logs/gunicorn.stderr.log

10. Create a Circus config file for Systemd

Circus doesn't create a config file for Systemd I can't help it, so I make it myself

cat > /usr/lib/systemd/system/circus.service << EOF
[Unit]
Description=circus

[Service]
ExecStart=/usr/local/bin/circusd /home/taiga/conf/circus.ini
EOF
ln -s '/usr/lib/systemd/system/circus.service' '/etc/systemd/system/circus.service'

11. Start Circus

Start based on the configuration file created earlier

ln -s /root/.virtualenvs/taiga/bin/circusd /usr/local/bin/circusd
systemctl start circus.service
  1. nginx Add repositories to include new ones Make settings for Taiga.IO and start
cat > /etc/yum.repos.d/nginx.repo << 'EOF'
[nginx]
name=nginx repo
baseurl=http://nginx.org/packages/centos/$releasever/$basearch/
gpgcheck=0
enabled=1
EOF
yum install -y nginx

cat > /etc/nginx/conf.d/taiga.conf << 'EOF'
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 http://YOURIP: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://YOURIP: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;
    }
}
EOF
systemctl restart nginx

13. Black magic

I don't know how many times black magic Fix the owner of / home / taiga / and give Other execute permission Nginx returns a Permission denied 500 error without execute permission

chown -R taiga:taiga /home/taiga/ chmod o+x /home/taiga/

14. Launch the Taiga.IO backend

Start in the background of user taiga It seems that it can only be accessed from the development machine without 0.0.0.0:8000 http://masasuzu.hatenablog.jp/entry/20100731/1280588504

su taiga -c "python3.5 /home/taiga/taiga-back/manage.py runserver 0.0.0.0:8000 &"

end. Access with a browser

If the last command succeeds, it should start listening on port 8000 Since nginx is waiting on port 80, you can use it if you access your IP as it is Initial user name: admin Password: 123123

Digression: Why CentOS, Ubuntu didn't work?

Actually, if you hit the script prepared by the official on Ubuntu, you can use it immediately But I've lived with CentOS for a long time, so I didn't feel like using Ubuntu. I got stuck for about 3 days and started to frustrate, but I managed to get it, so I'm okay

Recommended Posts

I installed Taiga.IO on CentOS7 (I made a script while I was there)
I made a CUI-based translation script (2)
[Linux] I installed CentOS on VirtualBox
I made a CUI-based translation script
I installed Kivy on a Mac environment
I made a script to display emoji
〇✕ I made a game
I made a script to put a snippet in README.md
I made a Python3 environment on Ubuntu with direnv.
I installed Ubuntu on a USB stick on a dual boot PC
I installed the automatic machine learning library auto-sklearn on centos7
I made a VGG16 model using TensorFlow (on the way)
I made a neural network generator that runs on FPGA
I made a script to say hello at my Koshien
I installed tensorRT on Ubuntu 18.04
I installed ROS on Ubuntu 18.04
I made a python text
I made a discord bot
I was a little addicted to installing Python3.3 + mod_wsgi3.4 on Sakura VPS (CentOS), so a retrospective memo
A note I was addicted to when making a beep on Linux
I just wrote a script to build Android on another machine
I made a C ++ learning site
I made a Line-bot using Python!
I made a wikipedia gacha bot
I made a fortune with Python.
Create a python environment on centos
Build a python3 environment on CentOS7
I made a daemon with Python
I installed Linux on my Mac
A story I was addicted to trying to install LightFM on Amazon Linux
I made a kitchen timer to be displayed on the status bar!
I made a Chrome extension that displays a graph on an AMeDAS page
I made a script in python to convert .md files to Scrapbox format
I made a webAPI! Build environment from Django Rest Framework 1 on EC2
While studying pandas, I did a free study on when corona would end and whether lockdown was meaningful.
[Python] I made a script that automatically cuts and pastes files on a local PC to an external SSD.