Skip to content

Commit

Permalink
Merge remote-tracking branch 'refs/remotes/origin/issue-30-secureAPI'
Browse files Browse the repository at this point in the history
Conflicts:
	scripts/deploy.sh
  • Loading branch information
titouanfreville committed Mar 14, 2017
2 parents 5faf442 + e676f57 commit 7201931
Showing 1 changed file with 38 additions and 9 deletions.
47 changes: 38 additions & 9 deletions scripts/deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -33,19 +33,25 @@ 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\",
\"Env\": [
\"VIRTUAL_NETWORK=nginx-proxy\",
\"VIRTUAL_HOST=docs-alpha.popcube.xyz\",
\"LETSENCRYPT_HOST=docs-alpha.popcube.xyz\",
\"[email protected]\",
\"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\",
Expand All @@ -56,26 +62,39 @@ 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\",
\"Env\": [
\"VIRTUAL_NETWORK=nginx-proxy\",
\"VIRTUAL_HOST=alpha-api.popcube.xyz\",
\"VIRTUAL_PORT=3000\",
\"MYSQL_DATABASE=popcube_dev\"
\"MYSQL_PASSWORD=test\",
\"MYSQL_ROOT_PASSWORD=popcube_dev\",
\"MYSQL_USER=test_user\",
\"MYSQL_DATABASE=popcube_dev\",
\"VIRTUAL_HOST=api-alpha.popcube.xyz\",
\"LETSENCRYPT_HOST=api-alpha.popcube.xyz\",
\"[email protected]\"
],
\"HostConfig\": {
\"Links\": [
\"/popcube_alpha_database:/popcube_alpha_api/database\"
]
},
\"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
Expand Down Expand Up @@ -113,6 +132,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'";
Expand Down

0 comments on commit 7201931

Please sign in to comment.