Service Dependency
If you have Flightcontrol services that require other services to be up and running before starting to deploy, you can configure Service Dependency.
A typical example would be to have a Next.js
frontend that uses getStaticProps
to read static content from another backend service like Wordpress
.
In order to add Service Dependency, you will need to configure your flightcontrol.json
using the example below as a guide.
Please note the following:
- You cannot add circular dependencies, where two services each depend on the other, your deployment will fail.
- You
dependsOn
array has to contain theid
of other services in the same environment, otherwise the deployment will fail.
{
"environments": [
{
"id": "webapp",
"name": "webapp",
"region": "us-east-1",
"source": {
"branch": "main"
},
"services": [
{
"id": "frontend",
"name": "nextjs",
"type": "web",
"target": {
"type": "fargate"
},
"buildType": "nixpacks",
"ci": {
"type": "ec2"
},
"cpu": 0.5,
"memory": 1,
"minInstances": 1,
"maxInstances": 1,
"dependsOn": ["backend"] //You can add one or multiple services to this array
},
{
"id": "backend",
"name": "wordpress",
"type": "web",
"target": {
"type": "fargate"
},
"buildType": "nixpacks",
"ci": {
"type": "ec2"
},
"cpu": 0.5,
"memory": 1,
"minInstances": 1,
"maxInstances": 1,
"dockerfilePath": "./Dockerfile",
"dockerfileContext": "."
}
]
}
]
}