Loading script/_check-deploy.sh +2 −2 Original line number Diff line number Diff line #!/bin/sh SERVICES_TO_CHECK="${SERVICES_TO_CHECK:-${SERVICE}}" SERVICES_TO_CHECK="${SERVICES_TO_CHECK:-${STACK:-${SERVICE}}}" for serviceToCheck in ${SERVICES_TO_CHECK}; for serviceToCheck in ${SERVICES_TO_CHECK} do checkDeployCmd="\ docker stack ls > /dev/null 2> /dev/null ; \ Loading script/_do-deploy.sh +2 −3 Original line number Diff line number Diff line #!/bin/sh deployCmd="\ cd ${SERVICE_HOME} && \ cd ${DEPLOY_HOME} && \ docker login -u gitlab-ci-token -p ${CI_JOB_TOKEN} ${CI_REGISTRY} && \ docker stack ls > /dev/null 2> /dev/null ; \ if [ \"\${?}\" -ne \"0\" ] ; \ Loading @@ -12,10 +12,9 @@ deployCmd="\ docker-compose up -d ${SERVICE} && \ rm ${DEFAULT_DEPLOY_FILES} ; \ else \ docker stack rm ${SERVICE} && \ composeFileSplitted=\$(echo ${COMPOSE_FILE} | sed 's/:/ -c /g') && \ env -i \$(grep -v '^#\\| ' .env | xargs) \ docker stack deploy -c \${composeFileSplitted} --prune --with-registry-auth ${SERVICE} && \ docker stack deploy -c \${composeFileSplitted} --prune --with-registry-auth ${STACK:-${SERVICE}} && \ rm ${DEFAULT_DEPLOY_FILES} ; \ fi\ " Loading script/_prepare-deploy.sh +8 −8 Original line number Diff line number Diff line #!/bin/sh # Se comprueba si se despliega desde dentro de 'deploy' o desde la raíz del proyecto. if [ -d "${DEPLOY_DIR_NAME}" ] ; if [ -d "${DEPLOY_DIR_NAME}" ] then cd "${DEPLOY_DIR_NAME}" deployFiles="-r ./." Loading @@ -11,8 +11,8 @@ fi # Los argumentos pasados (opcionales) se tratan como variables de entorno. # Se prepara el fichero .env para usarlas en la máquina destino y se setean en este entorno también. envDefs="SERVICE=${SERVICE}" for arg in "${@}"; envDefs="SERVICE=${SERVICE}\\nSTACK=${STACK}" for arg in "${@}" do export "${arg}" envDefs="${envDefs}\\n${arg}" Loading @@ -21,17 +21,17 @@ echo -e ${envDefs} >> .env # Antes de continuar, se comprueba que la configuración de despliegue sea válida. docker-compose config > /dev/null if [ "${?}" -ne "0" ] ; if [ "${?}" -ne "0" ] then echo -e "${FAIL_COLOR}Invalid docker-compose configuration!${NULL_COLOR}" exit 1 fi SERVICE_HOME="${DEPLOY_PATH}/docker/${SERVICE}" DEPLOY_HOME="${DEPLOY_PATH}/docker/${STACK:-${SERVICE}}" # Se crea el directorio donde guardar los ficheros de despliegue del servicio. CREATE_DIR_CMD="mkdir -p ${SERVICE_HOME}" ssh ${SSH_PARAMS} "${SSH_REMOTE}" ${CREATE_DIR_CMD} createDirCmd="mkdir -p ${DEPLOY_HOME}" ssh ${SSH_PARAMS} "${SSH_REMOTE}" ${createDirCmd} # Se envían a su destino los ficheros de despliegue del servicio. scp ${SSH_PARAMS} ${deployFiles} "${SSH_REMOTE}:${SERVICE_HOME}" scp ${SSH_PARAMS} ${deployFiles} "${SSH_REMOTE}:${DEPLOY_HOME}" script/_ssh-config.sh +2 −2 Original line number Diff line number Diff line Loading @@ -2,13 +2,13 @@ . _definitions.sh if [ -z "${SSH_REMOTE}" ] ; if [ -z "${SSH_REMOTE}" ] then echo -e "${FAIL_COLOR}You must define 'SSH_REMOTE' in environment, with remote user and hostname (like 'ssh-user@ssh-remote')${NULL_COLOR}" exit 1 fi if [ -z "${GITLAB_DEPLOY_KEY}" ] ; if [ -z "${GITLAB_DEPLOY_KEY}" ] then echo -e "${FAIL_COLOR}You must define 'GITLAB_DEPLOY_KEY' in environment, with a SSH private key accepted by remote server${NULL_COLOR}" exit 1 Loading script/create-nets.sh +2 −2 Original line number Diff line number Diff line Loading @@ -2,7 +2,7 @@ . _definitions.sh if [ "${#}" -lt "1" ] ; if [ "${#}" -lt "1" ] then echo -e "${FAIL_COLOR}One network name (at least) must be provided by parameters!${NULL_COLOR}" exit 1 Loading @@ -11,7 +11,7 @@ fi . _ssh-config.sh createNetsCmd="" for arg in "${@}"; for arg in "${@}" do createNetsCmd="${createNetsCmd}\${createNetCmd} ${arg}; " done Loading Loading
script/_check-deploy.sh +2 −2 Original line number Diff line number Diff line #!/bin/sh SERVICES_TO_CHECK="${SERVICES_TO_CHECK:-${SERVICE}}" SERVICES_TO_CHECK="${SERVICES_TO_CHECK:-${STACK:-${SERVICE}}}" for serviceToCheck in ${SERVICES_TO_CHECK}; for serviceToCheck in ${SERVICES_TO_CHECK} do checkDeployCmd="\ docker stack ls > /dev/null 2> /dev/null ; \ Loading
script/_do-deploy.sh +2 −3 Original line number Diff line number Diff line #!/bin/sh deployCmd="\ cd ${SERVICE_HOME} && \ cd ${DEPLOY_HOME} && \ docker login -u gitlab-ci-token -p ${CI_JOB_TOKEN} ${CI_REGISTRY} && \ docker stack ls > /dev/null 2> /dev/null ; \ if [ \"\${?}\" -ne \"0\" ] ; \ Loading @@ -12,10 +12,9 @@ deployCmd="\ docker-compose up -d ${SERVICE} && \ rm ${DEFAULT_DEPLOY_FILES} ; \ else \ docker stack rm ${SERVICE} && \ composeFileSplitted=\$(echo ${COMPOSE_FILE} | sed 's/:/ -c /g') && \ env -i \$(grep -v '^#\\| ' .env | xargs) \ docker stack deploy -c \${composeFileSplitted} --prune --with-registry-auth ${SERVICE} && \ docker stack deploy -c \${composeFileSplitted} --prune --with-registry-auth ${STACK:-${SERVICE}} && \ rm ${DEFAULT_DEPLOY_FILES} ; \ fi\ " Loading
script/_prepare-deploy.sh +8 −8 Original line number Diff line number Diff line #!/bin/sh # Se comprueba si se despliega desde dentro de 'deploy' o desde la raíz del proyecto. if [ -d "${DEPLOY_DIR_NAME}" ] ; if [ -d "${DEPLOY_DIR_NAME}" ] then cd "${DEPLOY_DIR_NAME}" deployFiles="-r ./." Loading @@ -11,8 +11,8 @@ fi # Los argumentos pasados (opcionales) se tratan como variables de entorno. # Se prepara el fichero .env para usarlas en la máquina destino y se setean en este entorno también. envDefs="SERVICE=${SERVICE}" for arg in "${@}"; envDefs="SERVICE=${SERVICE}\\nSTACK=${STACK}" for arg in "${@}" do export "${arg}" envDefs="${envDefs}\\n${arg}" Loading @@ -21,17 +21,17 @@ echo -e ${envDefs} >> .env # Antes de continuar, se comprueba que la configuración de despliegue sea válida. docker-compose config > /dev/null if [ "${?}" -ne "0" ] ; if [ "${?}" -ne "0" ] then echo -e "${FAIL_COLOR}Invalid docker-compose configuration!${NULL_COLOR}" exit 1 fi SERVICE_HOME="${DEPLOY_PATH}/docker/${SERVICE}" DEPLOY_HOME="${DEPLOY_PATH}/docker/${STACK:-${SERVICE}}" # Se crea el directorio donde guardar los ficheros de despliegue del servicio. CREATE_DIR_CMD="mkdir -p ${SERVICE_HOME}" ssh ${SSH_PARAMS} "${SSH_REMOTE}" ${CREATE_DIR_CMD} createDirCmd="mkdir -p ${DEPLOY_HOME}" ssh ${SSH_PARAMS} "${SSH_REMOTE}" ${createDirCmd} # Se envían a su destino los ficheros de despliegue del servicio. scp ${SSH_PARAMS} ${deployFiles} "${SSH_REMOTE}:${SERVICE_HOME}" scp ${SSH_PARAMS} ${deployFiles} "${SSH_REMOTE}:${DEPLOY_HOME}"
script/_ssh-config.sh +2 −2 Original line number Diff line number Diff line Loading @@ -2,13 +2,13 @@ . _definitions.sh if [ -z "${SSH_REMOTE}" ] ; if [ -z "${SSH_REMOTE}" ] then echo -e "${FAIL_COLOR}You must define 'SSH_REMOTE' in environment, with remote user and hostname (like 'ssh-user@ssh-remote')${NULL_COLOR}" exit 1 fi if [ -z "${GITLAB_DEPLOY_KEY}" ] ; if [ -z "${GITLAB_DEPLOY_KEY}" ] then echo -e "${FAIL_COLOR}You must define 'GITLAB_DEPLOY_KEY' in environment, with a SSH private key accepted by remote server${NULL_COLOR}" exit 1 Loading
script/create-nets.sh +2 −2 Original line number Diff line number Diff line Loading @@ -2,7 +2,7 @@ . _definitions.sh if [ "${#}" -lt "1" ] ; if [ "${#}" -lt "1" ] then echo -e "${FAIL_COLOR}One network name (at least) must be provided by parameters!${NULL_COLOR}" exit 1 Loading @@ -11,7 +11,7 @@ fi . _ssh-config.sh createNetsCmd="" for arg in "${@}"; for arg in "${@}" do createNetsCmd="${createNetsCmd}\${createNetCmd} ${arg}; " done Loading