fix(cost): add restart policy to mc-cost-optimizer-db - #209
Merged
Merged
Conversation
mc-cost-optimizer-db had no restart policy (default: no), so it was not brought back after a host reboot while the dependent cost services (restart: on-failure) kept crash-looping on UnknownHostException. Align with other DB services in the file by using restart: always.
fix(cost): add restart policy to mc-cost-optimizer-db
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
mc-cost-optimizer-dbhas norestartpolicy, so it falls back tono.After a host reboot, the Docker daemon brings back every container that has a restart policy. The cost-optimizer DB is not one of them, so it stays down.
Every cost-optimizer service that depends on it (
restart: on-failure) then crash-loops onUnknownHostException: mc-cost-optimizer-db.mc-cost-optimizer-bestays unhealthy, and APIs such asPOST /api/costopti/be/invoice/getInvoicefail until someone starts the DB by hand.Changes
restart: alwaystomc-cost-optimizer-db. This matches the other DB services in the same file (e.g.mc-application-manager-db).How to apply on an existing deployment
Recreate the DB container so the new policy takes effect. The data volume is kept, and the image (
mariadb:12.3.2) does not change:docker compose -f conf/docker/docker-compose.yaml up -d --no-deps mc-cost-optimizer-db
Or apply it in place without recreating the container:
docker update --restart always mc-cost-optimizer-db