diff --git a/ontrack-delivery/Operations.md b/ontrack-delivery/Operations.md index 67abf313887..a9136f2551b 100644 --- a/ontrack-delivery/Operations.md +++ b/ontrack-delivery/Operations.md @@ -178,7 +178,7 @@ In all cases, you'll have the following structure: 4. Start and connect to the `ontrack-data` volumes: - docker run -it --volumes-from ontrack-data ubuntu:14.04 /bin/bash + docker run -it --volumes-from ontrack-data --volume /root/migration:/migration ubuntu:14.04 /bin/bash 5. And execute the following commands: @@ -189,7 +189,7 @@ In all cases, you'll have the following structure: 6. Clean the container list - docker rm $(docker ps -l | grep ubuntu | awk "{print \$1}") + docker rm $(docker ps -l | grep ubuntu | awk '{print $1}') 7. Remove the `ontrack` old container: @@ -197,13 +197,13 @@ In all cases, you'll have the following structure: 8. Recreate the `ontrack` container from your favourite version: - docker run -d --name ontrack- --volumes-from ontrack-data nemerosa/ontrack: + docker run -d --name ontrack-$VERSION --volumes-from ontrack-data nemerosa/ontrack:$VERSION 9. Recreate the Nginx container: docker run -d \ --publish 443:443 \ - --link ontrack-:ontrack \ + --link ontrack-$VERSION:ontrack \ --volume /root/nginx/certs:/etc/nginx/certs \ --volume /root/nginx/sites-enabled:/etc/nginx/sites-enabled \ dockerfile/nginx diff --git a/ontrack-delivery/production-update.sh b/ontrack-delivery/production-update.sh index e967dee1ff5..bafb699a5c8 100755 --- a/ontrack-delivery/production-update.sh +++ b/ontrack-delivery/production-update.sh @@ -57,25 +57,37 @@ echo "[PRODUCTION] Version = ${VERSION}" # Removes the Nginx container -NGINX_CID=`docker ps | grep "dockerfile/nginx" | awk "{print \$1}"` -docker stop ${NGINX_CID} -docker rm ${NGINX_CID} +echo "[PRODUCTION] Stopping Nginx container..." +NGINX_CID=`docker ps | grep "dockerfile/nginx" | awk '{print $1}'` +if [ "${NGINX_CID}" != "" ] +then + docker stop ${NGINX_CID} + docker rm ${NGINX_CID} +fi # Stops the old version of Ontrack -docker stop $(docker ps docker ps | grep "nemerosa/ontrack" | awk "{print \$1}") +echo "[PRODUCTION] Stopping Ontrack container..." +ONTRACK_CID=`docker ps docker ps | grep "nemerosa/ontrack" | awk '{print $1}'` +if [ "${ONTRACK_CID}" != "" ] +then + docker stop ${ONTRACK_CID} +fi # Backup of the data +echo "[PRODUCTION] Backuping Ontrack data..." TIMESTAMP=`date +%F-%T` docker run --volumes-from ontrack-data --volume /root:/backup ubuntu tar czvf /backup/backup-${TIMESTAMP}.tgz /opt/ontrack/mount # Installs the new version of Ontrack +echo "[PRODUCTION] Starting new Ontrack version ${VERSION}..." docker run -d --name ontrack-${VERSION} --volumes-from ontrack-data nemerosa/ontrack:${VERSION} # Recreate the Nginx container: +echo "[PRODUCTION] Starting the Nginx proxy container..." docker run -d \ --publish 443:443 \ --link ontrack-${VERSION}:ontrack \ @@ -83,4 +95,5 @@ docker run -d \ --volume /root/nginx/sites-enabled:/etc/nginx/sites-enabled \ dockerfile/nginx -# End \ No newline at end of file +# End +echo "[PRODUCTION] End of deployment."