Hi, does anyone deploys on Azure as a Webservice? We deploy the fat jar on Azure but needs to stop, upload and restart the jar. During upload and start, the app is offline that makes it impossible to deploy during working hours. There is are slots which can be swapped, but i dont know it that would make sense to use.
Looking forward to get some experience of you guys :)
Sans Azure, what you are looking for here, is called “blue-green
deployment”. This means switching over from one serving
instance/cluster to another when you update. So for some time two
instances of your software are running and a front-facing proxy will do
the switch-over.
Yet running user sessions have their state stored in session and there
is a good chance, that a session will not survive the update. So to
keep running sessions working (although on the old version) you would
have to proxy those old sessions to the old version until all/most of
them phase out.
Thanks, already heared abeout blue-green. Found that i can create Slots which can be switched during runtime, but never tested what that really does.
I am using JWT in SecurityConfig, so when i restart the app, there is no login necassary (if the token has not expired).
setStatelessAuthentication(http,
new SecretKeySpec(Base64.getDecoder().decode(authSecret), JwsAlgorithms.HS256),
"app", 43200);
But if a user enters some date or selected something like ticked checkboxes, entered a name in a textfield or made a selection in a select-Component, this data are gone upon restart, but he keep being logged in, right?
I have tested using a deployment slot: the app will not restart when i swap the slots. But when i insert some text, swap the slots and klick a submit button, the view reloads and the data are gone. So it works almost, only the session is a problem this looks like its not swapped
What I meant with session is the UI state graph Vaadin uses to store the
representation of your client’s GUI on the server side. So auth is your
least problem here – if it’s stateless, it’s no problem, and if it’s
state-full its inside the same storage as your UI-state.
So unless you share a session-store between your instances (which brings
its own problems, like: properly working with transients, keeping
versions of classes straight, …) you can not share the state of your
blue and green instance. By default the state is kept in RAM and blue
and green would have their own, hence user-interactions are gone after
the roll-over.
But even if you already have a common session store in place and know
how do deal with this stuff (e.g. you are doing horizontal scaling),
then you would still have to battle with problems from the new version.
Chances are big, that a new version of your software would not be able
to restore the graph stored from an old version.
That’s why I suggested to keep the old version running for a while and
send the current users to this old version until you decide, or it runs
out of users, or … – e.g. sticky sessions in the proxy, but for old
users to the old instance, new ones to the new.
It depends on your requirements. What is the impact if the user loses the data she enters?
You could also monitor the user sessions and decide based on that when to redeploy. As Christoph mentioned session synchronization is hard stuff and I avoid it.
Currently the deployment takes place in the evening. The users are in 99% only using the app in working hours from 5am to 6pm. So the night is a good time to deploy.
The problem is, when i need to deploy a hotfix. We are testing every feature, want to implement Junit and so to avoid deploying bugs, but i think there is always the risk to deploy a bug, which needs to get fixed during working hours.
Maybe it would be a good idea to send a Push Message to all users “Attention, please safe yout work, the app will be restartet at 12:00”?
He will probaly loose data which were already entered. So nothing really losing, only double work if he needs to re enter the data.
Would be the new Signals Feature in 24.8.0 a good idea to use for this kind of Notification? Also could use Browser Notification, but therefore the users must subscribe to
Depending on your application, you might not even need push. If your
users often switch views, you could just make it part of the regular
server-side update. This works even better, if you are announce the
update “soon enough” and if you monitor usage and the bug is not that
severe, doing it e.g. in the middle of the day, when many users take
a break.
I’d not use notifications of any kind – make it non-volatile:
e.g. add it somewhere with a “warning”-styled span in the header, the
menu, the footer, so people notice it and they also can’t miss it, if
they return to entering data after a break or a phone-call.
And since you only want to notify the users once in the live-time of the
application, you can make it really simple:
add a singleton service, with an atomic, optional string (or some dumb
pojo with message, datetime, …)
inject that service in your layout class and listen for “after
navigation”; if there is a “message”, then build a component from it
and put in into the layout (do not use a singleton component:
components can not be shared)
add an admin- or management-endpoint, that allows setting or deleting
it from somewhere else (e.g. cli or your deployment-workflow); or add
some admin-only-gui