3. Setup development environment

3.1. Source Code

$ git clone https://github.com/release-engineering/product-definition-center.git

3.2. Installation

3.2.1. Option 1: Start it on RPM

For development purposes, install following dependencies:

3.2.2. Option 2: Start it on virtualenv

  • Koji is not available on PyPI. You must install the koji package to your system via yum before creating a virtualenv.

    $ sudo yum install koji
    
  • After that, run

    $ pip install virtualenvwrapper
    

    and setup according to ‘Setup’ steps in /usr/bin/virtualenvwrapper.sh. Then run

    $ mkvirtualenv pdc --system-site-packages
    

    to include koji into your pdc virtualenv.

  • Run the following

    $ workon pdc
    $ pip install -r requirements/devel.txt
    

    to activate pdc virtualenv and install all the dependencies.

3.2.3. Option 3: Start it on Docker

  • Install Docker: see the official installation guide for details. Generally, it might be enough to run install it with yum and then run it.

    $ sudo yum install docker-engine
    $ sudo service docker start
    
  • Use this command to build a new image

    $ sudo docker build -t <YOUR_NAME>/pdc <the directory your Dockerfile is located>
    
  • Run the container (:Z flag is required to mount volumes with SELinux)

    $ docker run -it -P -v $PWD:$PWD:Z <YOUR_NAME>/pdc python $PWD/manage.py runserver 0.0.0.0:8000
    
  • Check the address

    1. Find the address of the docker machine (127.0.0.1 –> DOCKER_HOST).

    2. Find the mapped port of your running container

      $ sudo docker ps -l --> PORT
      
  • Access it by visiting DOCKER_HOST:PORT in your web browser.

3.3. Customize settings

You can use the dist settings template by copying it to settings_local.py:

$ cp settings_local.py.dist settings_local.py

Feel free to customize your settings_local.py. Changes will be populated automatically. In local development environment, you may need to set DEBUG = True to get better error messages and comment out ALLOWED_HOSTS setting.

When you run PDC locally, you may not want to enable the permission checks, just uncomment DISABLE_RESOURCE_PERMISSION_CHECK line.

3.4. Init database

To initialize database, run:

$ python manage.py migrate --noinput

3.5. Run devel server

To run development server, run:

$ make run

For development you may find it useful to enable Django Debug Toolbar.

Related settings is documented in comment at the top of settings_local.py.dist.