Skip to content

Setting up a development environment

CERT Société Générale edited this page Mar 21, 2017 · 7 revisions

Before you start: The development environment is great for testing FIR or using it occasionally or daily with very small teams. If you want to use FIR in a production environment where performance is a must, we recommend you follow the instructions in Installation on a production environment


If you want to contribute or work on FIR to tailor it to your needs, follow these instructions to set-up a dev environment. Feel free to submit any pull requests you think might have their place in the main FIR repo.

Installation

Install dependencies:

$ sudo apt-get update
$ sudo apt-get install python-dev python-pip python-lxml git libxml2-dev libxslt1-dev libz-dev
$ sudo pip install virtualenv

Create a Python virtual environment and activate it:

$ virtualenv env-FIR
$ source env-FIR/bin/activate           # Switch to virtualenv

Fork the GitHub repo and clone it:

$ git clone https://github.com/<yourhandlehere>/FIR.git

cd into the FIR directory and install Python dependencies:

$ cd FIR
$ pip install -r requirements.txt       # Install dependencies

If you want to enable the Plugins, copy the fir/config/installed_apps.txt.sample file to fir/config/installed_apps.txt:

$ cp fir/config/installed_apps.txt.sample fir/config/installed_apps.txt

Create the tables in the database:

$ ./manage.py migrate

Import initial data and test users (admin:admin and dev:dev):

$ ./manage.py loaddata incidents/fixtures/seed_data.json
$ ./manage.py loaddata incidents/fixtures/dev_users.json

If you happen not to live in Europe/Paris, make sur to change the timezone in base.py

Run the development server. It will restart automatically every time the code changes:

$ ./manage.py runserver

Got to http://localhost:8000 and voila!

One pull a day keeps the core-devs away

Get the latest version of the code:

$ git pull

Make sure you to install new dependencies:

$ pip install -r requirements.txt  # Use sudo if your environment requires it

Sync the changes in the database schema, if any.

$ ./manage.py migrate