-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #91 from Team-SilverTown/feature
🦾 개발 서버 배포
- Loading branch information
Showing
170 changed files
with
10,277 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
FROM localstack/localstack:3.2 | ||
LABEL authors="ASak1104" | ||
|
||
COPY --chown=localstack ./init-aws.sh /etc/localstack/init/ready.d/init-aws.sh | ||
COPY --chown=localstack ./policy.json /etc/localstack/json/policy.json | ||
|
||
RUN chmod u+x /etc/localstack/init/ready.d/init-aws.sh |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#!/usr/bin/env bash | ||
|
||
awslocal s3api create-bucket \ | ||
--bucket images | ||
awslocal s3api put-bucket-policy \ | ||
--bucket images \ | ||
--policy file:///etc/localstack/json/policy.json |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
{ | ||
"taskDefinitionArn": "arn:aws:ecs:ap-northeast-2:533267244952:task-definition/masilgasil-ecs-task:1", | ||
"containerDefinitions": [ | ||
{ | ||
"name": "masilgasil-ecs-container", | ||
"image": "533267244952.dkr.ecr.ap-northeast-2.amazonaws.com/masilgasil-ecr-private:latest", | ||
"cpu": 0, | ||
"portMappings": [ | ||
{ | ||
"name": "masilgasil-ecs-container-port", | ||
"containerPort": 8080, | ||
"hostPort": 8080, | ||
"protocol": "tcp", | ||
"appProtocol": "http" | ||
} | ||
], | ||
"essential": true, | ||
"environment": [], | ||
"environmentFiles": [], | ||
"mountPoints": [], | ||
"volumesFrom": [], | ||
"ulimits": [], | ||
"logConfiguration": { | ||
"logDriver": "awslogs", | ||
"options": { | ||
"awslogs-create-group": "true", | ||
"awslogs-group": "/ecs/masilgasil-ecs-task", | ||
"awslogs-region": "ap-northeast-2", | ||
"awslogs-stream-prefix": "ecs" | ||
}, | ||
"secretOptions": [] | ||
}, | ||
"systemControls": [] | ||
} | ||
], | ||
"family": "masilgasil-ecs-task", | ||
"taskRoleArn": "arn:aws:iam::533267244952:role/ecsTaskExecutionRole", | ||
"executionRoleArn": "arn:aws:iam::533267244952:role/ecsTaskExecutionRole", | ||
"networkMode": "awsvpc", | ||
"revision": 1, | ||
"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": "com.amazonaws.ecs.capability.task-iam-role" | ||
}, | ||
{ | ||
"name": "ecs.capability.execution-role-ecr-pull" | ||
}, | ||
{ | ||
"name": "com.amazonaws.ecs.capability.docker-remote-api.1.18" | ||
}, | ||
{ | ||
"name": "ecs.capability.task-eni" | ||
}, | ||
{ | ||
"name": "com.amazonaws.ecs.capability.docker-remote-api.1.29" | ||
} | ||
], | ||
"placementConstraints": [], | ||
"compatibilities": [ | ||
"EC2", | ||
"FARGATE" | ||
], | ||
"requiresCompatibilities": [ | ||
"FARGATE" | ||
], | ||
"cpu": "1024", | ||
"memory": "3072", | ||
"runtimePlatform": { | ||
"cpuArchitecture": "X86_64", | ||
"operatingSystemFamily": "LINUX" | ||
}, | ||
"registeredAt": "2024-03-04T12:31:29.939Z", | ||
"registeredBy": "arn:aws:iam::533267244952:user/team-01", | ||
"tags": [] | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
{ | ||
"Version": "2012-10-17", | ||
"Statement": [ | ||
{ | ||
"Sid": "PublicReadGetObject", | ||
"Effect": "Allow", | ||
"Principal": "*", | ||
"Action": [ | ||
"s3:GetObject" | ||
], | ||
"Resource": [ | ||
"arn:aws:s3:::images/*" | ||
] | ||
} | ||
] | ||
} |
Validating CODEOWNERS rules …
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# This is a comment. | ||
# Each line is a file pattern followed by one or more owners. | ||
|
||
# These owners will be the default owners for everything in | ||
# the repo. Unless a later match takes precedence, | ||
# @ASak1104 @shoeone96 and @IjjS will be requested for | ||
# review when someone opens a pull request. | ||
* @Team-SilverTown/Backend |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
--- | ||
name: "⚙️ Refactoring" | ||
about: Refacoring 내용을 입력해주세요. | ||
title: "⚙️ Refactoring" | ||
labels: ⚙️ Refactoring | ||
assignees: '' | ||
|
||
--- | ||
|
||
# Issue: ⚙️ Refactoring | ||
|
||
## Description | ||
|
||
<!--수정이 필요한 내용--> | ||
|
||
## To do | ||
|
||
<!--수정될 내용--> | ||
|
||
- [ ] todo | ||
|
||
## ETC | ||
|
||
<!--기타사항--> |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
--- | ||
name: "✅ Feature" | ||
about: Feature 요구 사항을 입력해주세요. | ||
title: "✅ Feature" | ||
labels: ✅ Feature | ||
assignees: '' | ||
|
||
--- | ||
|
||
# Issue: ✅ Feature | ||
|
||
## Description | ||
|
||
<!--필요한 기능--> | ||
|
||
## To do | ||
|
||
<!--추가될 내용--> | ||
|
||
- [ ] todo | ||
|
||
## ETC | ||
|
||
<!--기타사항--> |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
## 🎫 관련 이슈 | ||
|
||
<!--이슈 태스크를 모두 완료하고 닫는다면 * Resolves #번호--> | ||
<!--이슈 태스크를 모두 완료하지는 못 했지만 닫는다면 * Closes #번호--> | ||
<!--열어둔다면 * #번호--> | ||
|
||
## 🚀 주요 변경사항 | ||
|
||
<!--빠른 리뷰를 위해 이해를 도울 만한 설명을..--> | ||
|
||
## 💡 기타사항 | ||
|
||
<!-- ex) 질문. 이후에 이런걸 할거고 또한 지금은 이러한 이유 때문에 이런걸 작업했다. 의존성, 추후해야할 일 등등--> |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
name: Deploy dev API to Amazon ECS | ||
|
||
on: | ||
push: | ||
branches: [ "dev" ] | ||
|
||
permissions: | ||
contents: read | ||
|
||
env: | ||
AWS_REGION: ap-northeast-2 | ||
CONTAINER_NAME: masilgasil-ecs-container | ||
ECR_REPOSITORY: masilgasil-ecr-private | ||
ECS_CLUSTER: masilgasil-ecs-cluster | ||
ECS_SERVICE: masilgasil-ecs-service-dev | ||
ECS_TASK_DEFINITION: .aws/masilgasil-ecs-task-revision1.json | ||
ACTIVE_PROFILE: prod | ||
SERVER_PORT: 8080 | ||
|
||
jobs: | ||
job: | ||
name: Deploy dev API | ||
runs-on: ubuntu-latest | ||
environment: dev | ||
steps: | ||
- name: 체크 아웃 | ||
uses: actions/checkout@v3 | ||
|
||
- name: JDK 17 설치 | ||
uses: actions/setup-java@v3 | ||
with: | ||
java-version: '17' | ||
distribution: 'corretto' | ||
|
||
- name: AWS credentials 설정 | ||
uses: aws-actions/configure-aws-credentials@v1 | ||
with: | ||
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | ||
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | ||
aws-region: ${{ env.AWS_REGION }} | ||
|
||
- name: application.yml 오버라이드 | ||
uses: microsoft/variable-substitution@v1 | ||
with: | ||
files: ./src/main/resources/application.yml | ||
env: | ||
server.port: ${{ env.SERVER_PORT }} | ||
cors.service-origin: ${{ secrets.SERVICE_ORIGIN }} | ||
|
||
spring.datasource.username: ${{ secrets.MYSQL_USERNAME }} | ||
spring.datasource.password: ${{ secrets.MYSQL_PASSWORD }} | ||
spring.datasource.url: ${{ secrets.MYSQL_URL }} | ||
|
||
spring.cloud.aws.credentials.accessKey: ${{ secrets.AWS_ACCESS_KEY_ID }} | ||
spring.cloud.aws.credentials.secretKey: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | ||
spring.cloud.aws.region.static: ${{ env.AWS_REGION }} | ||
spring.cloud.aws.s3.bucket: ${{ secrets.AWS_S3_IMAGE_BUCKET }} | ||
spring.cloud.aws.s3.endpoint: ${{ secrets.AWS_S3_IMAGE_ENDPOINT }} | ||
|
||
jwt.issuer: ${{ secrets.TOKEN_ISSUER }} | ||
jwt.base64-secret: ${{ secrets.TOKEN_SECRET }} | ||
jwt.token-validity-in-seconds: ${{ secrets.TOKEN_EXPIRATION }} | ||
|
||
- name: 프로젝트 빌드 | ||
uses: gradle/gradle-build-action@67421db6bd0bf253fb4bd25b31ebb98943c375e1 | ||
with: | ||
arguments: clean build | ||
env: | ||
SPRING_PROFILES_ACTIVE: ${{ env.ACTIVE_PROFILE }} | ||
|
||
- name: Amazon ECR 로그인 | ||
id: login-ecr | ||
uses: aws-actions/amazon-ecr-login@v1 | ||
|
||
- name: docker 이미지 업로드 | ||
id: build-image | ||
env: | ||
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }} | ||
IMAGE_TAG: latest | ||
PROFILE: ${{ env.ACTIVE_PROFILE }} | ||
run: | | ||
docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG --build-arg PROFILE=$PROFILE . | ||
docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG | ||
echo "image=$ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG" >> $GITHUB_OUTPUT | ||
- name: Amazon ECS task definition 이미지 설정 | ||
id: task-def | ||
uses: aws-actions/amazon-ecs-render-task-definition@v1 | ||
with: | ||
task-definition: ${{ env.ECS_TASK_DEFINITION }} | ||
container-name: ${{ env.CONTAINER_NAME }} | ||
image: ${{ steps.build-image.outputs.image }} | ||
|
||
- name: Amazon ECS task definition 배포 | ||
uses: aws-actions/amazon-ecs-deploy-task-definition@v1 | ||
with: | ||
task-definition: ${{ steps.task-def.outputs.task-definition }} | ||
service: ${{ env.ECS_SERVICE }} | ||
cluster: ${{ env.ECS_CLUSTER }} | ||
wait-for-service-stability: true |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
name: Java CI with Gradle | ||
|
||
on: | ||
pull_request: | ||
|
||
permissions: | ||
contents: read | ||
pull-requests: write | ||
|
||
jobs: | ||
build: | ||
environment: build | ||
|
||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: 체크 아웃 | ||
uses: actions/checkout@v4 | ||
|
||
- name: AWS credentials 설정 | ||
uses: aws-actions/configure-aws-credentials@v1 | ||
with: | ||
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | ||
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | ||
aws-region: ap-northeast-2 | ||
|
||
- name: JDK 17 설치 | ||
uses: actions/setup-java@v4 | ||
with: | ||
java-version: '17' | ||
distribution: 'corretto' | ||
|
||
- name: Gradle 권한 부여 | ||
run: chmod +x gradlew | ||
|
||
- name: 프로젝트 빌드 | ||
run: ./gradlew clean build | ||
|
||
- name: Jacoco 테스트 결과 출력 | ||
id: jacoco | ||
uses: madrapps/[email protected] | ||
with: | ||
title: 📑 Jacoco 테스트 결과 | ||
paths: ${{ github.workspace }}/**/build/reports/jacoco/test/jacocoTestReport.xml | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
min-coverage-overall: 50 | ||
min-coverage-changed-files: 50 | ||
update-comment: true |
Oops, something went wrong.