-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update deploy script for ease of use
- Loading branch information
Showing
1 changed file
with
54 additions
and
12 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 |
---|---|---|
@@ -1,19 +1,61 @@ | ||
#!/bin/bash | ||
#!/usr/bin/env bash | ||
|
||
environment=prd | ||
ocEnvironment=prod | ||
license="d027a8" | ||
helmCommand=upgrade | ||
# Deploys changes to a PPM API environment's infrastructure in OpenShift | ||
# | ||
# Usage: | ||
# deploy.sh COMMAND ENVIRONMENT | ||
# | ||
# Substitute COMMAND for the Helm command to be applied. | ||
# Substitute ENVIRONMENT for the three-letter name of the PPM API environment to be deployed. The environments are dev, tr1, vs1, vc1, vc2, and prd. | ||
# | ||
# Author: Arlo Watts | ||
# Date: 2023-30-11 | ||
|
||
helmCommand=$1 | ||
environment=$2 | ||
|
||
# Set the namespace according to the environment | ||
if [ "$environment" = "dev" ]; then | ||
namespace="2f77cb-dev" | ||
|
||
elif [ "$environment" = "tr1" ]; then | ||
namespace="2f77cb-test" | ||
|
||
elif [ "$environment" = "vs1" ]; then | ||
namespace="2f77cb-test" | ||
|
||
elif [ "$environment" = "vc2" ]; then | ||
namespace="2f77cb-test" | ||
|
||
elif [ "$environment" = "vc1" ]; then | ||
namespace="d027a8-test" | ||
|
||
elif [ "$environment" = "prd" ]; then | ||
namespace="d027a8-prod" | ||
echo "You are making changes to the live production environment of a critical health application. Type DEPLOY TO PRODUCTION to proceed." | ||
read confirm && [ "$confirm" = "DEPLOY TO PRODUCTION" ] || exit 1 | ||
|
||
else | ||
echo "\"${environment}\" is not a recognized environment." | ||
echo | ||
echo "Usage:" | ||
echo " deploy.sh COMMAND ENVIRONMENT" | ||
echo | ||
echo "Substitute COMMAND for the Helm command to be applied." | ||
echo "Substitute ENVIRONMENT for the three-letter name of the PPM API environment to be deployed. The environments are dev, tr1, vs1, vc1, vc2, and prd." | ||
exit 1 | ||
fi | ||
|
||
# Points to tools/helm | ||
BASEDIR=$(dirname $0) | ||
basedir=$(dirname $0) | ||
|
||
services=('common' 'claimservice' 'consentservice' 'locationservice' 'medicationdispenseservice' 'medicationrequestservice' 'medicationservice' 'medicationstatementservice' 'patientservice' 'practitionerservice') | ||
# The list of services | ||
services=("claim" "consent" "location" "medicationdispense" "medicationrequest" "medication" "medicationstatement" "patient" "practitioner") | ||
|
||
helmScripts=('common' 'ppmservice' 'ppmservice' 'ppmservice' 'ppmservice' 'ppmservice' 'ppmservice' 'ppmservice' 'ppmservice' 'ppmservice') | ||
# Deploy the common secrets that each PPM API service references | ||
helm $helmCommand -n $namespace -f ${basedir}/config/common/${environment}-values.yaml common-${environment} ${basedir}/common | ||
|
||
for i in "${!services[@]}"; do | ||
service=${services[$i]} | ||
helmScript=${helmScripts[$i]} | ||
helm ${helmCommand} -n ${license}-${ocEnvironment} -f ${BASEDIR}/config/${service}/${environment}-values.yaml ${service}-${environment} ${BASEDIR}/${helmScript} | ||
# Deploy the PPM API services | ||
for service in ${services[@]}; do | ||
helm $helmCommand -n $namespace -f ${basedir}/config/${service}service/${environment}-values.yaml ${service}service-${environment} ${basedir}/ppmservice | ||
done |