-
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.
[Deploy] Set up continuous integration and deployment pipeline
- Loading branch information
1 parent
c6bffa6
commit e95f1f9
Showing
12 changed files
with
364 additions
and
19 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,3 @@ | ||
commands: | ||
set_time_zone: | ||
command: ln -f -s /usr/share/zoneinfo/Asia/Seoul /etc/localtime |
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,64 @@ | ||
name: waggle dev CI/CD | ||
|
||
on: | ||
push: | ||
branches: | ||
- dev | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
with: | ||
token: ${{ secrets.TOKEN }} | ||
submodules: true | ||
|
||
- name: Set up JDK | ||
uses: actions/setup-java@v3 | ||
with: | ||
java-version: 17 | ||
distribution: 'adopt' | ||
|
||
- name: Configure AWS credentials | ||
uses: aws-actions/configure-aws-credentials@v4 | ||
with: | ||
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | ||
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | ||
aws-region: ${{ secrets.AWS_REGION }} | ||
|
||
- name: Login to Amazon ECR | ||
id: login-ecr | ||
uses: aws-actions/amazon-ecr-login@v2 | ||
|
||
- name: Build with Gradle & Upload Image to ECR | ||
run: ./gradlew -Pdev clean jib | ||
|
||
- name: Get current time | ||
uses: josStorer/get-current-time@v2 | ||
id: current-time | ||
with: | ||
format: YYYYMMDD_HH-mm-ss | ||
utcOffset: "+09:00" | ||
|
||
- name: Generate deployment package | ||
run: | | ||
mkdir -p deploy/.platform/nginx/conf.d | ||
cp Dockerrun.aws.dev.json deploy/Dockerrun.aws.json | ||
cp -r .ebextensions-dev deploy/.ebextensions | ||
cp .platform/nginx/conf.d/proxy-dev.conf deploy/.platform/nginx/conf.d/proxy.conf | ||
cd deploy && zip -r deploy.zip . | ||
- name: Beanstalk Deploy | ||
uses: einaregilsson/beanstalk-deploy@v21 | ||
with: | ||
aws_access_key: ${{ secrets.DEV_AWS_ACCESS_KEY_ID }} | ||
aws_secret_key: ${{ secrets.DEV_AWS_SECRET_ACCESS_KEY }} | ||
application_name: waggle-dev | ||
environment_name: Waggle-dev-env | ||
version_label: waggle-dev-${{steps.current-time.outputs.formattedTime}} | ||
region: ${{ secrets.DEV_AWS_REGION }} | ||
deployment_package: deploy/deploy.zip | ||
wait_for_environment_recovery: 300 |
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,28 @@ | ||
server { | ||
listen 80; | ||
|
||
location / { | ||
proxy_pass http://localhost:8080; | ||
proxy_set_header X-Real_IP $remote_addr; | ||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | ||
proxy_set_header Host $http_host; | ||
} | ||
|
||
location /ws/chat { | ||
proxy_pass $service_url; | ||
proxy_set_header X-Real-IP $remote_addr; | ||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | ||
proxy_set_header Host $http_host; | ||
|
||
# WebSocket | ||
proxy_http_version 1.1; | ||
proxy_set_header Upgrade $http_upgrade; | ||
proxy_set_header Connection "upgrade"; | ||
proxy_set_header Origin ""; | ||
|
||
# Timeout settings for WebSocket | ||
proxy_read_timeout 3600s; | ||
proxy_send_timeout 3600s; | ||
proxy_connect_timeout 60s; | ||
} | ||
} |
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,81 @@ | ||
{ | ||
"AWSEBDockerrunVersion": 2, | ||
"containerDefinitions": [ | ||
{ | ||
"name": "app", | ||
"image": "471112861132.dkr.ecr.ap-northeast-2.amazonaws.com/waggle-dev", | ||
"essential": true, | ||
"portMappings": [ | ||
{ | ||
"hostPort": 8080, | ||
"containerPort": 8080 | ||
} | ||
] | ||
}, | ||
{ | ||
"name": "kafka", | ||
"image": "wurstmeister/kafka:latest", | ||
"essential": false, | ||
"portMappings": [ | ||
{ | ||
"hostPort": 9092, | ||
"containerPort": 9092 | ||
} | ||
], | ||
"environment": [ | ||
{ | ||
"name": "KAFKA_ADVERTISED_LISTENERS", | ||
"value": "INSIDE://kafka:9092,OUTSIDE://localhost:9092" | ||
}, | ||
{ | ||
"name": "KAFKA_LISTENER_SECURITY_PROTOCOL_MAP", | ||
"value": "INSIDE:PLAINTEXT,OUTSIDE:PLAINTEXT" | ||
}, | ||
{ | ||
"name": "KAFKA_INTER_BROKER_LISTENER_NAME", | ||
"value": "INSIDE" | ||
}, | ||
{ | ||
"name": "KAFKA_ZOOKEEPER_CONNECT", | ||
"value": "zookeeper:2181" | ||
} | ||
], | ||
"links": [ | ||
"zookeeper" | ||
] | ||
}, | ||
{ | ||
"name": "zookeeper", | ||
"image": "wurstmeister/zookeeper:latest", | ||
"essential": false, | ||
"portMappings": [ | ||
{ | ||
"hostPort": 2181, | ||
"containerPort": 2181 | ||
} | ||
] | ||
}, | ||
{ | ||
"name": "redis", | ||
"image": "redis:latest", | ||
"essential": false, | ||
"portMappings": [ | ||
{ | ||
"hostPort": 6379, | ||
"containerPort": 6379 | ||
} | ||
] | ||
}, | ||
{ | ||
"name": "mongo", | ||
"image": "mongo:latest", | ||
"essential": false, | ||
"portMappings": [ | ||
{ | ||
"hostPort": 27017, | ||
"containerPort": 27017 | ||
} | ||
] | ||
} | ||
] | ||
} |
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
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,37 @@ | ||
version: '3.8' | ||
services: | ||
app: | ||
image: 471112861132.dkr.ecr.ap-northeast-2.amazonaws.com/waggle-dev | ||
ports: | ||
- "8080:8080" | ||
depends_on: | ||
- kafka | ||
- redis | ||
- mongo | ||
|
||
kafka: | ||
image: wurstmeister/kafka:latest | ||
ports: | ||
- "9092:9092" | ||
environment: | ||
KAFKA_ADVERTISED_LISTENERS: INSIDE://kafka:9092,OUTSIDE://localhost:9092 | ||
KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: INSIDE:PLAINTEXT,OUTSIDE:PLAINTEXT | ||
KAFKA_INTER_BROKER_LISTENER_NAME: INSIDE | ||
KAFKA_ZOOKEEPER_CONNECT: zookeeper:2181 | ||
depends_on: | ||
- zookeeper | ||
|
||
zookeeper: | ||
image: wurstmeister/zookeeper:latest | ||
ports: | ||
- "2181:2181" | ||
|
||
redis: | ||
image: redis:latest | ||
ports: | ||
- "6379:6379" | ||
|
||
mongo: | ||
image: mongo:latest | ||
ports: | ||
- "27017:27017" |
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,20 @@ | ||
jib { | ||
from { | ||
image = "amazoncorretto:17.0.4-al2" | ||
platforms { | ||
platform { | ||
architecture = "amd64" | ||
os = "linux" | ||
} | ||
} | ||
} | ||
to { | ||
image = "471112861132.dkr.ecr.ap-northeast-2.amazonaws.com/waggle-dev" | ||
tags = ["latest", "${project.name}-" + System.currentTimeMillis()] | ||
} | ||
container { | ||
creationTime = "USE_CURRENT_TIMESTAMP" | ||
jvmFlags = ['-Dspring.profiles.active=dev', '-XX:+UseContainerSupport'] | ||
ports = ['8080'] | ||
} | ||
} |
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
11 changes: 6 additions & 5 deletions
11
src/main/java/com/example/waggle/global/util/MediaUtil.java
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
Oops, something went wrong.