Optimal workflow for updating playframework application in production
Asked Answered
R

1

7

I am trying to come up with an optimal workflow for updating my web application running on play framework.

I use the start script to launch it but what is the best practice for updating the code so that it is as seamless as possible for the users?

In an Apache + PHP application often it is sufficient to drop new *.php files in the directory and in many cases the change is not even noticeable for the user.

Could you share your workflow for doing that with play framework?

Ryanryann answered 12/6, 2013 at 14:34 Comment(7)
Have you read the Apache as a front proxy to allow transparent upgrade of your application - section in the Play documentation or is that not what you're looking for?Coprolite
Of course this is some kind of a solution but I am not using Apache as a proxy at the moment. If this is the only option and cannot be done using only play built-in server I will go for Apache.Ryanryann
Without a front-end HTTP server, you're pretty much limited to: ctrl+d and re-running play start, as far as I know. To make it really seamless you would need Apache, Nginx, ... However if your application takes a really long time to compile, you could run a basic Play app that shows a under construction page while your other main app is compiling.Coprolite
@Coprolite It would be nice to hear a real deployment solution. Which are used in production. Where is building, what tool is upload to the server, which script unzip and starts a second instance of the application. Off site provides a manual deployment solution. Not the best.Aspectual
Hopefully you've figured out a solution in the meanwhile. I guess a good solution would be to build a war and deploy your play application on an app server. Or is this too much?Christiniachristis
We basically do what @Coprolite described, except we use an Amazon ELB instead of Apache. We take one Play instance out of the ELB, upgrade the app, put it back in the ELB, take the next Play instance out of the ELB, etc.Lust
I am glad that this discussion is alive again. I asked this question more than two years ago and since then wrote a bunch of scripts that allow me to update the application behind a reverse proxy but I am still not fully satisfied with the result. It would be great to see some well-tested solutions.Ryanryann
Z
0

The play framework is very different from using something like php on apache. Php is interpreted by Apache when a page is requested by a user. So all you need to do is change the file to update the site. With java however (unless you are using .jsp files and even sometimes then) the code is bytwise compiled and the webserver needs to load it and its libraries at start up. What this means is that just replacing newly compiled files will not work. You need to restart the web container or get it to reload the application to pick up the changes. This is always going to be noticeable to any users that try access the site at the same time as the reload is being completed.

You could have a web server (doesn't have to be Apache) that points to your current play installation as a proxy and bring up a new version of it in parallel and then switch your proxy webserver point to your new version and turn the old version off. This is probably the easiest way to do this and could be scripted.

Another way is to just have a web app that redirects the the user to the app and doing a parallel change similar to the one above.

Both of these options require some setup and coding to get them to work seamlessly. However the work is probably worth it as once you have it setup rollouts to production become very easy.

Zoe answered 27/8, 2015 at 4:48 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.