Setting up a Development Environment

Setting up a development environment for the blocker tracking app is pretty easy but different from installing the app in a production environment

FIXME: talk about git-flow

Required Fedora Packages

The instructions here will use virtualenv so that there are no potential conflicts with system libs. At a bare minimum, you will need:

  • python3-virtualenv

  • libcurl-devel

  • krb5-devel

If you plan on developing against a database other than sqlite, you will need to have that installed and configured, similarly to the production install documentation FIXME: NEED LINK TO PRODUCTION DOCS HERE

Create a Virtualenv

Create a new virtualenv in the base of the source tree:

virtualenv env_blockerbugs

In order to install python packages into the virtualenv or use the packages inside the virtualenv, it must be activated:

source env_blockerbugs/bin/activate

Install dependencies into the Virtualenv

To get all of the python packages into the virtualenv, use pip inside the virtualenv (ie. activate the virtualenv first):

pip install -r requirements.txt

Configuring dev environment

To generate an initial config for a sqlite database, use the following command:

python run_cli.py generate_config -d 'sqlite:////path/to/code/blockerbugs_db.sqlite'

The configuration file will be generated in the conf/ directory. While you would copy this config file to /etc/blockerbugs in a production system, for a development installation, just leave it in the conf/ directory.

The config generated by run_cli.py is very basic and may require tweaking to get the environment that you’re looking for.

FIXME: LINK TO CONFIGURATION OPTIONS

Initializing the Environment (Lazy Method)

The quick and easy way to initialize the environment with default settings for a recent Fedora release is to run:

bash init_db.sh

This shell script will initialize the configured database, set up a release and several milestones. The script is kept up to date for current Fedora releases so that you don’t need to memorize the relevant blocker and Freeze Exception tracker bugs.

Initializing the Environment (Detailed Method)

Most configuration post-installation is done using the cli. However, when working in a development environment, that cli isn’t directly available and we need to use the run_cli.py helper script which exposes the same commands.

Once the config file has been generated, the database needs to be initialized:

python run_cli.py init_db

There are some internal variables in the db which are wise to set before attempting to run a sync. These are easily set using the run_cli.py script:

python run_cli.py add_release -r 25

python run_cli.py add_milestone -r 25 -m alpha -b 1277284 -a 1277285
python run_cli.py add_milestone -r 25 -m beta -b 1277287 -a 1277288
python run_cli.py add_milestone -r 25 -m final -b 1277289 -a 1277290

This will add a Fedora 25 release and its milestones with Blocker and FreezeException trackers for each of them. See init_db.sh for more up-to-date values.

Running Sync Against Bugzilla and Bodhi

To do an initial sync, simply run the following command:

DEV='true' python run_cli.py sync

Alternatively, it is possible to sync only selected parts:

DEV='true' python run_cli.py sync-bugs
DEV='true' python run_cli.py sync-updates
DEV='true' python run_cli.py sync-discussions

Running the web UI

Run the web UI with:

DEV='true' python runapp.py

and then visit http://127.0.0.1:9999/.

Running Unit Tests

Unit tests have been written using pytest and can be run from the root project directory with:

TEST='true' py.test testing/

The TEST='true' part is rather important as some of the tests will wipe the database and fill it with less useful data. The TEST configuration forces the use of an in-memory SQLite3 database.