Best practice for sharing models definition across containers in docker-compose?

173 views Asked by At

There are multiple containers using data from the same indexes in Elasticsearch and Mongodb databases:

  • app is a python app that serves data via API
  • tasks is a python + celery app that perform periodical updates, cleaning, etc. on the same data
  • backend is a python app that use the same data for business-logic

The definitions of the models are elasticsearch-dsl and mongoengine Documents with minimum code for validators. Currently they live in a separate repo on gitub, which is included in requirements.txt of each app, and used when running containers via docker-compose (in dev) or swarm (in production)

While OK for production, this method is very inconvenient for developer, since after each change in any model description, a separate repo should be updated, and then those changes should be populated across all local apps.

Is there any other convenient method for sharing model definitions across multiple containers in the same project (without compromising security)?

0

There are 0 answers