Skip to content

fix: stop the right containers for minimize-downtime flag - #4454

Open
aldy505 wants to merge 3 commits into
masterfrom
aldy505/fix/ensure-minimize-downtime
Open

fix: stop the right containers for minimize-downtime flag#4454
aldy505 wants to merge 3 commits into
masterfrom
aldy505/fix/ensure-minimize-downtime

Conversation

@aldy505

@aldy505 aldy505 commented Aug 7, 2026

Copy link
Copy Markdown
Collaborator

The --minimize-downtime should not remove all databases (postgres, kafka, clickhouse, etc) on turn-things-off. Tested this on my instance with :nightly. Works well as long as you don't have any wrongdoings on docker-compose.override.yml (learned this the hard way)

Comment thread install/turn-things-off.sh Outdated

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Want reviews to match your repository better? Bugbot Learning can learn team-specific rules from PR activity. A team admin can enable Learning in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 5b08f48. Configure here.

Comment thread install/turn-things-off.sh Outdated
@aminvakil

Copy link
Copy Markdown
Collaborator

@aldy505 Would you please address issues by bots? They're right, docker compose down does not have -f flag nor -s.

@aldy505

aldy505 commented Aug 7, 2026

Copy link
Copy Markdown
Collaborator Author

@aldy505 Would you please address issues by bots? They're right, docker compose down does not have -f flag nor -s.

I'm a bit... confused between the behavior of docker compose rm and docker compose down and docker compose stop. I would say docker compose down is the right thing to do for that specific moment. Not sure what are those -fse flag even means.

@aminvakil

Copy link
Copy Markdown
Collaborator

Force and stop are not necessary for down.
down always stops containers, and force stops them after a time anyway.

What's the reason for switching to down though here?

@aldy505

aldy505 commented Aug 12, 2026

Copy link
Copy Markdown
Collaborator Author

Force and stop are not necessary for down. down always stops containers, and force stops them after a time anyway.

What's the reason for switching to down though here?

down is a modern command that I believe would cleanly remove the container, resulting in no orphan process. That's the only reason.

EDIT: oh right, and we need to reload the image tag, therefore dc stop and dc rm does not suffice

Comment thread install/wrap-up.sh Outdated
Comment thread install/wrap-up.sh Outdated
Comment thread install/wrap-up.sh Outdated
echo "Relay container not found, skipping restart."
fi
# Start the whole setup, except nginx, relay, and web.
start_service_and_wait_ready --remove-orphans $($dc config --services | grep -v -E '^(nginx|relay|web)$')

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct me if I'm wrong, but web container should always be recreated with new image after an upgrade, why does this has been added to exclusions?

@aldy505
aldy505 requested a review from aminvakil August 15, 2026 10:23
Comment thread install/wrap-up.sh

# Start the whole setup, except nginx and relay.
# Start the whole setup, except nginx, relay, and web.
start_service_and_wait_ready --remove-orphans $($dc config --services | grep -v -E '^(nginx|relay)$')

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: The comment in wrap-up.sh states the web service should be excluded from the initial start, but the grep regex on the next line does not exclude it.
Severity: MEDIUM

Suggested Fix

Update the grep regular expression on line 5 of install/wrap-up.sh to include web in the list of excluded services. The regex should be changed from '^(nginx|relay)$' to '^(nginx|web|relay)$' to match the intent described in the comment.

Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent. Verify if this is a real issue. If it is, propose a fix; if not, explain why it's
not valid.

Location: install/wrap-up.sh#L5

Potential issue: In the `--minimize-downtime` upgrade path, the script
`install/wrap-up.sh` is intended to perform a staged service startup. A comment on line
4 indicates that the `web` service should be excluded from the initial
`start_service_and_wait_ready` call. However, the `grep` command's regex on line 5
(`'^(nginx|relay)$'`) fails to exclude `web`. This causes the `web` service to be
started and force-recreated prematurely, which contradicts the intended staged startup
logic designed to minimize downtime. While this may not cause a complete failure, it
deviates from the expected upgrade process.

# Stop everything but relay and nginx
$dc rm -fsv $($dc config --services | grep -v -E '^(nginx|relay)$')
# Stop everything unless databases, relay, web, and nginx
$dc down $($dc config --services | grep -v -E '^(nginx|web|relay|smtp|memcached|redis|postgres|pgbouncer|kafka|clickhouse|seaweedfs)$')

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

podman down, stops and removes dependencies like postgres as well.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sigh...

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

Labels

None yet

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

2 participants