From 181ef81fb2d82531cd6e93680130984556f87050 Mon Sep 17 00:00:00 2001 From: jihwan2da Date: Mon, 16 Oct 2023 17:03:53 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20Datadog=20=EC=84=A4=EC=A0=95=20(ECS)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .aws/task-definition.json | 58 +++++++++++++++++++++++++++++++++++---- Dockerfile_prd | 7 ++++- 2 files changed, 58 insertions(+), 7 deletions(-) diff --git a/.aws/task-definition.json b/.aws/task-definition.json index 97fe6c52..25551397 100644 --- a/.aws/task-definition.json +++ b/.aws/task-definition.json @@ -1,10 +1,11 @@ { - "taskDefinitionArn": "arn:aws:ecs:ap-northeast-2:750773866215:task-definition/gloddy-prd-spring-task-test:7", + "taskDefinitionArn": "arn:aws:ecs:ap-northeast-2:750773866215:task-definition/gloddy-prd-spring-task-test:18", "containerDefinitions": [ { "name": "springboot", "image": "750773866215.dkr.ecr.ap-northeast-2.amazonaws.com/gloddy-prd:latest", - "cpu": 0, + "cpu": 768, + "memory": 1024, "portMappings": [ { "name": "springboot-8080-tcp", @@ -24,19 +25,61 @@ ], "mountPoints": [], "volumesFrom": [], - "ulimits": [] + "logConfiguration": { + "logDriver": "awslogs", + "options": { + "awslogs-create-group": "true", + "awslogs-group": "/ecs/gloddy-prd-spring-task", + "awslogs-region": "ap-northeast-2", + "awslogs-stream-prefix": "ecs" + }, + "secretOptions": [] + } + }, + { + "name": "datadog-agent", + "image": "public.ecr.aws/datadog/agent:latest", + "cpu": 203, + "memory": 512, + "portMappings": [ + { + "name": "datadog-agent-8126-tcp", + "containerPort": 8126, + "hostPort": 8126, + "protocol": "tcp" + } + ], + "essential": false, + "environment": [], + "environmentFiles": [ + { + "value": "arn:aws:s3:::gloddy-env/env/datadog.env", + "type": "s3" + } + ], + "mountPoints": [], + "volumesFrom": [] } ], "family": "gloddy-prd-spring-task-test", "executionRoleArn": "arn:aws:iam::750773866215:role/ecsTaskExecutionRole", "networkMode": "awsvpc", - "revision": 7, + "revision": 18, "volumes": [], "status": "ACTIVE", "requiresAttributes": [ + { + "name": "com.amazonaws.ecs.capability.logging-driver.awslogs" + }, + { + "name": "ecs.capability.execution-role-awslogs" + }, { "name": "com.amazonaws.ecs.capability.ecr-auth" }, + { + "name": "com.amazonaws.ecs.capability.docker-remote-api.1.19" + }, { "name": "ecs.capability.env-files.s3" }, @@ -48,6 +91,9 @@ }, { "name": "ecs.capability.task-eni" + }, + { + "name": "com.amazonaws.ecs.capability.docker-remote-api.1.29" } ], "placementConstraints": [], @@ -59,12 +105,12 @@ "FARGATE" ], "cpu": "1024", - "memory": "3072", + "memory": "2048", "runtimePlatform": { "cpuArchitecture": "X86_64", "operatingSystemFamily": "LINUX" }, - "registeredAt": "2023-09-13T15:12:56.673Z", + "registeredAt": "2023-10-16T07:41:48.083Z", "registeredBy": "arn:aws:iam::750773866215:root", "tags": [] } \ No newline at end of file diff --git a/Dockerfile_prd b/Dockerfile_prd index 003a7c93..50b9d8e4 100644 --- a/Dockerfile_prd +++ b/Dockerfile_prd @@ -8,4 +8,9 @@ WORKDIR %PROJECT_DIRECTORY ARG JAR_FILE_PATH=build/libs/server-0.0.1-SNAPSHOT.jar COPY ${JAR_FILE_PATH} app.jar -ENTRYPOINT ["java", "-jar", "app.jar"] \ No newline at end of file +RUN apt-get update \ + && apt-get install -y wget \ + && rm -rf /var/lib/apt/lists/* +RUN wget -O dd-java-agent.jar https://dtdg.co/latest-java-tracer + +ENTRYPOINT ["java", "-javaagent:dd-java-agent.jar", "-XX:FlightRecorderOptions=stackdepth=256", "-Ddd.appsec.enabled=true", "-Ddd.iast.enabled=true", "-Ddd.logs.injection=true", "-Ddd.service=gloddy", "-Ddd.env=production", "-jar", "app.jar"] \ No newline at end of file