Wednesday, November 20, 2024
Google search engine
HomeGuest BlogsInstall Taiga Project Management Platform on Ubuntu 20.04

Install Taiga Project Management Platform on Ubuntu 20.04

.tdi_3.td-a-rec{text-align:center}.tdi_3 .td-element-style{z-index:-1}.tdi_3.td-a-rec-img{text-align:left}.tdi_3.td-a-rec-img img{margin:0 auto 0 0}@media(max-width:767px){.tdi_3.td-a-rec-img{text-align:center}}

In today’s article we will cover all the steps required to setup a working Taiga project management platform on Ubuntu 20.04. Taiga is an open source Project management web application with scrum designed for both small and large teams.

Taiga.io is built on top of Python, Django, AngularJS and CoffeeScript. This project management tool gives you an easy and efficient way to manage projects, improve collaboration, time tracking, bug tracking, Kanban board, wiki, reporting, backlogs and many more.

Taiga platform is composed of three main modules, and each one has its own dependencies both at compile time and runtime:

.tdi_2.td-a-rec{text-align:center}.tdi_2 .td-element-style{z-index:-1}.tdi_2.td-a-rec-img{text-align:left}.tdi_2.td-a-rec-img img{margin:0 auto 0 0}@media(max-width:767px){.tdi_2.td-a-rec-img{text-align:center}}

  • taiga-back – This is the backend/API module
  • taiga-front-dist – The frontend module which gives users a portal.
  • taiga-events – Websockets gateway. This is optional, you can install or skip.

This tutorial assumes that you’re working on a newly installed Ubuntu 20.04 server. Ensure all software packages are updated to the latest releases.

sudo apt update
sudo apt upgrade -y

Reboot the system before you proceed with the next installation steps.

sudo reboot

Step 1: Setup server hostname and DNS

Let’s start by setting up correct server hostname:

sudo hostnamectl set-hostname taiga.hirebestengineers.com --static

Confirm hostname settings.

$ hostnamectl
   Static hostname: taiga.hirebestengineers.com
         Icon name: computer-vm
           Chassis: vm
        Machine ID: be43a41780154ad0b9148af9afe95a4e
           Boot ID: 94c4e0892cf54c6baea75be6ff7387ba
    Virtualization: kvm
  Operating System: Ubuntu 20.04.1 LTS
            Kernel: Linux 5.4.0-48-generic
      Architecture: x86-64

Add a correct IP address and FQDN to the hosts file in /etc directory.

$ sudo vim /etc/hosts
135.181.102.168 taiga.hirebestengineers.com

Verify:

$ host taiga.hirebestengineers.com
taiga.hirebestengineers.com has address 135.181.102.168

Also add an A record in your DNS server.

install taiga ubuntu 01

Confirm if the record can be queried from your local machine.

$ dig A  taiga.hirebestengineers.com +short
135.181.102.168

Step 2: Install dependency packages

The next step is to install all the dependency packages that will be needed to run Taiga project management platform.

Install git, Python3 and other packages:

sudo apt update
sudo apt -y install git pwgen automake wget curl gettext build-essential libgdbm-dev  binutils-doc autoconf flex gunicorn bison libjpeg-dev libzmq3-dev libfreetype6-dev zlib1g-dev libncurses5-dev libtool libxslt-dev libxml2-dev libffi-dev python3 virtualenvwrapper python3-dev python3-pip python3-dev libssl-dev tmux

Install Nginx web server:

sudo apt -y install nginx

Install Redis and RabbitMQ:

sudo apt -y install rabbitmq-server redis-server

Once RabbitMQ server is installed, create a user and vhost for Taiga:

$ sudo rabbitmqctl add_user taiga StrongPassword
Adding user "taiga" ...

$ sudo rabbitmqctl add_vhost taiga
Adding vhost "taiga" ...

$ sudo rabbitmqctl set_permissions -p taiga taiga ".*" ".*" ".*"
Setting permissions for user "taiga" in vhost "taiga" ...

Install Node.js

curl -sL https://deb.nodesource.com/setup_12.x | sudo -E bash -
sudo apt -y install nodejs

Step 3: Install and Configure PostgreSQL

Taiga.io requires  PostgreSQL database server. Install and configure it like below:

Import  the repository signing key:

wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -

Add PostgreSQL apt repository:

echo "deb http://apt.postgresql.org/pub/repos/apt/ focal-pgdg main" | sudo tee /etc/apt/sources.list.d/pgdg.list

Update the package lists and install postgresql package

sudo apt update
sudo apt install postgresql -y

Set PostgreSQL admin user’s password using:

$ sudo passwd postgres
Enter new UNIX password: 
Retype new UNIX password: 
passwd: password updated successfully

Create a database and user for Taiga.io

