I am writing the build scripts for my application and am wondering what is the best practice to deploy/release to test/prod environment.
Currently what I have is written is
I know its not the best way to deploy an app and would like your feedback. What I would ideally like to do is
I am confused whether this step 4 should be in Jenkins or on the servers. I am using EC2 instances for hosting the web application so my images need to have the script.
The first thing is that you are mixing build and deployment. I would suggest to do building via Maven. Deployment is a different story.
I would suggest to change your build in that way to produce with a single run in Jenkins or on command line artifacts which can be deployed in test and production.
I mean with producing artifacts making a release via Maven release plugin, cause you are delivering artifacts to test and/or prod which must be reproducible.
These are the thing producing the artifacts afterwards you have them within your repository manager (Artifactory, Archiva, Nexus) and the next step is to deploy them to the appropriate areas like test or production. This can be achieved by Maven via maven cargo plugin or tomcat plugin etc. or other plugins. But i would suggest to do this via different things like puppet, chef etc. or may be by home brewn scipts/tools. The scripts can be running via Jenkins without a problem (shouldn't be a problem). The deployment itself shouldn't be part of the building it should be made separately. If you are writing your own tools you could take a look at Aether library to make access to Maven repositories simpler.
In term of organization, you are mixing building and deploying, copying, ...
maven is a tool for building the archive when jenkins is an integration tool.
You should :
HIH M.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With