forked from HHS/TANF-app
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop' into 2884-preparser-errors-multi-record-rows-w…
…rong-length-missing-space-filled-M3-Tribal-T3
- Loading branch information
Showing
80 changed files
with
1,353 additions
and
1,113 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
The elastic router and Kibana app are created using ```create-es-kibana.sh``` script. This script creates one elastic router and one kibana app per cloud space. | ||
The Kibana app will connect to the ES router, which connects to the ES service (created by terraform) at the space level. | ||
|
||
## Running create-es-kibana.sh | ||
This script accepts six inputs: | ||
1: Deploy strategy e.g.: rolling, initial, ... | ||
2: Space name e.g.: dev, staging, prod | ||
|
||
an example of deploying kibana and elastic for dev env: | ||
```./create-es-kibana.sh initial dev``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
#!/bin/bash | ||
|
||
############################## | ||
# Global Variable Decls | ||
############################## | ||
|
||
# The deployment strategy you wish to employ ( rolling update or setting up a new environment) | ||
DEPLOY_STRATEGY=${1} | ||
CF_SPACE=${2} # dev, staging, prod | ||
|
||
|
||
#The application name defined via the manifest yml for the frontend | ||
CGAPPNAME_KIBANA="tdp-kibana" | ||
CGAPPNAME_PROXY="tdp-elastic-proxy" | ||
|
||
|
||
strip() { | ||
# Usage: strip "string" "pattern" | ||
printf '%s\n' "${1##$2}" | ||
} | ||
# The cloud.gov space defined via environment variable (e.g., "tanf-dev", "tanf-staging") | ||
env=$(strip $CF_SPACE "tanf-") | ||
|
||
# Update the Kibana and Elastic proxy names to include the environment | ||
CGAPPNAME_KIBANA="${CGAPPNAME_KIBANA}-${env}" # tdp-kibana-staging, tdp-kibana-prod, tdp-kibana-dev | ||
CGAPPNAME_PROXY="${CGAPPNAME_PROXY}-${env}" # tdp-elastic-proxy-staging, tdp-elastic-proxy-prod, tdp-elastic-proxy-dev | ||
|
||
echo DEPLOY_STRATEGY: "$DEPLOY_STRATEGY" | ||
echo KIBANA_HOST: "$CGAPPNAME_KIBANA" | ||
echo ELASTIC_PROXY_HOST: "$CGAPPNAME_PROXY" | ||
echo CF_SPACE: "$CF_SPACE" | ||
echo env: "$env" | ||
|
||
|
||
update_kibana() | ||
{ | ||
cd ../tdrs-backend || exit | ||
|
||
# Run template evaluation on manifest | ||
# 2814: need to update this and set it to env instaead of app name | ||
yq eval -i ".applications[0].services[0] = \"es-${env}\"" manifest.proxy.yml | ||
yq eval -i ".applications[0].env.CGAPPNAME_PROXY = \"${CGAPPNAME_PROXY}\"" manifest.kibana.yml | ||
|
||
if [ "$1" = "rolling" ] ; then | ||
# Do a zero downtime deploy. This requires enough memory for | ||
# two apps to exist in the org/space at one time. | ||
cf push "$CGAPPNAME_PROXY" --no-route -f manifest.proxy.yml -t 180 --strategy rolling || exit 1 | ||
cf push "$CGAPPNAME_KIBANA" --no-route -f manifest.kibana.yml -t 180 --strategy rolling || exit 1 | ||
else | ||
cf push "$CGAPPNAME_PROXY" --no-route -f manifest.proxy.yml -t 180 | ||
cf push "$CGAPPNAME_KIBANA" --no-route -f manifest.kibana.yml -t 180 | ||
fi | ||
|
||
cf map-route "$CGAPPNAME_PROXY" apps.internal --hostname "$CGAPPNAME_PROXY" | ||
cf map-route "$CGAPPNAME_KIBANA" apps.internal --hostname "$CGAPPNAME_KIBANA" | ||
|
||
# Add network policy allowing Kibana to talk to the proxy and to allow the backend to talk to Kibana | ||
cf add-network-policy "$CGAPPNAME_KIBANA" "$CGAPPNAME_PROXY" --protocol tcp --port 8080 | ||
cd .. | ||
} | ||
|
||
############################## | ||
# Main script body | ||
############################## | ||
|
||
echo "Deploying Kibana and Elastic Proxy to $CF_SPACE" | ||
echo "Deploy strategy: $DEPLOY_STRATEGY" | ||
|
||
if [ "$DEPLOY_STRATEGY" = "rolling" ] ; then | ||
# Perform a rolling update for the backend and frontend deployments if | ||
# specified, otherwise perform a normal deployment | ||
update_kibana 'rolling' | ||
elif [ "$DEPLOY_STRATEGY" = "bind" ] ; then | ||
# Bind the services the application depends on and restage the app. | ||
echo "Deploying Kibana and Elastic Proxy to $CF_SPACE" | ||
elif [ "$DEPLOY_STRATEGY" = "initial" ]; then | ||
# There is no app with this name, and the services need to be bound to it | ||
# for it to work. the app will fail to start once, have the services bind, | ||
# and then get restaged. | ||
update_kibana | ||
elif [ "$DEPLOY_STRATEGY" = "rebuild" ]; then | ||
# You want to redeploy the instance under the same name | ||
# Delete the existing app (with out deleting the services) | ||
# and perform the initial deployment strategy. | ||
cf delete "$CGAPPNAME_KIBANA" -r -f | ||
cf delete "$CGAPPNAME_PROXY" -r -f | ||
update_kibana | ||
else | ||
# No changes to deployment config, just deploy the changes and restart | ||
update_kibana | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.