Best way to remove an application


Hello ,

currently i have to do multiple testing on my charm because it contain a jar file written in java , so whenever i mad a change in my code , i have to remove the app and the machine then I need to redeploy everything.

my question here , is there a was to remove the app only and keep the same machine with same IP and redeployed my app without having to get another machine with new IP ?


There is “juju remove-application” or “juju remove-unit” or just “juju upgrade-charm” to run new version of the charm. (and then juju deploy --to MACHINE_ID to redeploy the charm to the same machine)
If it makes sense you could include your ‘jar’ as a named resource of the charm, which would allow you to “juju attach” new versions of the jar without having to deploy/touch the charm code.

However, removing a unit runs the charm’s Stop hook, so if that isn’t implemented (many charms don’t) it will leave the app around and running, so it might not actually do what you want.