Skip to content

Instantly share code, notes, and snippets.

@juslintek
Forked from sink66/setup-taiga-centos.sh
Last active September 22, 2016 14:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save juslintek/dc21a1eb3b300c6a02fe73ef2fb9a68f to your computer and use it in GitHub Desktop.
Save juslintek/dc21a1eb3b300c6a02fe73ef2fb9a68f to your computer and use it in GitHub Desktop.
Taiga.io minimum install & run commands / CentOS6.8 / Directadmin
#!/bin/bash
echo "Enter your domain:"
read domain
# How to use
# 1. Replace the "YOURIP" to yourIP
# 2. Run at the root -> source setup-taiga-centos.sh
yum install -y gcc autoconf flex bison libjpeg-turbo-devel
yum install -y freetype-devel zlib-devel zeromq-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++
#PostgreSQL 9.5
wget http://yum.postgresql.org/9.5/redhat/rhel-7-x86_64/pgdg-centos95-9.5-2.noarch.rpm
rpm -ivh pgdg-centos95-9.5-2.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
#Python 3.5.1
wget https://www.python.org/ftp/python/3.5.1/Python-3.5.1.tar.xz
tar xvf Python-3.5.1.tar.xz
cd Python-3.5.1/
./configure --prefix=/opt/python3.5
make
make install
export PATH=$PATH:/opt/python3.5/bin
#PostgreSQL initDB setting
cd /home
su postgres -c "createuser taiga"
su postgres -c "createdb taiga -O taiga"
#pip
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
#taiga add
adduser taiga
#taiga-back
cd /home/taiga
git clone https://github.com/taigaio/taiga-back.git taiga-back
cd taiga-back/
git checkout stable
#pip with blackmagic
sed -i -e '34s/^/#/ig' requirements.txt
sed -i -e '34a git+https://github.com/Xof/django-pglocks.git' requirements.txt
pip3.5 install -r requirements.txt
chown -R taiga:taiga /home/taiga/
sed -i -e '1a #!/opt/python3.5/bin/python3.5' -e '1d' manage.py
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 = "no-reply@example.com"
SERVER_EMAIL = DEFAULT_FROM_EMAIL
DATABASES = {
'default': {
'ENGINE': 'transaction_hooks.backends.postgresql_psycopg2',
'NAME': 'taiga',
'USER': 'taiga',
'PASSWORD': 'changeme',
'HOST': '',
'PORT': '',
}
}
EOF
#libzmq
cd /home/taiga/
git clone https://github.com/zeromq/libzmq.git libzmq
cd libzmq/
./autogen.sh
./configure --without-libsodium
make
make install
#circus systemd setting
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'
#taiga-front
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
#circus
cd /home/taiga
git clone https://github.com/circus-tent/circus.git 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
#circus start
cd /home/taiga/circus/
python3.5 setup.py install
ln -s /opt/python3.5/bin/circusd /usr/local/bin/circusd
systemctl start circus.service
#apache2
cat << 'EOF' >> /etc/httpd/conf/httpd.conf
Include conf/extra/taiga.conf
EOF
cat > /etc/httpd/conf/extra/taiga.conf << 'EOF'
<VirtualHost $domain:443>
ServerAdmin info@$domain
ServerName $domain
SSLEngine On
SSLCertificateChainFile /usr/local/directadmin/data/users/admin/domains/$domain.
SSLCACertificateFile /etc/ssl/certs/{CA certificate file}
SSLCertificateFile /etc/ssl/certs/{hostname certificate file}
SSLCertificateKeyFile /etc/ssl/private/{hostname certificate key file}
DocumentRoot /home/taiga/taiga-front-dist/dist/
Alias /static /home/taiga/taiga-back/static
Alias /media /home/taiga/taiga-back/media
<Directory /home/taiga/taiga-front-dist/dist/>
AllowOverride All
Require all granted
</Directory>
# If you have taiga directory under separate user
# use MPM ITK and run the VirtualHost under correct user/group permissions
<IfModule mpm_itk_module>
AssignUserId taiga_ws taiga_ws
</IfModule>
# For proxying you need modules "proxy", "proxy_http", "remoteip"
ProxyPreserveHost On
RemoteIPHeader X-Real-IP
RemoteIPInternalProxy 127.0.0.0/8 ::1
<Location /api>
ProxyPass http://127.0.0.1:8001/api
ProxyPassReverse http://127.0.0.1:8001/api
<IfModule mod_expires.c>
ExpiresActive On
ExpiresDefault "now"
</IfModule>
<IfModule mod_headers.c>
Header set Cache-Control "no-cache, must-revalidate" env=no-cache-headers
Header set Pragma "no-cache" env=no-cache-headers
Header set Expires "Sat, 1 Jan 2000 00:00:00 GMT" env=no-cache-headers
</IfModule>
</Location>
<Location /admin>
ProxyPass http://127.0.0.1:8001/admin
ProxyPassReverse http://127.0.0.1:8001/admin
ExpiresActive On
ExpiresDefault "now"
Header set Cache-Control "no-cache, must-revalidate" env=no-cache-headers
Header set Pragma "no-cache" env=no-cache-headers
Header set Expires "Sat, 1 Jan 2000 00:00:00 GMT" env=no-cache-headers
</Location>
# For "ws://" and "wss://" you need to have proxy_wstunnel module enabled
<Location /events>
ProxyPass ws://127.0.0.1:8888/events
</Location>
# Will redirect all requests non-static, non-media, non-api and non-events (websocket) to index.html
# You need mod_rewrite to be enabled
RewriteEngine on
RewriteCond %{REQUEST_URI} !^/admin(.*)
RewriteCond %{REQUEST_URI} !^/api(.*)
RewriteCond %{REQUEST_URI} !^/events(.*)
RewriteCond %{REQUEST_URI} !^/static(.*)
RewriteCond %{REQUEST_URI} !^/media(.*)
RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-f
RewriteRule . /index.html [L]
ErrorLog '|/usr/bin/rotatelogs /home/taiga/logs/taiga.apache.error.log 86400'
LogLevel warn
CustomLog '|/usr/bin/rotatelogs /home/taiga/logs/taiga.apache.access.log 86400' combined
</VirtualHost>
<VirtualHost *:80>
ServerName {hostname}
# Important to keep the last slash so the redirect passes relative URL correctly
RedirectPermanent / https://{hostname}/
</VirtualHost>
EOF
service nginx restart
chown -R taiga:taiga /home/taiga/
chmod o+x /home/taiga/
#run
su taiga -c "python3.5 /home/taiga/taiga-back/manage.py runserver 0.0.0.0:8000 &"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment