-
Install Docker.
-
Install Docker Compose.
$ git clone https://github.com/eea/bdr.registry.notifications
$ cd bdr.registry.notifications/
$ cp docker/init.sql.example docker/init.sql
$ vim docker/init.sql
$ cp docker/app.env.example docker/app.env
$ vim docker/app.env
$ cp docker/redis.env.example docker/redis.env
$ vim redis.env.example
$ cp docker-compose.override.yml.example docker-compose.override.yml
$ vim docker-compose.override.yml
$ docker-compose up -d
Step into app's container:
$ docker exec -it not.app bash
Create initial database structure:
$ python manage.py migrate
Load fixtures data into the database:
$ python manage.py loaddata notifications/fixtures/companiesgroups.json
Create a super user to be able to use the app:
$ python manage.py createsuperuser
Start as service:
$ ./docker-entrypoint.sh
or in debug mode:
$ python manage.py runserver 0.0.0.0:$APP_HTTP_PORT
Fetch information from BDR:
$ python manage.py fetch_bdr
Fetch information from ECR:
$ python manage.py fetch_ecr
Fetch information from both sources:
$ python manage.py fetch_all
There is also a URL "/fetch/" which triggers both scripts.
Run tests:
$ python manage.py test --settings=bdr.testsettings
Check coverage:
$ coverage run --source='.' ./manage.py test --settings=bdr.testsettings
$ coverage html -i
The configuration for production deployment is detailed in the BDR/BDR-TEST stack.
-
Create a virtual environment:
$ virtualenv bdr $ cd bdr $ source bin/activate
-
Clone the repository:
$ git clone https://github.com/eea/bdr.registry.notifications $ cd bdr.registry.notifications
-
Install dependencies:
$ pip install -r requirements.txt
-
Create a local configuration file:
$ cd bdr $ vi localsettings.py
-
Set up the MySQL database and grant privileges:
$ mysql -u root -p mysql> CREATE DATABASE DB_NAME CHARACTER SET utf8 COLLATE utf8_general_ci; mysql> CREATE USER 'DB_USER'@'%' IDENTIFIED BY 'DB_PASSWORD'; mysql> GRANT ALL PRIVILEGES ON DB_NAME.* TO 'DB_USER'@'%';
where:
* DB_NAME: database name (e.g. **bdr_registry_notifications**) * DB_USER: database access user (e.g. **bdr**) * DB_PASSWORD: user's password (e.g. **bdr**)
If you decide to change the password:
mysql> SET PASSWORD FOR 'DB_USER'@'%' = 'NEW_DB_PASSWORD';
-
Create initial database structure:
$ python manage.py migrate
-
Load fixtures data into the database:
$ python manage.py loaddata notifications/fixtures/companiesgroups.json
-
Create a super user to gain access:
$ python manage.py createsuperuser
-
Start server in debug more:
$ python manage.py runserver 0.0.0.0:12301
-
In your browser type http://localhost:12301/notifications/.
```
$ python manage.py test --settings=bdr.testsettings
```
For sending a large number of emails (>3000) make sure that the Memory reservation and Memory Limit are set at 2GB
The Initial Owner of the Original Code is European Environment Agency (EEA). All Rights Reserved.
The Original Code is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.