$ sudo su - postgres
postgres@taiga:~$ createuser taiga 
postgres@taiga:~$ psql 
psql (12.4 (Ubuntu 12.4-1.pgdg20.04+1))
Type "help" for help.

postgres=# ALTER USER taiga WITH ENCRYPTED password 'StrongPassword';
postgres=# CREATE DATABASE taiga OWNER taiga;
postgres=# \q
postgres@taiga:~$ exit

Replace:

  • taiga with your Database username for Taiga.io
  • StrongPassword with strong database password for taiga user.

Step 4: Install and configure Taiga Backend

Create taiga user:

$ sudo adduser taiga
Adding user `taiga' ...
Adding new group `taiga' (1000) ...
Adding new user `taiga' (1000) with group `taiga' ...
Creating home directory `/home/taiga' ...
Copying files from `/etc/skel' ...
New password:
Retype new password:
passwd: password updated successfully
Changing the user information for taiga
Enter the new value, or press ENTER for the default
	Full Name []:
	Room Number []:
	Work Phone []:
	Home Phone []:
	Other []:
Is the information correct? [Y/n] y

$ sudo adduser taiga sudo
Adding user `taiga' to group `sudo' ...
Adding user taiga to group sudo
Done.

Switch to Taiga user account and create logs folder

$ su - taiga
$ mkdir -p ~/logs
$ ls
logs

Clone Taiga Backend Project from Github

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

Create Virtualenv

Then Create a Virtualenv for Taiga.io Backend and install required dependencies

mkvirtualenv -p /usr/bin/python3 taiga_venv
pip3 install -r requirements.txt

If you get an error message “mkvirtualenv: command not found” see below guide for a fix:

Populate the database with initial basic data

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

Data will be imported to your PostgreSQL database on running above commands. This also creates the administrator account whose login credentials are admin with a password 123123

If you need sample data, you can load it with python3 manage.py sample_data. This is for DEMO PURPOSES ONLY, it may be hard to clean up the data later.

Create Config

Copy  the following config into ~/taiga-back/settings/local.py:

vim ~/taiga-back/settings/local.py

Copy and update the contents below:

from .common import *

MEDIA_URL = "http://taiga.hirebestengineers.com/media/"
STATIC_URL = "http://taiga.hirebestengineers.com/static/"
SITES["front"]["scheme"] = "http"
SITES["front"]["domain"] = "taiga.hirebestengineers.com"

SECRET_KEY = "OQOEJNSJIQHDBQNSUQEJSNNANsqQPAASQLSMSOQND"

DEBUG = False
PUBLIC_REGISTER_ENABLED = True

DEFAULT_FROM_EMAIL = "[email protected]"
SERVER_EMAIL = DEFAULT_FROM_EMAIL

#CELERY_ENABLED = True

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

Change the settings to fit your environment, set:

  • RabbitMQ connection username and password
  • Taiga domain name
  • Secret key and
  • Optional email settings.

configuration validation

To make sure that everything works, issue the following command to run the backend in development mode for a test:

workon taiga_venv
python manage.py runserver

Sample successful output:

Trying import local.py settings...
Trying import local.py settings...
Performing system checks...

System check identified no issues (0 silenced).
September 30, 2020 - 20:29:24
Django version 2.2.16, using settings 'settings'
Starting development server at http://127.0.0.1:8000/
Quit the server with CONTROL-C.

Open a different SHELL and try curl:

curl http://127.0.0.1:8000/api/v1/

Disable your Virtualenv to begin Front end installation.

$ deactivate

Step 5: Install and configure Taiga Frontend

The taiga-front is written mostly in angularjs and CoffeeScript and depends on the backend. You need to have Taiga backend configured before doing these section configurations.

Switch to a taigauser account

su - taiga

Clone the Project source code from Github

git clone https://github.com/taigaio/taiga-front-dist.git
cd taiga-front-dist
git checkout stable

Copy the example config file:

cp ~/taiga-front-dist/dist/conf.example.json ~/taiga-front-dist/dist/conf.json
vim ~/taiga-front-dist/dist/conf.json

Edit the example configuration following the pattern below (replace with your own details):

{
    "api": "http://taiga.hirebestengineers.com/api/v1/",
    "eventsUrl": "ws://taiga.hirebestengineers.com/events",
    "eventsMaxMissedHeartbeats": 5,
    "eventsHeartbeatIntervalTime": 60000,
    "eventsReconnectTryInterval": 10000,
    "debug": true,
    "debugInfo": false,
    "defaultLanguage": "en",
    "themes": ["taiga"],
    "defaultTheme": "taiga",
    "publicRegisterEnabled": true,
    "feedbackEnabled": true,
    "supportUrl": "https://tree.taiga.io/support",
    "privacyPolicyUrl": null,
    "termsOfServiceUrl": null,
    "GDPRUrl": null,
    "maxUploadFileSize": null,
    "contribPlugins": [],
    "tribeHost": null,
    "importers": [],
    "gravatar": true,
    "rtlLanguages": ["fa"]
}

