Configuring Scheduler Services with flightcontrol.json
In addition to the Service Configuration attributes that are common to all services, the following attributes are specific to worker services.
If you are using pre-built docker images with the Image Registry feature, or building using a
Custom Docker image, make sure not to add an ENTRYPOINT
with a long running command. If you want
to purpose the same image for other services like a web server, make sure to use CMD
for your
web server start command.
Scheduler Service Attributes
The type for all web server services is fargate-scheduler
, and should be specified like the following:
type: 'fargate-scheduler'
In addition, there are several other attributes that are specific to worker services:
Jobs
startCommand: string
- Example:
"startCommand": "php artisan run:billing-cycle"
- Supported values: the string for the command, the command will be executed from the context of the application directory
- The command should gracefully exit upon success with exit code
0
, otherwise the execution will be marked as failed
schedule: string
- Example:
"schedule": "* * 1 * *"
- Supported values:
- Cron-like string:
* * * * *
, you can use crontab guru (opens in a new tab) to design or test your schedule - Manually triggered job or command:
manual
- Cron-like string:
- Schedule is used to define the interval of running this job or to mark the job as manual and runs on demand
cpu: number
- Example:
"cpu": 0.25
- Supported values:
0.25, 0.5, 1, 2, 4
- This is the AWS
vCPU
unit for each service instance. It does not correspond to number of cores. It’s an abstract unit of CPU power defined by Amazon - For more details, see AWS’s Fargate pricing page (opens in a new tab)
memory: int
- Example:
"memory": 1
- Supported values:
- With
cpu: 0.25
-0.5, 1, 2
- With
cpu: 0.5
-1...4
(int) - With
cpu: 1
-2...8
(int) - With
cpu: 2
-4...16
(int) - With
cpu: 4
-8...30
(int)
- With
- Memory can be in GB or MB for each service instance
- For more details, see AWS’s Fargate pricing page (opens in a new tab)
timezone: string
- Example:
"timezone": "America/New_York"
- Optional with default:
"UTC"
- Supports any of the available timezones here (opens in a new tab).
timeout: int
- Example:
"timeout": 10
- Timeout is in minutes
- Optional with default:
480
- Supported values:
1...1440
Container Insights
containerInsights: boolean
- Example:
"containerInsights": true
- Optional with default:
false
- Enables AWS Container Insights (opens in a new tab) for your service. This will send metrics to CloudWatch for your service. For more, see our Container Insights guide.
From Service
fromService: string
- If using
buildType: fromService
, this is the ID of the service that you wish to use the image for.
Container Image
containerImage: object
-
containerImage defines the parameters needed when using
buildType: fromRepository
registryId: string
- Example:
"registryId": "ecr-9l03731"
- Registry ID, you can find this on the Registries page in our dashboard
repository: string
- Example:
"repository": "node:18-slim"
- This is the URI of the image repository you wish to access
tag?: string
- Example:
"tag": "latest"
- Optional
- This is the tag of the image from the repository that you would like to use
- Example:
Runtime-only Environment variables
includeEnvVariablesInBuild: boolean
- Example:
"includeEnvVariablesInBuild": false
- Optional with default:
true
- Enables runtime-only environment variables - see the Configuring Environment Variables page for more details.
Integrations
integrations: object
Under the integrations
key, you can configure integrations with third-party services. At this time, the only supported integration is with Sentry (opens in a new tab).
Upload Sentry Source Maps
uploadSentrySourceMap: boolean
- Example:
"integrations": { "uploadSentrySourceMap": true }
- Optional with default:
false
- Enables uploading source maps to Sentry. This is useful for debugging errors in production. For more, see our Sentry guide.
Sidecars
sidecars: array
- Example:
"sidecars": [
{
"name": "open-telemetry-collector",
"image": "otel/opentelemetry-collector-contrib:0.83.0",
"cpuAllotment": 0.1,
"memoryAllotment": 0.25,
"enableNetworking": true,
"ports": [4318]
}
]
- Optional with default:
[]
- Enables sidecars for your service. For more, see our sidecars guide.
For each individual sidecar, you can configure the following attributes:
- name - The name of the sidecar container.
- image - The URL to the image for the sidecar container.
- cpuAllotment - The absolute amount of CPU to allocate to the sidecar container. In
vCPU
units. For example,0.25
would be 1/4 of a vCPU. - memoryAllotment - The absolute amount of memory to allocate to the sidecar container. In
GB
units. For example,0.5
would be 1/2 of a GB. - enableNetworking - Whether to enable networking for the sidecar container. Defaults to
true
. - ports - An array of ports to expose from the sidecar container. Defaults to
[]
. - envVariables - An object of environment variables to set in the sidecar container. Defaults to
{}
. You can use the same rules for environment variables as you would for your main container. - dockerLabels - An object of Docker labels to set in the sidecar container. Defaults to
{}
.
Extra options for Nixpacks
basePath?: string
- Allows you to specify in which folder the commands should run
- Example:
"basePath": "./apps"
- Optional, defaults to "./"
installCommand: string
- Example:
"installCommand": "./install.sh"
- Optional, intelligent default based on your language and framework detected at the
basePath
- What we use to install dependencies for your build
buildCommand: string
- Example:
"buildCommand": "blitz build"
- Optional, intelligent default based on your language and framework detected at the
basePath
- What we use to build your app
postBuild: string
- Example:
"postBuild": "./postbuild.sh"
- Optional, Empty by Default
- Used as a build hook to run any operation after your build is complete
Extra options for custom Dockerfile only
dockerfilePath: string
- Example:
"dockerfilePath": "packages/web/Dockerfile"
- Relative path to the Dockerfile from your repo root
- It’s recommended to use
ENTRYPOINT
instead ofCMD
for your start command - You can authenticate with Docker Hub by adding your Docker Hub credentials as
DOCKER_USERNAME
andDOCKER_PASSWORD
environment variables. If these env variables are present, we’ll rundocker login
with them. This will prevent Docker Hub rate limit issues.
dockerContext: string
- Example:
"dockerContext": "packages/web"
- Optional with default:
"."
(repo root) - Relative path to the docker context from the repo root
- It’s recommended to use
ENTRYPOINT
instead ofCMD
for your start command