Page MenuHomeDevCentral

Determine in what order containers should be run
ClosedPublic

Authored by dereckson on Mar 27 2023, 23:38.
Tags
None
Referenced Files
F3753910: D2934.id7474.diff
Mon, Nov 18, 03:54
F3753470: D2934.id7473.diff
Mon, Nov 18, 01:56
F3752520: D2934.id7476.diff
Sun, Nov 17, 19:22
Unknown Object (File)
Wed, Nov 13, 15:02
Unknown Object (File)
Thu, Nov 7, 14:33
Unknown Object (File)
Sun, Nov 3, 17:04
Unknown Object (File)
Sun, Nov 3, 12:32
Unknown Object (File)
Sun, Nov 3, 01:36
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.