Created
May 22, 2011 15:18
-
-
Save avendasora/985566 to your computer and use it in GitHub Desktop.
Scripts to run as part of a Hudson job to Deploy applications built by a Hudson job to a specified WebObjects server running Project WOnder's wotaskd. These scripts should be saved in a subdirectory of the Hudson job's workspace directory.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| PROJECT=$1 | |
| BUILD_NUMBER=$2 | |
| BUILD_ID=$3 | |
| MONITOR_HOST=$4 | |
| MONITOR_PORT=$5 | |
| APP_ROOT=$6 | |
| WEB_ROOT=$7 | |
| echo " Create release directories" | |
| echo " mkdir -p ${APP_ROOT}/releases/${PROJECT}/${BUILD_NUMBER}_${BUILD_ID}" | |
| mkdir -p ${APP_ROOT}/releases/${PROJECT}/${BUILD_NUMBER}_${BUILD_ID} | |
| echo " mkdir -p ${WEB_ROOT}/releases/${PROJECT}/${BUILD_NUMBER}_${BUILD_ID}/" | |
| mkdir -p ${WEB_ROOT}/releases/${PROJECT}/${BUILD_NUMBER}_${BUILD_ID}/ | |
| echo " Copy artifacts to release directories" | |
| echo " cp /tmp/${PROJECT}-Application.tar.gz ${APP_ROOT}/releases/${PROJECT}/${BUILD_NUMBER}_${BUILD_ID}/" | |
| cp /tmp/${PROJECT}-Application.tar.gz ${APP_ROOT}/releases/${PROJECT}/${BUILD_NUMBER}_${BUILD_ID}/ | |
| echo " cp /tmp/${PROJECT}-WebServerResources.tar.gz ${WEB_ROOT}/releases/${PROJECT}/${BUILD_NUMBER}_${BUILD_ID}/" | |
| cp /tmp/${PROJECT}-WebServerResources.tar.gz ${WEB_ROOT}/releases/${PROJECT}/${BUILD_NUMBER}_${BUILD_ID}/ | |
| echo " Extract Archives" | |
| echo " tar -xzf ${APP_ROOT}/releases/${PROJECT}/${BUILD_NUMBER}_${BUILD_ID}/${PROJECT}-Application.tar.gz -C ${APP_ROOT}/releases/${PROJECT}/${BUILD_NUMBER}_${BUILD_ID}/" | |
| tar -xzf ${APP_ROOT}/releases/${PROJECT}/${BUILD_NUMBER}_${BUILD_ID}/${PROJECT}-Application.tar.gz -C ${APP_ROOT}/releases/${PROJECT}/${BUILD_NUMBER}_${BUILD_ID}/ | |
| echo " tar -xzf ${WEB_ROOT}/releases/${PROJECT}/${BUILD_NUMBER}_${BUILD_ID}/${PROJECT}-WebServerResources.tar.gz -C ${WEB_ROOT}/releases/${PROJECT}/${BUILD_NUMBER}_${BUILD_ID}/" | |
| tar -xzf ${WEB_ROOT}/releases/${PROJECT}/${BUILD_NUMBER}_${BUILD_ID}/${PROJECT}-WebServerResources.tar.gz -C ${WEB_ROOT}/releases/${PROJECT}/${BUILD_NUMBER}_${BUILD_ID}/ | |
| echo " Stop ${PROJECT}" | |
| echo " curl -# -d type=app -d name=${PROJECT} -X GET http://${MONITOR_HOST}:${MONITOR_PORT}/cgi-bin/WebObjects/JavaMonitor.woa/admin/stop" | |
| (curl -# -d type=app -d name=${PROJECT} -X GET http://${MONITOR_HOST}:${MONITOR_PORT}/cgi-bin/WebObjects/JavaMonitor.woa/admin/stop) | |
| echo "Wait 5 seconds for application to stop" | |
| sleep 5 | |
| echo " Relink Application Bundle" | |
| echo " rm ${APP_ROOT}/${PROJECT}.woa" | |
| rm ${APP_ROOT}/${PROJECT}.woa | |
| echo " ln -s ${APP_ROOT}/releases/${PROJECT}/${BUILD_NUMBER}_${BUILD_ID}/${PROJECT}.woa ${APP_ROOT}/" | |
| ln -s ${APP_ROOT}/releases/${PROJECT}/${BUILD_NUMBER}_${BUILD_ID}/${PROJECT}.woa ${APP_ROOT}/ | |
| echo " Relink WebServerResources Bundle" | |
| echo " rm ${WEB_ROOT}/${PROJECT}.woa" | |
| rm ${WEB_ROOT}/${PROJECT}.woa | |
| echo " ln -s ${WEB_ROOT}/releases/${PROJECT}/${BUILD_NUMBER}_${BUILD_ID}/${PROJECT}.woa ${WEB_ROOT}/" | |
| ln -s ${WEB_ROOT}/releases/${PROJECT}/${BUILD_NUMBER}_${BUILD_ID}/${PROJECT}.woa ${WEB_ROOT}/ | |
| echo " Start ${PROJECT}" | |
| echo " curl -# -d type=app -d name=${PROJECT} -X GET http://${MONITOR_HOST}:${MONITOR_PORT}/cgi-bin/WebObjects/JavaMonitor.woa/admin/start" | |
| (curl -# -d type=app -d name=${PROJECT} -X GET http://${MONITOR_HOST}:${MONITOR_PORT}/cgi-bin/WebObjects/JavaMonitor.woa/admin/start) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| echo "Copy up the server-side deployment script, we'll need it later." | |
| echo "scp ${WORKSPACE}/HudsonBuildFiles/WebObjectsLocalAppDeployerScript.sh ${WOTASKD_USER}@${WOTASKD_HOST}:/tmp/" | |
| scp ${WORKSPACE}/HudsonBuildFiles/WebObjectsLocalAppDeployerScript.sh ${WOTASKD_USER}@${WOTASKD_HOST}:/tmp/ | |
| # Get all the Projects that have been checked out as part of this deployment | |
| PROJECTS=`ls ${WORKSPACE}/../lastSuccessful/archive/Projects/` | |
| # Step through them to get the list of WO frameworks on their Classpath. | |
| for PROJECT in $PROJECTS; do | |
| # Check to see if this is a deployment of a single Application, if so, replace it with | |
| # the name of the application from the job parameters. | |
| if [ "$PROJECT" == "Application" ]; then | |
| PROJECT=${APPLICATION_NAME} | |
| fi | |
| echo "PROJECT: ${PROJECT}" | |
| echo "Copy ${PROJECT} Artifacts to Deployment Server /tmp directory" | |
| echo "scp ${WORKSPACE}/../lastSuccessful/archive/Projects/${PROJECT}/dist/${PROJECT}-Application.tar.gz ${WOTASKD_USER}@${WOTASKD_HOST}:/tmp/" | |
| scp ${WORKSPACE}/../lastSuccessful/archive/Projects/${PROJECT}/dist/${PROJECT}-Application.tar.gz ${WOTASKD_USER}@${WOTASKD_HOST}:/tmp/ | |
| echo "scp ${WORKSPACE}/../lastSuccessful/archive/Projects/${PROJECT}/dist/${PROJECT}-WebServerResources.tar.gz ${WOTASKD_USER}@${WOTASKD_HOST}:/tmp/" | |
| scp ${WORKSPACE}/../lastSuccessful/archive/Projects/${PROJECT}/dist/${PROJECT}-WebServerResources.tar.gz ${WOTASKD_USER}@$WOTASKD_HOST:/tmp/ | |
| echo "Connect to Deployment Server" | |
| echo "ssh ${WOTASKD_USER}@${WOTASKD_HOST} \"(/tmp/WebObjectsLocalAppDeployerScript.sh ${PROJECT} ${BUILD_NUMBER} ${BUILD_ID} ${MONITOR_HOST} ${MONITOR_PORT} ${APP_ROOT} ${WEB_ROOT})\"" | |
| ssh ${WOTASKD_USER}@${WOTASKD_HOST} "(/tmp/WebObjectsLocalAppDeployerScript.sh ${PROJECT} ${BUILD_NUMBER} ${BUILD_ID} ${MONITOR_HOST} ${MONITOR_PORT} ${APP_ROOT} ${WEB_ROOT})" | |
| done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment