Skip to content
This repository has been archived by the owner on Mar 7, 2018. It is now read-only.

Commit

Permalink
Merge pull request #116 from CatalystCode/create-site
Browse files Browse the repository at this point in the history
Call GraphQL createSite during deployment
  • Loading branch information
c-w committed Aug 17, 2017
2 parents 56aee65 + 00eee29 commit e8f9eac
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 2 deletions.
3 changes: 2 additions & 1 deletion fortis-deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -268,4 +268,5 @@ chmod 752 create-cluster.sh
"${app_insights_id}" \
"${site_name}" \
"${eh_conn_str}" \
"${sb_conn_str}"
"${sb_conn_str}" \
"${site_type}"
6 changes: 5 additions & 1 deletion ops/create-cluster.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ readonly app_insights_id="$6"
readonly site_name="$7"
readonly eh_conn_str="$8"
readonly sb_conn_str="$9"
readonly site_type="${10}"

chmod -R 752 .

Expand All @@ -34,7 +35,7 @@ echo "Finished. Now deploying"
./deis-apps/fortis-interface/deploy-app.sh
echo "Finished. Now installing DEIS feature service"
./deis-apps/feature-service/create-app.sh
echo "Finished."
echo "Finished. Now deploying"
./deis-apps/feature-service/deploy-app.sh

sleep 10
Expand All @@ -59,6 +60,9 @@ readonly feature_service_host="http://feature-service.${DEIS_ROUTER_HOST_ROOT}.n
readonly fortis_central_directory="https://fortiscentral.blob.core.windows.net/"
readonly spark_config_map_name="spark-master-conf"

echo "Finished. Now setting up site entry"
./create-site.sh "${graphql_service_host}" "${site_name}" "${site_type}"

echo "Finished. Installing cassandra cqlsh cli."
./storage-ddls/install-cassandra-ddls.sh "${cassandra_host}"
kubectl create -f ./spark-namespace.yaml
Expand Down
48 changes: 48 additions & 0 deletions ops/create-site.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
#!/usr/bin/env bash

readonly graphql_service_host="$1"
readonly site_name="$2"
readonly site_type="$3"

if ! (command -v python >/dev/null); then sudo apt-get install -y python; fi

cat << EOF | python | curl "${graphql_service_host}/api/settings" -d@- -H "Content-Type: application/json"
#
# parameters included from bash via variable interpolation
#
siteType = '${site_type}'
name = '${site_name}'
#
# python script to format graphql json request body
#
import json
import sys
query = '''mutation {
createSite(
input: {
siteType: "%s",
targetBbox: [],
defaultZoomLevel: 0,
logo: "",
title: "",
name: "%s",
defaultLocation: [],
storageConnectionString: "",
mapzenApiKey: "",
fbToken: "",
supportedLanguages: []
}
) { name }
}''' % (
siteType,
name,
)
payload = {
'query': query,
}
print(json.dumps(payload))
EOF

0 comments on commit e8f9eac

Please sign in to comment.