Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Variables file for send payment reminder ECS scheduled task #3543

Merged
merged 2 commits into from Feb 14, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 7 additions & 0 deletions config/env/experimental.send-payment-reminder.env
@@ -0,0 +1,7 @@
DB_IAM=true
DB_NAME=app
DB_PORT=5432
DB_SSL_MODE=verify-full
DB_SSL_ROOT_CERT=/bin/rds-ca-2019-root.pem
DB_USER=ecs_user
EMAIL_BACKEND=ses
7 changes: 7 additions & 0 deletions config/env/prod.send-payment-reminder.env
@@ -0,0 +1,7 @@
DB_IAM=true
DB_NAME=app
DB_PORT=5432
DB_SSL_MODE=verify-full
DB_SSL_ROOT_CERT=/bin/rds-ca-2019-root.pem
DB_USER=ecs_user
EMAIL_BACKEND=ses
7 changes: 7 additions & 0 deletions config/env/staging.send-payment-reminder.env
@@ -0,0 +1,7 @@
DB_IAM=true
DB_NAME=app
DB_PORT=5432
DB_SSL_MODE=verify-full
DB_SSL_ROOT_CERT=/bin/rds-ca-2019-root.pem
DB_USER=ecs_user
EMAIL_BACKEND=ses
46 changes: 40 additions & 6 deletions scripts/ecs-deploy-task-container
Expand Up @@ -22,22 +22,53 @@ readonly name=$1
readonly image=$2
readonly environment=$3

echo "Deploying ${name}"
readonly RESERVATION_CPU=256
readonly RESERVATION_MEM=512

task_def_arn=$("${DIR}/../bin/ecs-deploy" task-def\
echo "Checking for existence of variables file"

variables_file="${DIR}/../config/env/${environment}.${name}.env"
if [ ! -f "${variables_file}" ]; then
echo "Variables file '${variables_file}' does not exist!"
exit 1
fi

echo
echo "Preparing ECS task definition for ${name}"

"${DIR}/../bin/ecs-deploy" task-def \
--aws-account-id "${AWS_ACCOUNT_ID}" \
--aws-region "${AWS_DEFAULT_REGION}" \
--service app-tasks \
--environment "${environment}" \
--image "${image}" \
--cpu 256 \
--memory 512 \
--variables-file "${DIR}/../config/env/${environment}.${name}.env" \
--cpu "${RESERVATION_CPU}" \
--memory "${RESERVATION_MEM}" \
--variables-file "${variables_file}" \
--entrypoint "/bin/milmove-tasks ${name}" \
--dry-run | jq .

echo
echo "Registering ECS task definition for ${name}"

task_def_arn=$("${DIR}/../bin/ecs-deploy" task-def \
--aws-account-id "${AWS_ACCOUNT_ID}" \
--aws-region "${AWS_DEFAULT_REGION}" \
--service app-tasks \
--environment "${environment}" \
--image "${image}" \
--cpu "${RESERVATION_CPU}" \
--memory "${RESERVATION_MEM}" \
--variables-file "${variables_file}" \
--entrypoint "/bin/milmove-tasks ${name}" \
--register)

readonly task_def_arn
echo "Registered ${task_def_arn}"
echo
echo "Registered ECS task definition ${task_def_arn}"

echo
echo "Put new CloudWatch Event target for ${name}"

"${DIR}/../bin/ecs-deploy" put-target \
--aws-account-id "${AWS_ACCOUNT_ID}" \
Expand All @@ -46,3 +77,6 @@ echo "Registered ${task_def_arn}"
--name "${name}" \
--task-def-arn "${task_def_arn}" \
--put-target

echo
echo "Successfully put new CloudWatch Event target for ${name} with ECS task definition ${task_def_arn}"