*******************************************************************************
Development
*******************************************************************************
.. note::
For linux users, it is necessary to add `sudo` before all `docker` commands.
Start dev instance
===============================================================================
Step 1 : Open a terminal
-------------------------------------------------------------------------------
- `Windows `_
- `Mac OSX `_
- `Linux `_
Step 2 : Clone project
-------------------------------------------------------------------------------
.. code-block:: bash
git clone https://gitlab.com/ifb-elixirfr/covid19/EMERGEN-DB.git
cd EMERGEN-DB
Step 3: Run docker compose
-------------------------------------------------------------------------------
.. warning::
Docker must always be switched on for any installation and use of EMERGEN-DB !
.. code-block:: bash
# 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 (:code:`static-apps/datafile/membres-emergen_test.csv`)
and data working with these users (:code:`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:
:code:`docker-compose up`.
Useful commands
===============================================================================
List of useful command lines in test instance:
- Close EMERGEN-DB : :code:`docker-compose down`.
- Restart EMERGEN-DB : :code:`docker-compose up -d`.
- Rebuild EMERGEN-DB: :code:`docker-compose up -d --build`.
- Get logs : :code:`docker-compose up -d logs -f`.
- Populate with dummy data : :code:`bash populate_exemple_test.sh`.
- Generate UML schema : :code:`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`.