Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HostManager leaves containers from old services #363

Open
BrianJKoopman opened this issue Nov 30, 2023 · 1 comment
Open

HostManager leaves containers from old services #363

BrianJKoopman opened this issue Nov 30, 2023 · 1 comment
Labels
agent: hostmanager enhancement New feature or request

Comments

@BrianJKoopman
Copy link
Member

Probably more of a feature request than a bug, but we should add the --remove-orphans flag to the HostManager's docker-compose command. This'll remove old containers automatically in the rare instances that a service is renamed.

I think this just needs to be added here:

def up(self):
self.d = _run_docker_compose(
['-f', self.service['compose_file'],
'up', '-d', self.service['service']],
docker_compose_bin=self.docker_compose_bin)
self.status = None, time.time()

For some context, we ran into this on site twice somewhat recently, once we were careful to bring down the service before deploying the new one and bringing the new agent up, the other we weren't as careful, and the old copy of the Agent prevented the new one from working properly.

@BrianJKoopman BrianJKoopman added the enhancement New feature or request label Nov 30, 2023
@BrianJKoopman
Copy link
Member Author

BrianJKoopman commented Apr 25, 2024

I tried briefly to add this today, but it wasn't behaving as I expected. The Host Manager loses track of the renamed/removed compose service and then enters a [?] state. The --remove-orphans flag doesn't seem to get a chance to run:

2024-04-25T16:30:59-0400 startup-op: launching manager
2024-04-25T16:30:59-0400 start called for manager
2024-04-25T16:30:59-0400 manager:0 Status is now "starting".
2024-04-25T16:30:59-0400 manager:0 Status is now "running".
2024-04-25T16:30:59-0400 Installed OCS Plugins: ['socs', 'ocs']
2024-04-25T16:30:59-0400 manager:0 Successfully parsed /home/koopman/git/ocs-dev-configs/hostmanager-local-test/docker-compose.yml and its service states.
2024-04-25T16:31:00-0400 manager:0 Requested launch for FakeDataAgent:fake-data1
2024-04-25T16:31:00-0400 manager:0 Requested launch for FakeDataAgent:fake-data2
2024-04-25T16:31:01-0400 manager:0 Launched FakeDataAgent:fake-data1
2024-04-25T16:31:01-0400 manager:0 Launched FakeDataAgent:fake-data2
2024-04-25T16:31:59-0400 manager:0 Failed to interpret /home/koopman/git/ocs-dev-configs/hostmanager-local-test/docker-compose.yml and/or its service states: Consistency problem: image does not self-report as a listed service? (ocs-fake-data2)
2024-04-25T16:31:59-0400 manager:0 Marking missing service for fake-data1
2024-04-25T16:31:59-0400 manager:0 Marking missing service for fake-data2
2024-04-25T16:32:07-0400 start called for update
2024-04-25T16:32:07-0400 update:1 Status is now "starting".
2024-04-25T16:32:07-0400 update:1 Status is now "running".
2024-04-25T16:32:07-0400 update:1 Retiring FakeDataAgent:fake-data2, which has disappeared from configuration file(s) or has manage:no.
2024-04-25T16:32:07-0400 Installed OCS Plugins: ['socs', 'ocs']
2024-04-25T16:32:07-0400 update:1 Update requested.
2024-04-25T16:32:07-0400 update:1 Status is now "done".
2024-04-25T16:32:23-0400 start called for update

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
agent: hostmanager enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant