Hey, we are trying to create a post-deployment sta...
# seed
y
Hey, we are trying to create a post-deployment stage on SEED that verifies that our app is healthy. We have a /health endpoint that returns 200 if healthy, but we need to figure out how to call that endpoint once the monorepo is deployed and fail the deployment if there's an error code. Is there a way to do this in SEED?
f
Hey @Yuval Ron, have you tried curling
/health
in a Post-Deploy Phase?
If the curl fails, the entire build will be marked as failed.
y
@Frank Thanks, looks like what I was looking for. I have a couple of questions: How do I resolve the deployed host url? I'll need to use it in the curl but I'm not sure which of the environment variables is providing it. Is there a way to apply this phase globally and automatically to all new deployments?
f
How do I resolve the deployed host url?
You can add the URL as a stack output named
HealthURL
. And in the Post Deploy phase you can look up the output value of
HeathURL
using AWS SDK and curl:
Copy code
echo "export HealthURL=$(aws cloudformation describe-stacks --stack-name my-stack --query 'Stacks[0].Outputs[?OutputKey==`HealthURL`].OutputValue | [0]' --output text)" >> $BASH_ENV
curl $HealthURL
Is there a way to apply this phase globally and automatically to all new deployments?
If you set up Post-Deploy Phase, it applies to all new deployments