This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let datadogService = new infra.x.ecs.EC2Service("datadog-daemon", { | |
cluster: cluster, | |
schedulingStrategy: "DAEMON", | |
// if you don't assign the service a public IP, it wont be able to access the internet | |
// see https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task-networking.html#task-networking-considerations | |
networkConfiguration: { | |
assignPublicIp: true, | |
subnets: cluster.network.subnetIds | |
}, | |
taskDefinitionArgs: { | |
container: { | |
image: "datadog/agent:latest", | |
cpu: 10, | |
memory: 256, | |
essential: true, | |
portMappings: [ | |
{ | |
hostPort: 8126, | |
containerPort: 8126, | |
protocol: "tcp" | |
} | |
], | |
mountPoints: [ | |
{ | |
containerPath: "/var/run/docker.sock", | |
sourceVolume: "docker_sock", | |
readOnly: true | |
}, | |
{ | |
containerPath: "/host/sys/fs/cgroup", | |
sourceVolume: "cgroup", | |
readOnly: true | |
}, | |
{ | |
containerPath: "/host/proc", | |
sourceVolume: "proc", | |
readOnly: true | |
}], | |
environment: [ | |
{ | |
name: "DD_API_KEY", | |
value: "..." | |
}, | |
{ | |
name: "DD_LOG_LEVEL", | |
value: "debug" | |
}, | |
// this env var enabled Autodiscovery | |
{ | |
name: "SD_BACKEND", | |
value: "docker" | |
}, | |
// enables trace collection | |
// https://docs.datadoghq.com/integrations/amazon_ecs/?tab=nodejs#trace-collection | |
{ | |
name: "DD_APM_ENABLED", | |
value: "true" | |
}, | |
{ | |
name: "DD_APM_NON_LOCAL_TRAFFIC", | |
value: "true" | |
} | |
] | |
}, | |
volumes: [ | |
{ | |
name: "docker_sock", | |
hostPath: "/var/run/docker.sock" | |
}, | |
{ | |
name: "proc", | |
hostPath: "/proc/" | |
}, | |
{ | |
name: "cgroup", | |
hostPath: "/sys/fs/cgroup/" | |
} | |
], | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment