azlaanmsamad / Inria_Task

MIT License
0 stars 0 forks source link

Flask server in Docker container #5

Open pgraverdy opened 2 years ago

pgraverdy commented 2 years ago

In the document, it is stated that all components should be dockerized.

azlaanmsamad commented 2 years ago

@pgraverdy

Let me know if I should create a PR for this issue.

azlaanmsamad commented 2 years ago

@pgraverdy

Ways to connect containers:

  1. Communicating through networking: Using network provided by the docker to connect between two containers. This network can be user modified.
  2. By Using Volumes: by writing their files into volumes which can be shared between two containers.
pgraverdy commented 2 years ago

@azlaanmsamad

Regarding the apps in the two containers (flask and rabbitmq) the communication protocol between them is AMQP, so its a networking protocol. There is no shared data/state between them. Hence the two solutions are

As a side note, sharing volumes between containers (when relevant) has to be carefully done, You just can't access the files containing the data from a DB from another container (it will definitively create inconsistencies in the database). Sharing a volume for read access is fine, not for write access.

azlaanmsamad commented 2 years ago

@pgraverdy

Okay thank you for the explanation. In case two app containers are using the same database to write files, how do we avoid inconsistency?

azlaanmsamad commented 2 years ago

@pgraverdy

Should I create a PR for this?