Skip to content

Commit

Permalink
Update deploy script for ease of use
Browse files Browse the repository at this point in the history
  • Loading branch information
arlowatts committed Nov 30, 2023
1 parent 14c857d commit fc65f6d
Showing 1 changed file with 54 additions and 12 deletions.
66 changes: 54 additions & 12 deletions tools/helm/deploy.sh
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

0 comments on commit fc65f6d

Please sign in to comment.