Stack conversion - #795
Stack conversion#795barrelltitor wants to merge 8 commits into
Conversation
56f9847 to
65a8995
Compare
|
I'm not sure what you force pushed there but it seems to have broken the PR a bit, want me to rebase and redo it? |
65a8995 to
f74603c
Compare
yes, sorry for the FP, thanks for rebasing. I will take a look, thanks! |
f841256 to
893ac03
Compare
|
Reviewed — the design is sound and the round-trip works. A few non-blocking things worth confirming, none of them data-loss: 1. Never-deployed git stack edge case. Detach relies on the compose file already living in 2. 3. attach + externally-edited Thanks for this — it closes a real annoyance. |
|
First issue is sorted out, looks like all my testing was indeed on stacks I already deployed already, my bad For 2 that is intentional, null and empty are different states. I don't remember exactly, but I think it was on git stacks that did not have a custom path for the .env file and just used the one in the same folder. That is probably it looking at the code for upserting stacks For the edge case what should be the source of truth if a key value pair is changed, so e.g TZ=UTC(DB) is found in the .env file to be TZ=Europe/Bucharest, which do we apply? I'd assume the one in the .env file? Fixing the edge case is easy, I wanted to just reload the .env file right before conversion |
|
Sorry for the delay, had a lot to do. So I fixed this edgecase, but I had the user be the source of truth for the actual value of the same variables and just added on newly added ones from .env |
597e9bf to
4a500c7
Compare
|
@jotka fixed the conflicts and the edge case if you have some time to check it out again I also built the image under ghcr.io/barrelltitor/dockhand:stack_conversion if anyone wants to try out the feature I've been using this on my own installation and it's made my life much easier I was also thinking to maybe have a way to PR or commit a change, but that's for another PR |
|
I tried your branch to attach my "Untracked" stack (deployed from a previous portainer instance) to Git. I managed to make it work by cloning the git repo locally, "Adopt" the compose file to put the stack in the "Internal" state and then "Convert to Git". Thank you for your work |
Thanks for testing, Toto! This PR is for converting existing stacks into git/local stacks rather than adopting untracked stacks directly to git. Are you expecting these adopted stacks to live in the portainer data directory, or in the default dockhand location? To adopt the existing compose location you would need to first do a normal adoption to find the compose location, then convert to git, which is a better flow if you want to actually preserve the location If you don't care about location preservation and want to basically create a new stack in place to move it to dockhand, that is a good idea and I'll add it to the PR |
|
I did see that the button is on untracked stacks too, that was an error on my part, didn't test with untracked stacks. Rather than removing it though I'd like to implement this as I do have a few git stacks of my own I'd like to "move over" to dockhand from portainer's messy file structure |
Yes that's exactly my use case :) I can do this by hand (down the stack in portainer, re-create in dockhand), but it's time saver and less error prone for a lot of stacks. |
|
Yeah I have the same thing, though what I did was a script to export portainer data and a little html page to see it so I can copy and paste with portainer being off and all stacks down, but it really is annoying doing it manually. Will get it done and test |
|
@TheToto sorry for the delay. was busy with stuff This now works fine, I tried it myself on my own dockhand instance and I'm using it for now You can use the image I built directly for testing One issue is you still need to manually enter the env variables. Does that matter? |
|
Hey, |
9adc3e8 to
a46829f
Compare
a46829f to
1a83477
Compare
|
Rebased again as there were conflicts. @jotka when you have some time please let me know if anything else needs changed |
Proposed change
I wanted to convert stacks to git/local so I don't have to recreate them since that's painfully slow and annoying.


You can test by trying to convert your stacks between local and git. I tried this a bunch of times and it worked fine, but not sure for other complex configurations how it would be have.
Closes #636 possibly others too
Type of change