Smooth redeployment of WAR in production?

前端 未结 6 1209
太阳男子
太阳男子 2021-02-20 05:53

I was wondering if there is a \'smooth way\' of redeploying a Java WAR to a production server (no cluster, no OSGi)?

All I can come up with is stop server, update file,

6条回答
  •  滥情空心
    2021-02-20 06:19

    As ZZ Coder has already mentioned load balancer is a good solution especially for big deployments. For my own project I use reverse http proxy functionality of nginx web server. It redirects all http packets from a specified web context (seen from the Internet) to a server inside my network. Configuration is really easy:

    location /best-app-ever/ { proxy_pass host-address:8080/some-app-1.1 root /home/www/some-app-1.1 }

    Switching version should be smooth as well. Assuming that you have already deployed new version of application just change nginx configuration file and apply changes:

    location /best-app-ever/ { proxy_pass host-address:8080/some-app-1.2 root /home/www/some-app-1.2 }

    sudo nginx -t
    sudo service nginx restart

    Be warned that in case your web application is stateful and/or contains some running or scheduled processes, the deployment and undeployment might not be as smooth.

提交回复
热议问题