Development

Note

For linux users, it is necessary to add sudo before all docker commands.

Start dev instance

Step 1 : Open a terminal

Step 2 : Clone project

git clone https://gitlab.com/ifb-elixirfr/covid19/EMERGEN-DB.git
cd EMERGEN-DB

Step 3: Run docker compose

Avertissement

Docker must always be switched on for any installation and use of EMERGEN-DB !

# Run docker-compose
docker-compose up -d --build

# Migrate models into database and
docker-compose exec web python manage.py migrate

# Load data
docker-compose exec web python manage.py load_region
docker-compose exec web python manage.py load_departement
docker-compose exec web python manage.py load_description

# Create materialized view
docker-compose exec web python manage.py generate_mat_view_dep_reg
docker-compose exec web python manage.py generate_mat_view_team_auth_group

# Import GISAID information
docker-compose exec web python manage.py load_gisaid_instruction
docker-compose exec web python manage.py load_ena_instruction

# Create super user
docker-compose exec web python manage.py createsuperuser

EMERGEN-DB is running. You can open a web browser and use it in the following url : http://localhost:8000/.

After the superuser creation, open admin using the following link http://localhost:8000/admin/auth/user/, and connect using the username and password created in the comand above.

Note

Before submitting data, do not forget to add users. An example file is available with random users (static-apps/datafile/membres-emergen_test.csv) and data working with these users (static-apps/datafile/2021-04-09_IFB-bidon_semaine14_emergen_typage_v1.8.xlsx). This data does not reflect reality and is fictitious.

Note

You only need to build the application once. If docker is always running, all you need to do is use: docker-compose up.

Useful commands

List of useful command lines in test instance:

  • Close EMERGEN-DB : docker-compose down.

  • Restart EMERGEN-DB : docker-compose up -d.

  • Rebuild EMERGEN-DB: docker-compose up -d --build.

  • Get logs : docker-compose up -d logs -f.

  • Populate with dummy data : bash populate_exemple_test.sh.

  • Generate UML schema : docker-compose exec web python manage.py graph_models -a -o static-apps/img/EMERGEN-DB_models.png.

  • Python prompt : :code: docker-compose -f docker-compose.prod.yml exec web python manage.py shell.