EEA & Eionet documentation hub

Browse documentation for IT-systems used by the European Environment Agency and the Eionet network.

Target Cross Linking Tool (TCT)

eea.docker.tct

The project name is Target Cross Linking Tool, a platform for organizing the implementation of a country’s national biodiversity strategy after AICHI (and by case after EU Strategy).

It consists of two panels each corresponding an operation: viewing and editing. The first panel allows anyone to overview the aichi goals, targets and indicators along with national strategy mappings (the way a country develops its own strategy in terms of objectives and actions) and its implementation.

The second panel(Admin), authentication-available only, allows an user to actually define the national strategy. (e.g. add/modify/delete an objective, action or even elements from AICHI) in the purpose of building it.

Travis Coverage Docker

Prerequisites

Installing the application

  1. Get the source code:

    $ git clone https://github.com/eea/eea.docker.tct $ cd eea.docker.tct
    
  2. Customize env files:

    $ cp docker/postgres.env.example docker/postgres.env $ vim docker/postgres.env $ cp docker/demo.env.example docker/demo.env $ vim docker/demo.env $ cp docker/init.sql.example docker/init.sql $ vim docker/init.sql
    
  3. Start application stack:

    $ docker-compose up -d $ docker-compose logs
    
  4. Create a superuser:

    $ docker exec -it tct.app sh $ ./manage.py createsuperuser
    
  5. Run tests:

    $ docker exec -it tct.app sh # apk add --no-cache libxslt-dev libffi-dev # pip install -r requirements-dev.txt $ ./manage.py test
    
  6. See it in action: http://localhost:8000

Upgrading the application

  1. Get the latest version of source code:

    $ cd eea.docker.tct $ git pull origin master
    
  2. Update the application stack, all services should be “Up”:

    $ docker-compose up -d $ docker-compose ps
    
  3. See it in action: http://localhost:8000

Development instructions

  1. Customize docker orchestration for local development:

    $ cp docker-compose.override.yml.example docker-compose.override.yml
    

By default, it replaces nginx service with a dummy container, builds a local image for app service and maps the project directory inside the app container.

You can add a fixed port number instead the floating one by specifying it under the ports directive (e.g. “8000:80” instead of “80”).

Make sure the database user and password from demo.env is matching the ones from init.sql file.

  1. Start stack, all services should be “Up” :

    $ docker-compose up -d $ docker-compose ps
    
  • Check application logs:

      $ docker-compose logs
    
  • When the image is modified you should update the stack:

      $ docker-compose down -v #optional step for droping all containers and volumes   $ docker-compose up -d --build
    

Debugging

  • Please make sure that DEBUG=True in demo.env file.

  • Update docker-compose.override.yml file app section with the following so that docker-entrypoint.sh is not executed:

      entrypoint: ["/usr/bin/tail", "-f", "/dev/null"]
    
  • Attach to docker container and start the server in debug mode:

      $ docker exec -it tct.app sh   # ./manage.py runserver 0.0.0.0:8000
    
  • See it in action: http://localhost:8000

LDAP integration

Set ALLOWED_USERS in settings to restrict access to a specific set of usernames.

Set AUTH_LDAP_SERVER_URI and AUTH_LDAP_USER_DN_TEMPLATE from settings.py for LDAP Authentication configuration. Add ‘django_auth_ldap.backend.LDAPBackend’ value in AUTHENTICATION_BACKENDS.

Translations

  1. Manual translation.
  • Run over the entire source tree and pull out all strings marked for translation, add/edit/delete translations for each file in tct/locale/[LANGUAGE]/LC_MESSAGE/django.po, compile the po files and restart the server:

      $ docker exec -it tct.app sh   # cd tct   # django-admin.py makemessages -a   # django-admin.py compilemessages   $ docker-compose restart demo
    
  1. Automatic translation
  • Translate the messages using the Rosetta tool for translation (http://localhost:8000/translate) and restart the server when ready:

      $ docker-compose restart app
    

Edit this page