Pull deployment script for Windows
Prerequisites
-
Application use Java Service Wrapper.
-
Packaged as zip file
Download script - pseudo code
- Input version to deploy. Latest = "latest" Command line input windows
- Find latest version in repository Find latest version in NEXUS repo
- Compare version installed with latest. Text compare in Windows
- Do nothing (print info message to screen) if file name and file size is identical to current.
- Download zip file from Nexus Download latest Artifact from Nexus (/)
- Unzip
- Copy configuration folders from old service.
- Execute stop and uninstall service
- Execute install and start scripts/windows service see Download latest Artifact from Nexus
- Print success message with info about service name, port, jmx port, logs folder
- Improvement: stop new service and start previous service if start up failed (check exit code)
Full script
Download script - implementation tips
-
Use a version control system
- installation scripts
- installation property files
- binaries (curl, wget, etc)
- config_override
-
A single generic installation script for all installations.
-
A separate installation property file per installation
Download
Use wget or curl, should rely only on a single file, not on any installation. It is also possible to use powershell - http://superuser.com/questions/362152/native-alternative-to-wget-in-windows-powershell.
Resources
http://www.vectorsite.net/tsbatch.html
https://docs.sonatype.com/display/SPRTNXOSS/Nexus+FAQ#NexusFAQ-Q.HowcanIretrieveasnapshotifIdon%27tknowtheexactfilename%3F
http://mytechscratchpad.blogspot.no/2012/03/download-latest-snapshot-from-nexus.html
Downloading artifacts from Nexus with bash
http://en.wikibooks.org/wiki/Guide_to_Windows_commands
http://www.askapache.com/windows/advanced-batch-scripting.html#PARAMTESTHELP_show_params_returns_CALLer