Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save jialvarez/0c12164fc7cc2576abce to your computer and use it in GitHub Desktop.
Save jialvarez/0c12164fc7cc2576abce 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
yum install setuptool system-config-network-tui vim libtool make autoconf automake htop wget curl gcc gcc-c++ -y
yum install libjpeg-turbo-devel openssl-devel bzip2-devel libcurl-devel freetype-devel libpng-devel gd-devel libtiff-devel -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=3.4.1
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': 'transaction_hooks.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.

Install Taiga events

Installing rabbitmq ...

wget https://www.rabbitmq.com/releases/erlang/erlang-18.1-1.el6.x86_64.rpm
yum install -y rabbitmq-server

...

service rabbitmq-server start

Creating a taiga user and virtualhost for rabbitmq ...

rabbitmqctl add_user taiga PASSWORD
rabbitmqctl add_vhost taiga
rabbitmqctl set_permissions -p taiga taiga ".*" ".*" ".*"

Update your taiga-back settings to include in your local.py the lines:

EVENTS_PUSH_BACKEND = "taiga.events.backends.rabbitmq.EventsPushBackend"
EVENTS_PUSH_BACKEND_OPTIONS = {"url": "amqp://taiga:PASSWORD@localhost:5672/taiga"}

...

su - taiga
cd /opt
git clone https://github.com/taigaio/taiga-events.git taiga-events
cd taiga-events

Install all the javascript dependencies needed

curl -sL https://rpm.nodesource.com/setup | bash -
yum install nodejs
npm -g install npm@latest
npm install
npm install -g coffee-script

Copy and edit the config.json file you should update your rabbitmq uri and the secret key.

    {
        "url": "amqp://taiga:PASSWORD@localhost:5672/taiga",
        "secret": "mysecret",
        "webSocketServer": {
            "port": 8888
        }
    }

Taiga taiga-events configuration block for circus on ~/circus.ini

[watcher:taiga-events]
working_dir = /home/taiga/taiga-events
cmd = /usr/lib/node_modules/coffee-script/bin/coffee
args = index.coffee
uid = taiga
numprocesses = 1
autostart = true
send_hup = true
stdout_stream.class = FileStream
stdout_stream.filename = /home/taiga/logs/taigaevents.stdout.log
stdout_stream.max_bytes = 10485760
stdout_stream.backup_count = 12
stderr_stream.class = FileStream
stderr_stream.filename = /home/taiga/logs/taigaevents.stderr.log
stderr_stream.max_bytes = 10485760
stderr_stream.backup_count = 12

...

circusctl reloadconfig
circusctl restart taiga
circusctl restart taiga-celery
circusctl start taiga-events

Add specific configuration for taiga-events on /etc/nginx/sites-available/taiga.

server {
    ...
    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;
    }
    ...
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment