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

Unable to remove repository Stack after repository removes compose YAML (with GitOps) #11704

Open
2 tasks done
lgo opened this issue Apr 28, 2024 · 2 comments
Open
2 tasks done
Labels

Comments

@lgo
Copy link

lgo commented Apr 28, 2024

Before you start please confirm the following.

Problem Description

After removing a docker-compose YAML from a repository that's been used to create a Stack, and the Stack was updated via GitOps (in my case, a webhook), the Stack automatically removes the containers but is unable to be deleted. It fails with:

failed to remove a stack: docker compose command failed: chdir /data/compose/{stack_id}/...: no such file or directory

This occured as I've setup some automations around stack deployment and updates that use a monorepo of compose files. I renamed some of the compose YAML files and ran into this bug.

Expected Behavior

The Stack should be possible to delete.

Actual Behavior

The stack fails to delete.

Steps to Reproduce

  1. Create a Stack from a Git repository
  2. Setup GitOps to update
  3. Remove the YAML from the repostory, and wait for the Stack to update
  4. Attempt to delete the Stack

Portainer logs or screenshots

No response

Portainer version

2.19.5

Portainer Edition

Business Edition (BE/EE) with 5NF / 3NF license

Platform and Version

Docker 24.0.7

OS and Architecture

Debian AMD64

Browser

No response

What command did you use to deploy Portainer?

No response

Additional Information

No response

@UpInSmoke-FC
Copy link

I also am experiencing this issue and am unable to remove the stack

@PolkaMaPhone
Copy link

I was having a really similar issue, except I deleted the entire repository. I was able to work around it by fiddling with the database and the filesystem (but this is only in my lab environment so I'm not too worried about breaking stuff.)

In all honesty what I did was pretty janky, and restoring from a backup was probably the move, but...

Here's how I brutally forced it to delete it. Most of these steps were a part of going on the journey, but probably aren't all necessary.

  1. Find the ID of the stack (in my case it was 48)
  2. Remove the contents of 48 (/portainer/compose/48/)
  3. Stop Portainer and make a copy of the database, and a backup (/portainer/portainer.db)
  4. Edit the copy of the database with something like BoltBrowser cli
  5. Find stacks, then 48 in the db
  6. Edit JSON in the db and set EntryPoint to ""
  7. Edit JSON in the db and set ConfigHash to ""
  8. Overwrite portainer.db with the modified version
  9. Start Portainer
  10. Delete stack normally from the GUI

I'm guessing you probably don't need to delete the ConfigHash if you delete the EntryPoint, or delete anything from the filesystem, It's just what I clumsily tried first and was too lazy to undo.

Before:
image

After:
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants