Flightcontrol Build Runners
When you create a service that requires building, you need to choose a build runner to use. Currently, Flightcontrol supports these two runners:
- Flightcontrol EC2-based runner
- CodeBuild (Legacy build runner)
Flightcontrol EC2-based runner
The Flightcontrol EC2-based runner is a dedicated build server that runs the build for a single service. Hence it is super fast and optimized for the specific service. And because it is permanent and dedicated, cache is stored locally, allowing it to run 2-6x faster than other build systems. Also EC2 cost is cheaper than CodeBuild, which helps in reducing your overall AWS bill.
Flightcontrol EC2-based runner is designed to be a drop-in replacement to the legacy CodeBuild
runner. There is one main change. Flightcontrol no longer injects the enviornment variable
FC_GIT_COMMIT_SHA automatically, as its changing value leads to the cache getting invalidated each
build. If you need the commit sha during build, you can run this command instead git rev-parse HEAD
. FC_GIT_COMMIT_SHA
will continue to be available during runtime.
CodeBuild runner
Flightcontrol originally used CodeBuild to run the build phase. However, CodeBuild is a serverless platform resulting in a new server running for each build. This allows CodeBuild to run multiple builds at the same time, but it has very limited caching capabilities. Also it does not allow low-level customizations to the OS or docker builds.
Choosing Build Runner
Flightcontrol recommends everyone to use the new EC2-based runner, because of its faster builds and cheaper cost. But there might be situations where some users want to use the legacy CodeBuild runners. You can choose your build runner from the service Configuration tab in the dashboard, or by setting ci.type
property for the service if you are managing your configuration as IaC.
You can also select the EC2 instance type and storage. By default, Flightcontrol will choose an optimized 16vCPU/64GB instance type that is available in your region.
If you are using Flightcontrol dashboard to manage your services, click the service card in the dashboard, then select the “Config” tab, then choose “Builder type” under the “Build Configuration”
If you are using code to configure your environments, then you will need to add the new ci
block for each service.
{
"id": "preview-static-ui",
"name": "Storybook",
"type": "static",
"buildType": "nixpacks",
"ci": {
"type": "ec2" // or "codebuild"
},
"installCommand": "pnpm i --frozen-lockfile",
"buildCommand": "pnpm run build"
}
Optionally, if you want to specify a specific EC2 instance type for your service, you can add those two properties:
{
"ci": {
"type": "ec2",
"instanceSize": "c7a.4xlarge", //optional, leave it empty, or ensure the size is supported in your region
"instanceStorage": 30, // optional, 30GB by default
"storageIops": 3000, // optional, 3000 by default, higher values incur additional costs
"storageThroughput": 125 // optional, 125 by default, higher values incur additional costs
"storageType": "gp3" // or "gp2", "io1", "io2"
}
}