Skip to content

Ensure Mutagen waits for the CLI container during docker/sdk up with Tideways#628

Open
pwnyprod wants to merge 1 commit into
spryker:masterfrom
pwnyprod:fix/tideways-container-up-before-cli-mutagen-sync
Open

Ensure Mutagen waits for the CLI container during docker/sdk up with Tideways#628
pwnyprod wants to merge 1 commit into
spryker:masterfrom
pwnyprod:fix/tideways-container-up-before-cli-mutagen-sync

Conversation

@pwnyprod
Copy link
Copy Markdown

Description

This change makes Mutagen target the CLI container explicitly and ensures the CLI container is started during docker/sdk up.

Previously, the sync flow implicitly relied on the CLI container being available early enough. With additional services such as Tideways starting first, Mutagen could run before the CLI container was ready or fall back to a different running container. This caused the sync setup to become unreliable.

The patch fixes this by:

  • explicitly ensuring the CLI container is running during up
  • waiting for the CLI container before creating the Mutagen sync session
  • removing the fallback to arbitrary running containers
  • avoiding a hard failure in the generic post-run Mutagen hook when the CLI container is not available yet

Details

Problem

The current Mutagen startup flow implicitly assumes that the CLI container is available early enough during docker/sdk up.

This becomes fragile when another container (for example Tideways) starts before the CLI container. In that case:

  • Mutagen may try to create a sync session too early
  • the SDK may rely on a container startup order that is no longer guaranteed
  • the sync target selection may become ambiguous if a non-CLI container is already running
Solution

This patch makes the CLI container the explicit sync target and ensures it is started before the Mutagen session is created.

Result

docker/sdk up no longer depends on the CLI container being the first relevant container that comes up.
Mutagen now waits for the CLI container explicitly and always creates the sync session against it.

Related resources

Change log

  • call Compose::ensureCliRunning() from Compose::up() after the regular compose run
  • add Mount::Mutagen::waitForCliContainer() and use it before creating the sync session
  • restrict findTargetContainer() to the CLI container only
  • make afterRun() defer sync creation instead of failing hard when the CLI container is not running yet

Checklist

  • I agree with the Code Contribution License Agreement in CONTRIBUTING.md

@pwnyprod
Copy link
Copy Markdown
Author

For recreating and testing this issue:

deploy.local.yml:

image:
    tag: spryker/php:8.3-debian
    ...
    php:
        enabled-extensions:
              - tideways
        ini:
            ...
            tideways.features.distributed_tracing: 1
            tideways.features.redis_keys: 1
            tideways.features.crawler_detection: 1
...
services:
    ...
    tideways:
        apikey: XXX
        engine: tideways
        environment: XXX
        environment-name: XXX
        cli-enabled: true

after enabling tideways:

  • docker/sdk bootstrap deploy.local.yml
  • docker/sdk up

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants