Skip to content

Commit

Permalink
Merge pull request #138 from survey-mate/main
Browse files Browse the repository at this point in the history
hotfix 반영
  • Loading branch information
JinhyeokFang authored Feb 15, 2024
2 parents cc8d7e7 + 393af25 commit 1ea7484
Show file tree
Hide file tree
Showing 8 changed files with 176 additions and 145 deletions.
145 changes: 72 additions & 73 deletions .aws/task-definition.json
Original file line number Diff line number Diff line change
@@ -1,95 +1,94 @@
{
"taskDefinitionArn": "arn:aws:ecs:ap-northeast-2:768517383807:task-definition/survey-mate-task:31",
"taskDefinitionArn": "arn:aws:ecs:ap-northeast-2:768517383807:task-definition/survey-mate-task:59",
"containerDefinitions": [
{
"name": "survey-mate-container",
"image": "768517383807.dkr.ecr.ap-northeast-2.amazonaws.com/survey-mate-ecr:latest",
"cpu": 0,
"portMappings": [
{
"name": "survey-mate-container-80-tcp",
"containerPort": 80,
"hostPort": 80,
"protocol": "tcp",
"appProtocol": "http"
}
],
"essential": true,
"environment": [],
"environmentFiles": [
{
"value": "arn:aws:s3:::survey-mate-code-deploy-bucket/.env",
"type": "s3"
}
],
"mountPoints": [],
"volumesFrom": [],
"ulimits": [],
"logConfiguration": {
"logDriver": "awslogs",
"options": {
"awslogs-create-group": "true",
"awslogs-group": "/ecs/",
"awslogs-region": "ap-northeast-2",
"awslogs-stream-prefix": "ecs"
},
"secretOptions": []
}
{
"name": "survey-mate-container",
"image": "768517383807.dkr.ecr.ap-northeast-2.amazonaws.com/survey-mate-ecr:f38776524c173fd97c5cf19828f065cc532769be",
"cpu": 0,
"portMappings": [
{
"name": "survey-mate-container-80-tcp",
"containerPort": 80,
"hostPort": 80,
"protocol": "tcp",
"appProtocol": "http"
}
],
"essential": true,
"environment": [],
"environmentFiles": [
{
"value": "arn:aws:s3:::survey-mate-code-deploy-bucket/.env",
"type": "s3"
}
],
"mountPoints": [],
"volumesFrom": [],
"logConfiguration": {
"logDriver": "awslogs",
"options": {
"awslogs-create-group": "true",
"awslogs-group": "/ecs/",
"awslogs-region": "ap-northeast-2",
"awslogs-stream-prefix": "ecs"
},
"secretOptions": []
}
}
],
"family": "survey-mate-task",
"taskRoleArn": "arn:aws:iam::768517383807:role/ecsTaskExecutionRole",
"executionRoleArn": "arn:aws:iam::768517383807:role/ecsTaskExecutionRole",
"networkMode": "awsvpc",
"revision": 31,
"networkMode": "host",
"revision": 59,
"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"
},
{
"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"
}
{
"name": "com.amazonaws.ecs.capability.logging-driver.awslogs"
},
{
"name": "ecs.capability.execution-role-awslogs"
},
{
"name": "com.amazonaws.ecs.capability.task-iam-role-network-host"
},
{
"name": "com.amazonaws.ecs.capability.ecr-auth"
},
{
"name": "com.amazonaws.ecs.capability.docker-remote-api.1.19"
},
{
"name": "ecs.capability.env-files.s3"
},
{
"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": "com.amazonaws.ecs.capability.docker-remote-api.1.29"
}
],
"placementConstraints": [],
"compatibilities": [
"EC2"
"EC2"
],
"requiresCompatibilities": [
"EC2"
"EC2"
],
"cpu": "1000",
"memory": "900",
"runtimePlatform": {
"cpuArchitecture": "X86_64",
"operatingSystemFamily": "LINUX"
"cpuArchitecture": "X86_64",
"operatingSystemFamily": "LINUX"
},
"registeredAt": "2024-02-08T13:26:55.719Z",
"registeredAt": "2024-02-15T13:01:21.053Z",
"registeredBy": "arn:aws:iam::768517383807:root",
"tags": []
}
}
100 changes: 50 additions & 50 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,12 @@ on:
env:
AWS_REGION: ap-northeast-2 # set this to your preferred AWS region, e.g. us-west-1
ECR_REPOSITORY: survey-mate-ecr # set this to your Amazon ECR repository name
ECS_SERVICE: survey-mate-service # set this to your Amazon ECS service name
ECS_SERVICE: survey-mate-ecs-service-- # set this to your Amazon ECS service name
ECS_CLUSTER: survey-mate-ecs-cluster # set this to your Amazon ECS cluster name
ECS_TASK_DEFINITION: .aws/task-definition.json # set this to the path to your Amazon ECS task definition
# file, e.g. .aws/task-definition.json
# file, e.g. .aws/task-definition.json
CONTAINER_NAME: survey-mate-container # set this to the name of the container in the
# containerDefinitions section of your task definition
# containerDefinitions section of your task definition

