Page MenuHomeDevCentral

Determine in what order containers should be run
ClosedPublic

Authored by dereckson on Mar 27 2023, 23:38.
Tags
None
Referenced Files
Unknown Object (File)
Fri, Dec 20, 11:54
Unknown Object (File)
Fri, Dec 20, 09:10
Unknown Object (File)
Thu, Dec 19, 06:15
Unknown Object (File)
Thu, Dec 19, 02:51
Unknown Object (File)
Thu, Dec 12, 22:26
Unknown Object (File)
Thu, Dec 12, 19:52
Unknown Object (File)
Thu, Dec 12, 19:44
Unknown Object (File)
Wed, Dec 11, 15:47
Subscribers
None

Details

Summary

Once upon a time, a small systemd service was prepared to hardcode a list
of containers to launch once Docker is up. See D20 and T467.

On docker-002, we've now with Sentry ± 200 order conditions to solve.

Also on docker-002, we've still services defined with links between containers.
In such case, Docker will simply refuse to start container B as long as
the container A isn't there to satisfy "B has a link A". A correct list
is so vital in that case.

Containers are now defined in pillar, under docker_containers key.
There are a lot of configuration keys there like mysql_link that
can be interpreted as, for example, "devcentral depends of acquisitariat".

Dependencies between services are so documented by this change
under docker_containers_dependencies pillar entry, shared between all
Docker engines.

docker-paas-list-containers can then be used to query both pillar entries,
build a graph of dependencies and solve a topological order for the graph.

Fixes T1428.

Test Plan
  • For docker-002, it gives P319.
  • For the systemd unit, deploy should be no op as all containers are already started

Diff Detail

Repository
rOPS Nasqueron Operations
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

dereckson created this revision.

Switch from YAML to JSON, as PyYAML isn't installed on role paas-docker

Avoid to query Salt twice (we win 4-5 seconds execution time)

Relay service has optional dependencies.

pillar/paas/docker.sls
75

Not always the case. For example, we've a development Relay on Dwellers with the following definition:

app_port: 26300
flavour: dev

That gives the following fatal error:

$ docker-paas-list-containers
[FATAL] No kafka in {'app_port': 26300, 'flavour': 'dev'}

Fix path ; allow Relay to specify optional dependencies.

This revision is now accepted and ready to land.Mar 28 2023, 00:31
This revision was landed with ongoing or failed builds.Mar 28 2023, 00:32
This revision was automatically updated to reflect the committed changes.