You should substitute taiga.hirebestengineers.com with your DNS name.

Step 6: Install Taiga Events

Taiga-events is the Taiga websocket server which allows taiga-front to show real-time changes in the backlog, taskboard, kanban, and issues listing. Taiga-events use rabbitmq as a  message broker.

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

Install the required JavaScript dependencies:

npm install

Create a configuration file for Taiga Events.

cp config.example.json config.json

Edit the configuration file and set rabbitmq URL and the Secret key:

$ vim config.json

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

The secret value in config.json must be the same as the SECRET_KEY in ~/taiga-back/settings/local.py!

Add taiga-events to systemd configuration:

sudo tee /etc/systemd/system/taiga_events.service<<EOF
[Unit]
Description=taiga_events
After=network.target

[Service]
User=taiga
WorkingDirectory=/home/taiga/taiga-events
ExecStart=/bin/bash -c "node_modules/coffeescript/bin/coffee index.coffee"
Restart=always
RestartSec=3

[Install]
WantedBy=default.target
EOF

Reload Systemd and start the service:

sudo systemctl daemon-reload
sudo systemctl start taiga_events
sudo systemctl enable taiga_events

Check if the service is in running state:

$ systemctl status taiga_events.service
● taiga_events.service - taiga_events
     Loaded: loaded (/etc/systemd/system/taiga_events.service; enabled; vendor preset: enabled)
     Active: active (running) since Wed 2020-09-30 22:51:07 CEST; 3min 17s ago
   Main PID: 18269 (node)
      Tasks: 7 (limit: 4567)
     Memory: 18.8M
     CGroup: /system.slice/taiga_events.service
             └─18269 node node_modules/coffeescript/bin/coffee index.coffee

Step 7: Start Taiga Service

Create a new taiga systemd file:

sudo tee /etc/systemd/system/taiga.service<<EOF
[Unit]
Description=taiga_back
After=network.target

[Service]
User=taiga
Environment=PYTHONUNBUFFERED=true
WorkingDirectory=/home/taiga/taiga-back
ExecStart=/home/taiga/.virtualenvs/taiga_venv/bin/gunicorn --workers 4 --timeout 60 -b 127.0.0.1:8001 taiga.wsgi
Restart=always
RestartSec=3

[Install]
WantedBy=default.target
EOF

Reload the systemd daemon and start the taiga service:

sudo systemctl daemon-reload
sudo systemctl start taiga
sudo systemctl enable taiga

Execute the following command to check if service is running.

$ systemctl status taiga
● taiga.service - taiga_back
     Loaded: loaded (/etc/systemd/system/taiga.service; enabled; vendor preset: enabled)
     Active: active (running) since Wed 2020-09-30 22:58:28 CEST; 7s ago
   Main PID: 19087 (gunicorn)
      Tasks: 5 (limit: 4567)
     Memory: 266.1M
     CGroup: /system.slice/taiga.service
             ├─19087 /home/taiga/.virtualenvs/taiga_venv/bin/python /home/taiga/.virtualenvs/taiga_venv/bin/gunicorn --workers 4 --timeout 60 -b 127.0.0.1:8001 t>
             ├─19109 /home/taiga/.virtualenvs/taiga_venv/bin/python /home/taiga/.virtualenvs/taiga_venv/bin/gunicorn --workers 4 --timeout 60 -b 127.0.0.1:8001 t>
             ├─19110 /home/taiga/.virtualenvs/taiga_venv/bin/python /home/taiga/.virtualenvs/taiga_venv/bin/gunicorn --workers 4 --timeout 60 -b 127.0.0.1:8001 t>
             ├─19111 /home/taiga/.virtualenvs/taiga_venv/bin/python /home/taiga/.virtualenvs/taiga_venv/bin/gunicorn --workers 4 --timeout 60 -b 127.0.0.1:8001 t>
             └─19112 /home/taiga/.virtualenvs/taiga_venv/bin/python /home/taiga/.virtualenvs/taiga_venv/bin/gunicorn --workers 4 --timeout 60 -b 127.0.0.1:8001 t>