permissions:
contents: read
Expand All @@ -50,54 +50,54 @@ jobs:
environment: production

steps:
- uses: actions/checkout@v3
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
- name: Run chmod to make gradlew executable
run: chmod +x ./gradlew
- name: Build with Gradle
uses: gradle/gradle-build-action@bd5760595778326ba7f1441bcf7e88b49de61a25 # v2.6.0
with:
arguments: build
- name: Configure 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 }}
- uses: actions/checkout@v3
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
- name: Run chmod to make gradlew executable
run: chmod +x ./gradlew
- name: Build with Gradle
uses: gradle/gradle-build-action@bd5760595778326ba7f1441bcf7e88b49de61a25 # v2.6.0
with:
arguments: build
- name: Configure 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: Login to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v1
- name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v1

- name: Build, tag, and push image to Amazon ECR
id: build-image
env:
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
IMAGE_TAG: ${{ github.sha }}
run: |
# Build a docker container and
# push it to ECR so that it can
# be deployed to ECS.
docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG .
docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG
echo "image=$ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG" >> $GITHUB_OUTPUT
- name: Build, tag, and push image to Amazon ECR
id: build-image
env:
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
IMAGE_TAG: ${{ github.sha }}
run: |
# Build a docker container and
# push it to ECR so that it can
# be deployed to ECS.
docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG .
docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG
echo "image=$ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG" >> $GITHUB_OUTPUT
- name: Fill in the new image ID in the 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: Fill in the new image ID in the 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: Deploy 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
- name: Deploy 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
3 changes: 3 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,7 @@ ARG JAR_FILE=./build/libs/*.jar
COPY ${JAR_FILE} app.jar
ENV PORT=80
EXPOSE $PORT
EXPOSE 587
EXPOSE 465
EXPOSE 25
ENTRYPOINT ["java","-jar","/app.jar"]
1 change: 1 addition & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ dependencies {
implementation 'org.springframework.boot:spring-boot-starter-thymeleaf'
implementation 'javax.mail:javax.mail-api:1.6.2'
implementation 'org.springframework.boot:spring-boot-starter-mail'
implementation 'com.mailjet:mailjet-client:5.2.5'
}

tasks.named('test') {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public class AuthProviderImpl implements AuthProvider {

private final MemberRepository memberRepository;

private static final long ACCESS_TOKEN_DURATION = 30L * 60L * 1000L;
private static final long ACCESS_TOKEN_DURATION = 60L * 60L * 24L * 1000L * 7;

@Value("${jwt.secret}")
String secretKey;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ public class EmailConfig {
@Value("${spring.mail.properties.mail.smtp.auth}")
private boolean auth;

@Value("${spring.mail.properties.mail.smtp.ssl.enable}")
private boolean ssl;

@Value("${spring.mail.properties.mail.smtp.starttls.enable}")
private boolean starttlsEnable;

Expand Down Expand Up @@ -53,6 +56,7 @@ public JavaMailSender javaMailSender() {
private Properties getMailProperties() {
Properties properties = new Properties();
properties.put("mail.smtp.auth", auth);
properties.put("mail.smtp.ssl.enable", ssl);
properties.put("mail.smtp.starttls.enable", starttlsEnable);
properties.put("mail.smtp.starttls.required", starttlsRequired);
properties.put("mail.smtp.connection-timeout", connectionTimeout);
Expand Down
Loading

0 comments on commit 1ea7484

Please sign in to comment.