Skip to content

Commit

Permalink
Merge pull request #10 from gloddy-dev/infra/#6
Browse files Browse the repository at this point in the history
[Fix]: 배포 오류 및 Datadog 설정 오류 해결
  • Loading branch information
jihwan2da authored Jan 15, 2024
2 parents bb39cb4 + 0333275 commit 0e5e9e2
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 16 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/DeployOnSTG.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ jobs:
run: chmod +x ./gradlew

- name: Build with Gradle
run: ./gradlew build
run: ./gradlew clean :bootstrap:bootJar

- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
Expand Down
9 changes: 3 additions & 6 deletions Dockerfile_STG
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
FROM openjdk:17.0-slim

EXPOSE 8080

ARG PROJECT_DIRECTORY=/build
WORKDIR $PROJECT_DIRECTORY

Expand All @@ -12,9 +10,8 @@ ENV TZ=Asia/Seoul

EXPOSE 8080

RUN apt-get update \
&& apt-get install -y wget \
RUN apt-get update && apt-get install -y curl wget \
&& wget -O dd-java-agent.jar 'https://dtdg.co/latest-java-tracer' \
&& 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", "-Ddd.profiling.enabled=true", "-XX:FlightRecorderOptions=stackdepth=256", "-Ddd.appsec.enabled=true", "-Ddd.iast.enabled=true", "-Ddd.logs.injection=true", "-Ddd.jmxfetch.enabled=true", "-Ddd.service=gloddy-community", "-Ddd.env=staging", "-jar", "app.jar"]
ENTRYPOINT ["sh", "-c", "export TOKEN=$(curl -X PUT \"http://169.254.169.254/latest/api/token\" -H \"X-aws-ec2-metadata-token-ttl-seconds: 21600\") && export DD_AGENT_HOST=$(curl -H \"X-aws-ec2-metadata-token: $TOKEN\" http://169.254.169.254/latest/meta-data/local-ipv4) && java -javaagent:dd-java-agent.jar -Ddd.profiling.enabled=true -XX:FlightRecorderOptions=stackdepth=256 -Ddd.appsec.enabled=true -Ddd.iast.enabled=true -Ddd.logs.injection=true -Ddd.jmxfetch.enabled=true -Ddd.service=gloddy-community -Ddd.env=staging -jar app.jar"]
60 changes: 51 additions & 9 deletions task-definition-stg.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"taskDefinitionArn": "arn:aws:ecs:ap-northeast-2:750773866215:task-definition/community-stg:3",
"taskDefinitionArn": "arn:aws:ecs:ap-northeast-2:750773866215:task-definition/community-stg:18",
"containerDefinitions": [
{
"name": "springboot",
Expand All @@ -25,7 +25,6 @@
],
"mountPoints": [],
"volumesFrom": [],
"ulimits": [],
"logConfiguration": {
"logDriver": "awslogs",
"options": {
Expand All @@ -41,8 +40,16 @@
"name": "community-datadog-agent-stg",
"image": "public.ecr.aws/datadog/agent:latest",
"cpu": 102,
"memory": 102,
"portMappings": [],
"memory": 200,
"portMappings": [
{
"name": "datadog-agent-8126-tcp",
"containerPort": 8126,
"hostPort": 8126,
"protocol": "tcp",
"appProtocol": "http"
}
],
"essential": false,
"environment": [
{
Expand All @@ -60,11 +67,27 @@
],
"environmentFiles": [
{
"value": "arn:aws:s3:::gloddy-env/env/datadog.env",
"value": "arn:aws:s3:::gloddy-env/env/ec2-datadog.env",
"type": "s3"
}
],
"mountPoints": [],
"mountPoints": [
{
"sourceVolume": "docker_sock",
"containerPath": "/var/run/docker.sock",
"readOnly": true
},
{
"sourceVolume": "cgroup",
"containerPath": "/host/sys/fs/cgroup",
"readOnly": true
},
{
"sourceVolume": "proc",
"containerPath": "/host/proc",
"readOnly": true
}
],
"volumesFrom": [],
"logConfiguration": {
"logDriver": "awslogs",
Expand All @@ -82,8 +105,27 @@
"taskRoleArn": "arn:aws:iam::750773866215:role/ec2-role-for-ec2",
"executionRoleArn": "arn:aws:iam::750773866215:role/ecsTaskExecutionRole",
"networkMode": "awsvpc",
"revision": 3,
"volumes": [],
"revision": 18,
"volumes": [
{
"name": "docker_sock",
"host": {
"sourcePath": "/var/run/docker.sock"
}
},
{
"name": "proc",
"host": {
"sourcePath": "/proc/"
}
},
{
"name": "cgroup",
"host": {
"sourcePath": "/sys/fs/cgroup/"
}
}
],
"status": "ACTIVE",
"requiresAttributes": [
{
Expand Down Expand Up @@ -130,7 +172,7 @@
"cpuArchitecture": "X86_64",
"operatingSystemFamily": "LINUX"
},
"registeredAt": "2024-01-10T10:22:08.410Z",
"registeredAt": "2024-01-15T11:27:46.602Z",
"registeredBy": "arn:aws:iam::750773866215:root",
"tags": []
}

0 comments on commit 0e5e9e2

Please sign in to comment.