From 1a99710c1679efac206d12c5b5e33dad106c9291 Mon Sep 17 00:00:00 2001 From: Eric Lipe Date: Fri, 15 Nov 2024 13:36:49 -0500 Subject: [PATCH] - update deploy script to get sendgrid api key from backend to template into alertmanager config - Update manifest to pull alertmanager binary and start it --- tdrs-backend/plg/alertmanager/manifest.yml | 11 ++++++++--- tdrs-backend/plg/deploy.sh | 5 +++++ 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/tdrs-backend/plg/alertmanager/manifest.yml b/tdrs-backend/plg/alertmanager/manifest.yml index 80067f717..fee3420e7 100644 --- a/tdrs-backend/plg/alertmanager/manifest.yml +++ b/tdrs-backend/plg/alertmanager/manifest.yml @@ -1,10 +1,15 @@ version: 1 applications: - name: alertmanager - memory: 512M - disk_quota: 1G + memory: 128M + disk_quota: 5G instances: 1 command: | - mkdir /tmp + mkdir data + wget https://github.com/prometheus/alertmanager/releases/download/v0.27.0/alertmanager-0.27.0.linux-amd64.tar.gz + tar -zxvf alertmanager-0.27.0.linux-amd64.tar.gz + mv alertmanager-0.27.0.linux-amd64 alertmanager + rm -rf alertmanager-0.27.0.linux-amd64.tar.gz + ./alertmanager --config.file=/home/vcap/app/alertmanager.prod.yml --storage.path=/home/vcap/app/data --log.level=debug --web.external-url=http://alertmanager.apps.internal:8080/alerts --web.route-prefix=/alerts --cluster.listen-address="" buildpacks: - https://github.com/cloudfoundry/binary-buildpack diff --git a/tdrs-backend/plg/deploy.sh b/tdrs-backend/plg/deploy.sh index 988f85b26..62a0420be 100755 --- a/tdrs-backend/plg/deploy.sh +++ b/tdrs-backend/plg/deploy.sh @@ -103,6 +103,10 @@ deploy_loki() { deploy_alertmanager() { pushd alertmanager + CONFIG=alertmanager.prod.yml + cp alertmanager.yml $CONFIG + SENDGRID_API_KEY=$(cf env tdp-backend-prod | grep SENDGRID | cut -d " " -f2-) + yq eval -i ".global.smtp_auth_password = \"$SENDGRID_API_KEY\"" $CONFIG cf push --no-route -f manifest.yml -t 180 --strategy rolling cf map-route alertmanager apps.internal --hostname alertmanager @@ -118,6 +122,7 @@ deploy_alertmanager() { done cf add-network-policy alertmanager $PROD_FRONTEND --protocol tcp --port 80 cf add-network-policy $PROD_FRONTEND alertmanager -s tanf-prod --protocol tcp --port 8080 + rm $CONFIG popd }