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)
Thu, Apr 18, 03:47
Unknown Object (File)
Mon, Apr 15, 21:49
Unknown Object (File)
Mon, Apr 15, 14:10
Unknown Object (File)
Mon, Apr 15, 06:32
Unknown Object (File)
Sun, Apr 14, 14:57
Unknown Object (File)
Sun, Apr 14, 12:29
Unknown Object (File)
Sun, Apr 14, 01:35
Unknown Object (File)
Sun, Apr 14, 01:35
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.