https://prefect.io logo
Title
d

David Bokor

10/23/2021, 2:44 AM
I’m using Helm and Terraform to deploy Prefect on Kubernetes (AWS EKS). Since the service endpoints are generated dynamically on deployment, I can’t configure the UI’s default GraphQL URL to point to the Apollo endpoint when I install the helm chart. Currently, I have to manually go the the Prefect UI and set it - as would any user. I’d rather have the setup completely automated, if possible. Any help is appreciated.
c

Chu Lục Ninh

10/23/2021, 6:59 AM
Can you do the deployment with IaC tools like cloudformation or cdk/terraform. I believe you can set dependencies among services so you can wait for apollo server to get up, then UI service. There are so many ways you can consider. Like put apollo under alb, or deploy UI to S3 and edit config file in S3 each time apollo service endpoint changed
d

David Bokor

10/26/2021, 3:51 PM
Actually, it looks like I can call the following in Terraform:
resource "null_resource" "prefect_env" {
triggers = {
prefect_release        = try(module.prefect.release_information.metadata[0].name, "")
apollo_endpoint        = try(module.prefect.prefect_apollo_endpoint, "")
aws_region             = local.region
AWS_ACCESS_KEY_ID      = var.AWS_ACCESS_KEY_ID
AWS_SECRET_ACCESS_KEY  = var.AWS_SECRET_ACCESS_KEY
}
provisioner "local-exec" {
command = <<EOF
/usr/local/bin/aws configure set default.region ${self.triggers.aws_region};
/usr/local/bin/aws configure set aws_access_key_id '${self.triggers.AWS_ACCESS_KEY_ID}' ;
/usr/local/bin/aws configure set aws_secret_access_key '${self.triggers.AWS_SECRET_ACCESS_KEY}';
if [ -n '${self.triggers.prefect_release}' ]; then
/usr/bin/kubectl set env deployment/${self.triggers.prefect_release}-ui PREFECT_SERVER__APOLLO_URL="http://${self.triggers.apollo_endpoint}/graphql" ;
fi
EOF
}
depends_on = [
module.prefect
]
}