Skip to content

Instantly share code, notes, and snippets.

@ss-abramchuk
Last active April 23, 2018 12:53
Show Gist options
  • Save ss-abramchuk/fd77fe4aa823d92c15e9 to your computer and use it in GitHub Desktop.
Save ss-abramchuk/fd77fe4aa823d92c15e9 to your computer and use it in GitHub Desktop.

#Installing Taiga on CentOS 6 (x64)

##Dependencies ...

yum update -y
yum groupinstall "Development Tools" -y
yum install libxslt-devel libxml2-devel libXt-devel curl git tmux -y

##Installing PostgreSQL ...

TAIGA_POSTGRES_BD = taiga
TAIGA_POSTGRES_USER = taiga
TAIGA_POSTGRES_PASSWORD=`< /dev/urandom tr -dc _A-Z-a-z-0-9 | head -c${1:-20};echo;`

...

rpm -ivh http://yum.postgresql.org/9.4/redhat/rhel-6-x86_64/pgdg-centos94-9.4-1.noarch.rpm
sed -i 's/^gpgkey.*/&\nexclude=postgresql*/' /etc/yum.repos.d/CentOS-Base.repo

yum -y install postgresql94 postgresql94-contrib postgresql94-server postgresql94-devel postgresql94-libs
service postgresql-9.4 initdb

...

sed -i "/^host/s/ident/md5/g" /var/lib/pgsql/9.4/data/pg_hba.conf

...

/sbin/chkconfig --level 35 postgresql-9.4 on
service postgresql-9.4 start

...

echo -e "$TAIGA_POSTGRES_PASSWORD\n$TAIGA_POSTGRES_PASSWORD\n" | su - postgres -c "createuser --pwprompt $TAIGA_POSTGRES_USER"
su - postgres -c "createdb $TAIGA_POSTGRES_BD -O $TAIGA_POSTGRES_USER"

##Installing Python ...

wget --directory-prefix=/tmp http://repo.continuum.io/miniconda/Miniconda3-3.7.0-Linux-x86_64.sh
bash /tmp/Miniconda3-3.7.0-Linux-x86_64.sh -b -p /usr/local/miniconda3

...

cat > /etc/profile.d/miniconda.sh << EOF
if [[ \$PATH != */usr/local/miniconda3/bin* ]]
then
    export PATH=/usr/local/miniconda3/bin:\$PATH
fi
EOF

...

source /etc/profile.d/miniconda.sh

##Installing Taiga Backend ...

TAIGA_SECRET_KEY=`< /dev/urandom tr -dc _A-Z-a-z-0-9 | head -c${1:-20};echo;`

adduser taiga

DIR="/var/log/taiga /opt/taiga-back /opt/taiga-events"
for NAME in $DIR
do
if [ ! -d $NAME ]; then
   mkdir $NAME
   chown taiga.taiga $NAME
fi
done

...

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

Create environment...

conda create --yes -n taiga python
source activate taiga
conda install --yes pip

Installing taiga.io requirements...

export PATH=$PATH:/usr/pgsql-9.4/bin/
pip install -r requirements.txt
exit

Configure backend...

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

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.postgresql_psycopg2',
        'NAME': '$TAIGA_POSTGRES_BD',
        'USER': '$TAIGA_POSTGRES_USER',
        'PASSWORD': '$TAIGA_POSTGRES_PASSWORD'
    }
}

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

SECRET_KEY = "$TAIGA_SECRET_KEY"

DEBUG = False
TEMPLATE_DEBUG = False

PUBLIC_REGISTER_ENABLED = True

DEFAULT_FROM_EMAIL = "no-reply@example.com"
SERVER_EMAIL = DEFAULT_FROM_EMAIL
EOF

...

chown taiga.taiga /opt/taiga-back/settings/local.py

Populate the database with initial data...

su - taiga
source activate taiga
cd /opt/taiga-back
python manage.py migrate --noinput
python manage.py loaddata initial_user
python manage.py loaddata initial_project_templates
python manage.py loaddata initial_role
python manage.py collectstatic --noinput
exit

This creates a new user "admin" with password "123123".

##Circus and gunicorn ...

conda install --yes pip
pip install circus

You can check environment path with this command:

su - taiga -c "conda info -e"

Output will be something like this:

# conda environments:
#
taiga                    /home/taiga/envs/taiga
root                  *  /usr/local/miniconda3

...

cat > /etc/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 = /opt/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 = /var/log/taiga/gunicorn.stdout.log
stdout_stream.max_bytes = 10485760
stdout_stream.backup_count = 4
stderr_stream.class = FileStream
stderr_stream.filename = /var/log/taiga/gunicorn.stderr.log
stderr_stream.max_bytes = 10485760
stderr_stream.backup_count = 4

[env:taiga]
PATH = \$PATH:/home/taiga/envs/taiga/bin
TERM=rxvt-256color
SHELL=/bin/bash
USER=taiga
LANG=en_US.UTF-8
HOME=/home/taiga
PYTHONPATH=/home/taiga/envs/taiga/lib/python3.4/site-packages
EOF

...

cat > /etc/init/circus.conf << EOF
start on runlevel [2345]
stop on runlevel [016]

respawn
exec /usr/local/miniconda3/bin/circusd /etc/circus.ini
EOF

Start the circus service.

initctl start circus

Backend installation complete.

@lshengjian
Copy link

very good!

@IvanJijon
Copy link

Excellent, thx!
I followed your gist to install Taiga.io in CentOS 6.7 (Final) and it was really helpful.
I forked your gist to https://gist.github.com/IvanJijon/936509aa35dd83101a9e. However, I did some modifications that can be useful.

@puvanavia
Copy link

Thanks, After django 1.9 the line

'ENGINE': 'transaction_hooks.backends.postgresql_psycopg2',

have to be

'ENGINE': 'django.db.backends.postgresql_psycopg2',

  • The django build-in the transaction_hooks after version 1.9

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment