Starting Watchbot v10, the watchbot CLI can be installed from ecs-watchbot-binaries
bucket.
Update your Dockerfile with the following:
RUN wget https://s3.amazonaws.com/ecs-watchbot-binaries/linux/v2/watchbot -O /usr/local/bin/watchbot
RUN chmod +x /usr/local/bin/watchbot
Watchbot infrastructure is now created through CDK and runs exclusively ECS on Fragate.
- Install @mapbox/watchbot through npm or yarn in your CDK app
npm install --save-dev @mapbox/watchbot
- Use the
FargateConstruct
in your stack
import * as cdk from 'aws-cdk-lib';
import { FargateWatchbot } from "@mapbox/watchbot";
import { ArnUtility, GithubUtility } from '@mapbox/mapbox-cdk-common';
export class MyStack extends cdk.Stack {
constructor(scope: Construct, id: string, props: cdk.StackProps) {
super(scope, id, props);
// build docker image and upload to ECR. Ensure you are using MapboxDefaultSynthesizer from @mapbox/mapbox-cdk-common when creating this stack
const asset = new DockerImageAsset(this, 'MyBuildImage', {
directory: path.join(__dirname, 'my-image')
});
new FargateWatchbot(this, 'Watchbot', {
alarms: {
action: Topic.fromTopicArn(
this,
'OnCallTopic',
ArnUtility.getOncallArn('data-platform')
),
},
command: ['./run.py'],
serviceVersion: GithubUtility.getGitsha(),
image: ContainerImage.fromDockerImageAsset(asset),
serviceName: "random-service-name",
deploymentEnvironment: 'staging',
});
}
}
- Refer to the TSDoc in the construct itself for API changes.
- Remove
.artifacts.yml
file.- This is no longer needed as CDK will be bundling your docker image for you instead and pushing it to ECR.