wtf( )unctionsystem design, drawn
← all problemsContainersMedium

Two helpers, two lifetimes

A workload needs two things alongside it: a database migration that must finish before the application starts, and a log shipper that must run the whole time the application does.

Both are containers in the same unit, and putting them in the wrong role produces two different failures — one starts too late to be useful, and one keeps the unit alive after the work is done.

Give each helper the role whose lifetime matches it.
Components — tap one, then tap a slot on the diagram
?Get the roles the wrong way round and one runs too late while the other never finishes.

Boundaries, outermost first: One deployable unit: Application, an empty slot for the runs to completion first, an empty slot for the runs alongside Outside every boundary: Schema migration (must finish first), Log shipper (runs throughout) Connections: Schema migration calls runs to completion first (step 1) runs to completion first calls Application — then start (step 2) Log shipper calls runs alongside (step 3) runs alongside controls Application — for its whole life

Application
Schema migrationmust finish first
Log shipperruns throughout