Skip to content

Latest commit

 

History

History
366 lines (279 loc) · 8.39 KB

setup-development.adoc

File metadata and controls

366 lines (279 loc) · 8.39 KB

Setup development environment

1. Introduction

This documentation explains how to setup the Taiga development environment.

The Taiga platform consists of three main components:

  • taiga-back (backend/api)

  • taiga-front (frontend)

  • taiga-events (websockets gateway) (optional)

And each one has its own dependencies, at compile time and runtime.

2. Before starting

This tutorial assumes that you are using a clean, recently updated, ubuntu 14.04 image.

3. Backend environment

This section helps with the download an run of the backend (api) Taiga service.

3.1. Install dependencies

The Backend is written mainly in python (3.4) but for some third party libraries we need to install a C compiller and development headers.

sudo apt-get install -y build-essential binutils-doc autoconf flex bison libjpeg-dev
sudo apt-get install -y libfreetype6-dev zlib1g-dev libzmq3-dev libgdbm-dev libncurses5-dev
sudo apt-get install -y automake libtool libffi-dev curl git tmux

3.2. Setup a database

taiga-back also requires postgresql (>= 9.3) as a database

Install postgresql:

sudo apt-get install -y postgresql-9.3 postgresql-contrib-9.3
sudo apt-get install -y postgresql-doc-9.3 postgresql-server-dev-9.3

And setup the initial user and database:

sudo -u postgres createuser taiga
sudo -u postgres createdb taiga -O taiga

3.3. Setup python environment

For run taiga-back you should have python (3.4) installed with some other third party libraries. As a first step, start installing python and virtualenvwrapper:

sudo apt-get install -y python3 python3-pip python-dev python3-dev python-pip virtualenvwrapper
sudo apt-get install libxml2-dev libxslt-dev
Note
virtualenvwrapper helps maintain the system clean of third party libraries installed with language package manager, installing them in isolated virtual environment.

Restart the shell or run bash again, to reload the bash environment with virtualenvwrapper variables and functions.

The next step is to download the code from github and install their dependencies:

Download the code
cd ~
git clone https://github.com/taigaio/taiga-back.git taiga-back
cd taiga-back
git checkout stable
Create new virtualenv named taiga
mkvirtualenv -p /usr/bin/python3.4 taiga
Install dependencies
pip install -r requirements.txt
Populate the database with initial basic data
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
python manage.py sample_data

This creates a new user admin with password 123123 and some sample data.

You can tune your own environment configuration editing the settings/local.py configuration file to overwrite any setting in settings/common.py.

Put this on ~/taiga-back/settings/local.py
from .common import *

# YOUR OWN CONFIGURATION HERE

3.4. Run

To run the development environment you can run:

workon taiga  # enable the taiga virtualenv
python manage.py runserver

Then you must be able to see a json representing the list of endpoints in the url http://localhost:8000/api/v1/ .

3.5. Async tasks (Optional)

The default behavior in Taiga is to do all tasks in a synchronous way, but some of them can be completely asynchronous (for example webhooks or import/export). To do this, you have to configure and install the celery service requirements.

Install rabbitmq-server and redis-server:

sudo apt-get install -y rabbitmq-server redis-server

To run celery with taiga you have to include in your local.py the lines:

from .celery import *

BROKER_URL = 'amqp://guest:guest@localhost:5672//'
CELERY_RESULT_BACKEND = 'redis://localhost:6379/0'
CELERY_ENABLED = True

You can configure other broker or results backend. If you need more info about it you can check the celery documentation web page: http://docs.celeryproject.org/en/latest/index.html

Once you have configured celery on Taiga, you have to run celery to process the tasks. You can run celery with:

workon taiga  # enable the taiga virtualenv
celery -A taiga worker -l info -E

4. Frontend installation

This section helps you install the frontend application

4.1. Install dependencies

The Frontend application runs entirelly on a browser, and it should be written using javascript, css and html. In case of taiga-front we have used other languages. Because of this, you should install some additional dependencies that compile taiga-front code intro something the browser can understand.

4.1.1. Ruby and Gems

Ruby is used mainly for compiling sass (css preprocessor). It is also used for sass linting but that is only on development environments.

Install ruby
sudo apt-get install -y ruby
Install required gems
gem install --user-install sass scss-lint
Make gems scripts available in path putting this on ~/.bashrc
export PATH=~/.gem/ruby/1.9.1/bin:$PATH

Restart the shell or run bash to make the path changes available.

4.1.2. NodeJS and friends

NodeJS is used to execute gulp and bower:

  • gulp: task execution tool. Used mainly for executing deploying and compiling tasks.

  • bower: javascript dependencies management tool. Used mainly for downloading third party libraries used by taiga-front.

Install nodejs
sudo apt-get install -y nodejs npm
Make sure your bash responds to node command to have a smooth installation of gulp and bower
node

If you get a "Command not found" error, then run

sudo ln -s /usr/bin/nodejs /usr/bin/node
Install gulp and bower using recently installed npm
sudo npm install -g gulp bower
Download the code
cd ~
git clone https://github.com/taigaio/taiga-front.git taiga-front
cd taiga-front
git checkout stable
Install all dependencies needed for run gulp and compile taiga-front
npm install
bower install

4.2. Final steps

Having installed all dependencies you only have to run the code.

Run gulp
cd ~/taiga-front
gulp

Now, you can access to http://localhost:9001 port for access to taiga-front.

Note
If you have npm errors when executing gulp delete the tmp files and install the dependencies again.
rm -rf ~/.npm; rm -rf node_modules
npm install
bower install
gulp

5. Events installation

This step is completelly optional and can be skipped

Taiga events needs rabbitmq (the message broker) to be installed

Installing rabbitmq
sudo  apt-get install rabbitmq-server
Creating a taiga user and virtualhost for rabbitmq
sudo rabbitmqctl add_user taiga PASSWORD
sudo rabbitmqctl add_vhost taiga
sudo 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"}

The next step is downloading the code from github and installing their dependencies:

Download the code
cd ~
git clone https://github.com/taigaio/taiga-events.git taiga-events
cd taiga-events
Install all the javascript dependencies needed
npm install
sudo npm install -g coffee-script
Copy and edit the config.json file you should update your rabbitmq uri and the secret key.
cp config.example.json config.json
Your config.json should be like:
{
    "url": "amqp://taiga:PASSWORD@localhost:5672/taiga",
    "secret": "mysecret",
    "webSocketServer": {
        "port": 8888
    }
}
Now run the taiga events service
coffee index.coffee