Skip to content
This repository was archived by the owner on Oct 16, 2025. It is now read-only.

Commit dbd5036

Browse files
committed
scripts to deploy new admin tool over old
1 parent 4f5d615 commit dbd5036

2 files changed

Lines changed: 78 additions & 0 deletions

File tree

newadmin-config.sh

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
#!/bin/bash
2+
3+
DEPLOY_ENV=${1:-dev}
4+
5+
EXIT_ON_DIE=true
6+
source ~/.profile.d/uc3-aws-util.sh
7+
8+
# Check that the SSM_ROOT_PATH has been initialized
9+
check_ssm_root
10+
11+
# Assume deploy runs from DEV
12+
# Set ENV based on deploy env
13+
SSM_DEPLOY_PATH=${SSM_ROOT_PATH//dev/${DEPLOY_ENV}}
14+
AWS_ACCOUNT_ID=`aws sts get-caller-identity| jq -r .Account` || die "AWS Account Not Found"
15+
FUNCTNAME=uc3-mrt-admin-lambda
16+
17+
# Get the ARN for the lambda to publish
18+
LAMBDA_ARN_BASE=arn:aws:lambda:${AWS_REGION}:${AWS_ACCOUNT_ID}:function:uc3-mrt-admintool-img
19+
LAMBDA_ARN=${LAMBDA_ARN_BASE}-${DEPLOY_ENV}
20+
21+
if [ "${DEPLOY_ENV}" == "prd" ]
22+
then
23+
REP=
24+
else
25+
REP=-${DEPLOY_ENV}
26+
fi
27+
28+
ADMIN_ALB_URL=`get_ssm_value_by_name admintool/api-path`
29+
ADMIN_ALB_URL=${ADMIN_ALB_URL//-dev/${REP}}
30+
ECS_URL=`get_ssm_value_by_name admintool/ecs-${DEPLOY_ENV}`
31+
32+
COLLADMIN_ALB_URL=`get_ssm_value_by_name colladmin/api-path`
33+
COLLADMIN_ALB_URL=${COLLADMIN_ALB_URL//-dev/${REP}}
34+
35+
VARS="RACK_CONFIG=app/config_uc3.ru,MERRITT_ECS=lambda,SSM_ROOT_PATH=/uc3/mrt/dev/"
36+
37+
aws lambda update-function-configuration \
38+
--function-name ${LAMBDA_ARN} \
39+
--region us-west-2 \
40+
--output text \
41+
--timeout 360 \
42+
--memory-size 2500 \
43+
--ephemeral-storage "Size=2048" \
44+
--no-cli-pager \
45+
--environment "Variables={${VARS}}"
46+
47+
date

newadmin-deploy.sh

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
#!/bin/bash
2+
DEPLOY_ENV=dev
3+
EXIT_ON_DIE=true
4+
source ~/.profile.d/uc3-aws-util.sh
5+
6+
# Check that the SSM_ROOT_PATH has been initialized
7+
check_ssm_root
8+
9+
# Assume deploy runs from DEV
10+
# Set ENV based on deploy env
11+
SSM_DEPLOY_PATH=${SSM_ROOT_PATH//dev/${DEPLOY_ENV}}
12+
AWS_ACCOUNT_ID=`aws sts get-caller-identity| jq -r .Account` || die "AWS Account Not Found"
13+
14+
# Get the ARN for the lambda to publish
15+
LAMBDA_ARN_BASE=arn:aws:lambda:${AWS_REGION}:${AWS_ACCOUNT_ID}:function:uc3-mrt-admintool-img
16+
LAMBDA_ARN=${LAMBDA_ARN_BASE}-${DEPLOY_ENV}
17+
18+
# Get the ECR image to publish
19+
ECR_REGISTRY=${AWS_ACCOUNT_ID}.dkr.ecr.${AWS_REGION}.amazonaws.com
20+
UC3_ECR_REGISTRY=`get_ssm_value_by_name admintool/uc3-ecr-registry`
21+
ECR_IMAGE_TAG=${UC3_ECR_REGISTRY}/mrt-admin-sinatra:ecs-dev
22+
23+
# deploy lambda code
24+
aws lambda update-function-code \
25+
--function-name ${LAMBDA_ARN} \
26+
--image-uri ${ECR_IMAGE_TAG} \
27+
--output text --region us-west-2 \
28+
--no-cli-pager \
29+
|| die "Lambda Update failure"
30+
31+
date

0 commit comments

Comments
 (0)