Sep 30 22:58:28 taiga.hirebestengineers.com gunicorn[19087]: /usr/lib/python3.8/os.py:1023: RuntimeWarning: line buffering (buffering=1) isn't supported in binar>
Sep 30 22:58:28 taiga.hirebestengineers.com gunicorn[19087]:   return io.open(fd, *args, **kwargs)
Sep 30 22:58:28 taiga.hirebestengineers.com gunicorn[19109]: [2020-09-30 22:58:28 +0200] [19109] [INFO] Booting worker with pid: 19109
Sep 30 22:58:28 taiga.hirebestengineers.com gunicorn[19110]: [2020-09-30 22:58:28 +0200] [19110] [INFO] Booting worker with pid: 19110
Sep 30 22:58:28 taiga.hirebestengineers.com gunicorn[19109]: Trying import local.py settings...
Sep 30 22:58:28 taiga.hirebestengineers.com gunicorn[19110]: Trying import local.py settings...
Sep 30 22:58:28 taiga.hirebestengineers.com gunicorn[19111]: [2020-09-30 22:58:28 +0200] [19111] [INFO] Booting worker with pid: 19111
Sep 30 22:58:28 taiga.hirebestengineers.com gunicorn[19112]: [2020-09-30 22:58:28 +0200] [19112] [INFO] Booting worker with pid: 19112
Sep 30 22:58:28 taiga.hirebestengineers.com gunicorn[19111]: Trying import local.py settings...
Sep 30 22:58:29 taiga.hirebestengineers.com gunicorn[19112]: Trying import local.py settings...

Step 8: Configure Nginx as proxy for Taiga

Both taiga-front-dist and taiga-back must be exposed to the outside using a proxy/static-file web server. For this purpose, Taiga uses NGINX.

NGINX is used as a static file web server to serve taiga-front-dist and send proxy requests to taiga-back. Start by removing the default Nginx configuration file.

sudo rm /etc/nginx/sites-enabled/default

Create NGINX Virtualhost for Taiga:

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

Modify the configuration file accordingly.

server {
    listen 80 default_server;
    server_name _;  #  See http://nginx.org/en/docs/http/server_names.html

    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://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 /home/taiga/taiga-back/static;
    }

    # Media files
    location /media {
        alias /home/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;
    }
}

Verify Nginx configuration:

$ sudo nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful

If all seems okay restart nginx service:

sudo systemctl restart nginx

Check status:

$ systemctl status nginx
● nginx.service - A high performance web server and a reverse proxy server
     Loaded: loaded (/lib/systemd/system/nginx.service; enabled; vendor preset: enabled)
     Active: active (running) since Wed 2020-09-30 23:21:51 CEST; 27s ago
       Docs: man:nginx(8)
    Process: 20262 ExecStartPre=/usr/sbin/nginx -t -q -g daemon on; master_process on; (code=exited, status=0/SUCCESS)
    Process: 20276 ExecStart=/usr/sbin/nginx -g daemon on; master_process on; (code=exited, status=0/SUCCESS)
   Main PID: 20277 (nginx)
      Tasks: 3 (limit: 4567)
     Memory: 3.5M
     CGroup: /system.slice/nginx.service
             ├─20277 nginx: master process /usr/sbin/nginx -g daemon on; master_process on;
             ├─20278 nginx: worker process
             └─20279 nginx: worker process

Sep 30 23:21:51 taiga.hirebestengineers.com systemd[1]: Starting A high performance web server and a reverse proxy server...
Sep 30 23:21:51 taiga.hirebestengineers.com systemd[1]: Started A high performance web server and a reverse proxy server.

Step 9: Access Taiga Web Login Dashboard

Open your favorite web browser and go:

http://your_taiga_domain.com

You should get login screen.

install taiga ubuntu 18.04 login min

Login with below default credentials:

Username: admin
Password: 123123

Then change Admin Password on Administrator > Change Password

install taiga ubuntu 18.04 change password min

Step 10: Secure installation with SSL

Follow our guide below to harden Taiga installation with an SSL certificate.

How To Disable Self Signup

To prevent users from registering, edit the file ~/taiga-back/settings/local.py and set value of PUBLIC_REGISTER_ENABLED to false.

$ su - taiga
$ vim ~/taiga-back/settings/local.py
PUBLIC_REGISTER_ENABLED = False

Change setting for Taiga frontend:

$ vim ~/taiga-front-dist/dist/conf.json
"publicRegisterEnabled": false

Restart all Taiga services after updating the configuration:

sudo systemctl restart 'taiga*'

Reload nginx:

sudo systemctl reload nginx

Before:

install taiga ubuntu 02

After:

install taiga ubuntu 03

Enjoy the cool features that comes with Taiga project management platform.

Related guides:

.tdi_4.td-a-rec{text-align:center}.tdi_4 .td-element-style{z-index:-1}.tdi_4.td-a-rec-img{text-align:left}.tdi_4.td-a-rec-img img{margin:0 auto 0 0}@media(max-width:767px){.tdi_4.td-a-rec-img{text-align:center}}

RELATED ARTICLES

Most Popular

Recent Comments