From d68d39df506214c5dee7b2b788191cecedfc9215 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment?= Date: Tue, 7 Mar 2017 10:11:50 +0100 Subject: [PATCH 1/3] fix vhost name --- scripts/deploy.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/deploy.sh b/scripts/deploy.sh index af68477..51fa656 100755 --- a/scripts/deploy.sh +++ b/scripts/deploy.sh @@ -62,7 +62,7 @@ curl -X POST --header 'Content-Type: application/json' \ \"Image\": \"${REPO}/popcubeapi:$1\", \"Env\": [ \"VIRTUAL_NETWORK=nginx-proxy\", - \"VIRTUAL_HOST=alpha-api.popcube.xyz\", + \"VIRTUAL_HOST=api-alpha.popcube.xyz\", \"VIRTUAL_PORT=3000\" ], \"HostConfig\": { From bcb4e95659cd14cedafa3ce9f41dcd0b21115eee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment?= Date: Tue, 7 Mar 2017 11:34:20 +0100 Subject: [PATCH 2/3] add ssl for deployement --- scripts/deploy.sh | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/scripts/deploy.sh b/scripts/deploy.sh index 51fa656..2adcfb5 100755 --- a/scripts/deploy.sh +++ b/scripts/deploy.sh @@ -37,6 +37,8 @@ curl -X POST --header 'Content-Type: application/json' \ \"Env\": [ \"VIRTUAL_NETWORK=nginx-proxy\", \"VIRTUAL_HOST=docs-alpha.popcube.xyz\", + \"LETSENCRYPT_HOST=docs-alpha.popcube.xyz\", + \"LETSENCRYPT_EMAIL=contact@popcube.xyz\", \"VIRTUAL_PORT=4567\" ], \"Hostname\": \"popcube_alpha_docs\" }" \ @@ -63,6 +65,8 @@ curl -X POST --header 'Content-Type: application/json' \ \"Env\": [ \"VIRTUAL_NETWORK=nginx-proxy\", \"VIRTUAL_HOST=api-alpha.popcube.xyz\", + \"LETSENCRYPT_HOST=api-alpha.popcube.xyz\", + \"LETSENCRYPT_EMAIL=contact@popcube.xyz\", \"VIRTUAL_PORT=3000\" ], \"HostConfig\": { @@ -109,6 +113,16 @@ then echo "TAG and BRANCH is not compatible :(" exit 1 fi +if [ -z ${DEPLOY_TOKEN+x} ] || [ -z ${DEPLOY_URL+x} ]; +then + echo "#################################" + echo "############WARNING##############" + echo "#################################" + echo " DEPLOY_TOKEN is not SET" + echo " OR" + echo " DEPLOY_URL is not SET" + echo "#################################" +fi if [ ${TAG+x} ]; then echo "TAG is set to '$TAG'"; From 4df1ce91746e45e48228200c99936b21c4b6eae2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment?= Date: Mon, 13 Mar 2017 11:37:34 +0100 Subject: [PATCH 3/3] fix deployement --- scripts/deploy.sh | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/scripts/deploy.sh b/scripts/deploy.sh index ac4188a..440b214 100755 --- a/scripts/deploy.sh +++ b/scripts/deploy.sh @@ -17,7 +17,7 @@ function usage(){ echo "" } function install_docs_require() { - ./scripts/slate_require.sh + ./scripts/slate_require.sh } function build_images() { # First args is tags @@ -33,7 +33,7 @@ function push_images() { } function deployement() { -curl -X POST --header 'Content-Type: application/json' \ +OUTPUT=`curl -X POST --header 'Content-Type: application/json' \ --header "X-AUTH-TOKEN: ${DEPLOY_TOKEN}" -d \ "{ \"Image\": \"${REPO}/popcubedocs:$1\", @@ -45,9 +45,13 @@ curl -X POST --header 'Content-Type: application/json' \ \"VIRTUAL_PORT=4567\" ], \"Hostname\": \"popcube_alpha_docs\" }" \ - http://${DEPLOY_URL}/deploy; + http://${DEPLOY_URL}/deploy` -curl -X POST --header 'Content-Type: application/json' \ +if [[ ${OUTPUT} == *"Failed"* ]]; then + echo "${OUTPUT}" + exit 1 +fi +OUTPUT=`curl -X POST --header 'Content-Type: application/json' \ --header "X-AUTH-TOKEN: ${DEPLOY_TOKEN}" -d \ "{ \"Image\": \"${REPO}/popcubedb:$1\", @@ -58,10 +62,14 @@ curl -X POST --header 'Content-Type: application/json' \ \"MYSQL_DATABASE=popcube_dev\" ], \"Hostname\": \"popcube_alpha_database\" }" \ - http://${DEPLOY_URL}/deploy; + http://${DEPLOY_URL}/deploy` +if [[ ${OUTPUT} == *"Failed"* ]]; then + echo "${OUTPUT}" + exit 1 +fi # API BACK -curl -X POST --header 'Content-Type: application/json' \ +OUTPUT=`curl -X POST --header 'Content-Type: application/json' \ --header "X-AUTH-TOKEN: ${DEPLOY_TOKEN}" -d \ "{ \"Image\": \"${REPO}/popcubeapi:$1\", @@ -78,7 +86,11 @@ curl -X POST --header 'Content-Type: application/json' \ ] }, \"Hostname\": \"popcube_alpha_api\" }" \ - http://${DEPLOY_URL}/deploy; + http://${DEPLOY_URL}/deploy` +if [[ ${OUTPUT} == *"Failed"* ]]; then +echo "${OUTPUT}" +exit 1 +fi } if [ "$#" -eq 0 ]; then usage