abra app deploy handles re-deploy and shows env updates
#712
Reference in New Issue
Block a user
No description provided.
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Hey all, this is my first issue here so please take it easy on me 😅
Issue
This caught me by surprise as the docs do not mention how to deal with config-only changes, but talk about managing secrets.
I automatically assumed that config would be treated the same as secrets: change it, and deploy 🙏
But
abra app deploy myapp.example.comjust says there's nothing new to deploy 💀👉I found
--force -fthough and have been using that flag since, but it doesn't feel "right"?Expected behaviour
My ideal DX (developer experience) would be:
app config ..app deploy ...envchanges in summary (ideally what vars changed, but just a mention of "config updates" suffices for now!).envand simply restarts the service (if that's the best way to do it?)This approach keeps the Dev aware of what they're doing & why the app is being deployed.
It also gives peace of mind because you're always wondering "did that just work?" seeing the config diff or at least "config has changed" will do the trick 💯
PS: while my expertise is predominantly JS-based, I'm happy to hack my way thru this enhancement, likely with a bit of guidance 😊
What do we all think? 🤔
Thanks for raising @pharaohgraphy 👋
I have a feeling you might be referring to "config" as "env vars"? Docker swarm has the concept of configs on it's own and if these change, they are shown in the deployment overview since #657.
So, to summarise, and correct me if wrong:
-ffromabra app deployabra app deploydo what-fdoes and just re-deploy (credit also @p4u1)I think this seems doable. @3wordchant do you have some wisdom for this as the person who implemented the "show changes" functionality. I have a slight worry the overview get's too crowded but OTOH, we do not show things that don't change?
The docker swarm runtime will update the container/env/etc. for us, no restart required.
Sounds like an very good idea, simplifying the CLI interface and increasing the amount of useful information that is shown on deploy overview. Thanks for bringing this up! New perspectives on the using the tool are very valuable 🙏 🫶
"app deploy" should work if config (.env) for the app has changedto `abra app deploy` handles re-deploy and shows env updatesWhile working on our automation, we realised that it would still be nice to have the -f flag for the case that no input changed but we still want tp redeploy.
Default behaviour:
With
-f:This way we can run ´abra app deploy --no-input` in our automation and detect when no changes were detected and nothing had to be redeployed
@decentral1se you're correct, the confusion stems from the fact that Abra calls it
configbut Docker is just injecting Env vars... not sure it's worth renaming, it would be a breaking change 🤷@p4u1 I agree, we should keep
-fit's a useful escape-hatch in general.I will note this though, I've noticed more than just a couple times that mutating an env var via
abra app config ...then running a forced deploy can often ADD the env var with the new value to the Docker service, but it DOES NOT remove the old one..I had to go on the server itself a few times to manually do:
docker service ... --env-rm "MY_ENV"then re-add it manually viadocker service ... --env-add ...I want to flag this now, because I have a feeling this will become an issue if we don't address it properly, I'm unsure how Abra does most things under the hood, so forgive me for potentially missing important context on this. 😅
FWIW: This has been a hindrance for testing new apps and more importantly for hacking away at recipes, it has slowed down my productivity significantly enough to be an issue
That's true, we just append and don't care what is already added on:
.Config.EnvAFAIU since theDockerfileorcompose.ymlmight specify additional env vars thatabrawon't gather from the.envfile... so removing stuff might break something else... do you see a way to resolve this?@p4u1 would you parse the output or should we be adding a
-moutput forabra app deploy? Trying to satisfy Ansible with output parsing that might change through different versions might be a recipe for pain. It might make sense to break out a separate issue for idempotency inabrafor automation tools 🤔@decentral1se My 2c is Abra should be 'smarter' about this rather than gung-ho, here's what I envision SHOULD work based on what I've tried manually in the server's CLI via
docker service ..commands:abra app env ...and updates the env file locally then saves itabra app deploy ....envand server's.env, it finds the names of the vars that have been mutateddocker service ... --env-rm ...for all the env vars that have mutateddocker service ... --env-add ...for all the new values of the env vars mutatedThis ensures we don't destroy env vars injected outside of Abra, this is how I've done it manually and it seems to work just fine for all the apps that I've tried. 🤷