HELP.md 3.71 KB
  1. DOCKER workflow (build, start, install, run)

3.1. When to do what ?

(IF) you did this or want to do this => (THEN) you must run this You changed the requirements.txt file Change version de python ou django, ou mysql => PYROS_DOCKER_BUILD (then PYROS_DOCKER_START) You updated the environment variables (in your own file variables.env) => PYROS_DOCKER_START You want to reset your database according to the Django Models and inject initial data => PYROS_DOCKER_INSTALL (first, stop pyros if it is running : KILL_PYROS_DOCKER_RUN) You want to update your source code (and the database) to the last version available => PYROS_DOCKER_UPDATE (first, stop pyros if it is running : KILL_PYROS_DOCKER_RUN)

3.2. Explanation of what each docker script does

3.2.1. PYROS_DOCKER_BUILD

This script will construct the docker containers from images given by the docker-compose file: Pyros itself (A linux os with Python) MySQL

You don’t need to stop your running containers in order to build them again, however you will need to restart them in order to apply the modification.

When docker is building the PyROS container, it will install all Python packages written within the requirements.txt file (stored in the docker folder).

So if you have changed the requirements.txt file, you might want to build a new PyROS container so your python packages will be updated.

3.2.2. PYROS_DOCKER_START

Run the containers builded by the previous script. You need to run those containers in order to use PyROS. If you have updated the environment variables, you should restart your containers, simply by running this script.

3.2.3. PYROS_DOCKER_INSTALL

To install the database and instantiate initial data.

You should run this script the first time you are installing PyROS or if you want to reset your database according to the models and inject initial data.

Before running this script, you should stop PyROS (website and other services) if it is running.

3.2.4. PYROS_DOCKER_UPDATE

This will update your project (by pulling the modification from the git repository), update the database structure (by running Django migrations), and update various diagrams.

Before running this script, as for Docker Install, you should stop PyROS (website and other services) if it is running.

3.2.5. PYROS_DOCKER_RUN

There are different versions of docker run, those versions vary according to the OS you are using and what things you want to run.

There are two actions that you might want to do with those docker run scripts :

Run the website only Run the website and the PyROS agents If you are in the first case, you should use the PYROS_DOCKER_RUN_WEBSERVER_ONLY. There are two versions of this script :

For Linux / Mac distribution : PYROS_DOCKER_RUN_WEBSERVER_ONLY For Windows users : PYROS_DOCKER_RUN_WEBSERVER_ONLY.bat

If you are in the second case, you should use the RUN script. Again there are two versions of this script : One for Linux/Mac OS : PYROS_DOCKER_RUN One for Windows : PYROS_DOCKER_RUN_WIN.BAT

3.2.6. PYROS_DOCKER_STOP

This will stop the running containers.

3.2.7. PYROS_DOCKER_TEST

This script will run PyROS unit tests. You can run this script even if you’re running PyROS, however it’s safier to stop PyROS with KILL_PYROS_DOCKER_RUN.

By default it will run every test of PyROS but you can add parameters after it to indicate which module you want to test. For example, if you want to test the user manager module you can run the following command line :

./PYROS_DOCKER_TEST user_manager

3.2.8. PYROS_DOCKER_SHELL

This will open a terminal within the PyROS container, by doing so, you can use PyROS as if you weren’t using docker.

3.2.9. KILL_PYROS_DOCKER_RUN

This script will kill every process launched by the PYROS_DOCKER_RUN (i.e. PyROS will be stopped).