Commit 7f400160dbb74e8f08c3df8569fc76bd1c26fd73

Authored by hitier
1 parent 09bf2de0
Exists in rhitier-dev

Docker compose local:container bindings

Showing 3 changed files with 44 additions and 0 deletions   Show diff stats
README.md
... ... @@ -20,6 +20,34 @@ It also gathers NetCDF data from AMDA, and serves it as CSV to the plotter.
20 20 docker compose build
21 21 docker compose up
22 22  
  23 +## Docker compose configuration
  24 +
  25 +docker stack mainly consists in two files:
  26 +
  27 +- `Dockerfile` for the container building
  28 +- `compose.yaml` for the volumes configuration and links with nginx service and gunicorn
  29 +
  30 +### Volumes configuration and `compose.override.yaml`
  31 +
  32 +You may want to understand where data is stored:
  33 +
  34 +The web application saves `*.csv` files in the `./cache/` directory, which happens to be a docker volume named `helio_cache`
  35 +
  36 +The speasy library holds a cache dir located at `container:/root/.cache/speasy/Cache/` which is also mounted as a volume: `speasy_cache`
  37 +
  38 +Two configuration files are also used:
  39 +
  40 +- `./config.yml` for the web app
  41 +- `${HOME}/.config/speasy/config.ini` for the speasy library
  42 +
  43 +
  44 +You can use the `compose.override.yaml` file to make dynamic links between your local files and the container.
  45 +That way you can live edit the config files, and also use already loaded cache directories.
  46 +
  47 + cp compose.override.yaml-dist compose.override.yaml
  48 + ${EDITOR} compose.override.yaml # make sure its ok, comment what you dont need
  49 + docker compose up -d
  50 +
23 51 ## Develop
24 52  
25 53 ### Configuration
... ...
compose.override.yaml-dist 0 → 100644
... ... @@ -0,0 +1,14 @@
  1 +# overriding compose configuration file
  2 +# dynamically links files and directories from host to container
  3 +
  4 +services:
  5 + web:
  6 + volumes:
  7 + # local csv files cache used for the running container
  8 + - ./cache:/cache:rw
  9 + # local site configuration file used for the running container
  10 + - ./config.yml:/config.yml
  11 + # local speasy configuration file used for the running container
  12 + - ${HOME}/.config/speasy/config.ini:/root/.config/speasy/config.ini
  13 + # local speasy cache dir file used for the running container
  14 + - ${HOME}/.cache/speasy/Cache:/root/.cache/speasy/Cache:rw
... ...
compose.yaml
... ... @@ -8,6 +8,7 @@ services:
8 8 command: gunicorn --bind 0.0.0.0:5000 heliopropa:application
9 9 volumes:
10 10 - helio_cache:/cache:rw
  11 + - speasy_cache:/root/.cache/speasy/Cache:rw
11 12 expose:
12 13 - 5000
13 14 nginx:
... ... @@ -21,3 +22,4 @@ services:
21 22  
22 23 volumes:
23 24 helio_cache:
  25 + speasy_cache:
... ...