Best practices for deploying Java webapps with minimal downtime?

前端 未结 18 2053
我在风中等你
我在风中等你 2021-01-29 18:28

When deploying a large Java webapp (>100 MB .war) I\'m currently use the following deployment process:

  • The application .war file is expanded locally on the develop
18条回答
  •  耶瑟儿~
    2021-01-29 18:51

    I'm not sure if this answers your question, but I'll just share on the deployment process I use or encounter in the few projects I did.

    Similiar to you, I do not ever recall making a full war redeployment or update. Most of the time, my updates are restricted to a few jsp files, maybe a library, some class files. I am able to manage and determine which are the affected artifacts, and usually, we packaged those update in a zip file, along with an update script. I will run the update script. The script does the following:

    • Backup the files that will be overwritten, maybe to a folder with today's date and time.
    • Unpackage my files
    • Stop the application server
    • Move the files over
    • Start the application server

    If downtime is a concern, and they usually are, my projects are usually HA, even if they are not sharing state but using a router that provide sticky session routing.

    Another thing that I am curious would be, why the need to rsync? You should able to know what are the required changes, by determining them on your staging/development environment, not performing delta checks with live. In most cases, you would have to tune your rsync to ignore files anyway, like certain property files that define resources a production server use, like database connection, smtp server, etc.

    I hope this is helpful.

提交回复
热议问题