-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
120 changed files
with
738 additions
and
526 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,92 @@ | ||
name: Deploy to AWS ECR | ||
|
||
on: | ||
push: | ||
branches: | ||
- release | ||
|
||
env: | ||
AWS_REGION: ap-northeast-2 | ||
IMAGE_TAG: latest | ||
ECR_REPOSITORY: wasin | ||
|
||
defaults: | ||
run: | ||
working-directory: ./wasin | ||
|
||
jobs: | ||
deploy: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
|
||
- name: get Github Action Public IP | ||
id: ip | ||
uses: haythem/public-ip@v1.3 | ||
|
||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up JDK 17 | ||
uses: actions/setup-java@v3 | ||
with: | ||
java-version: '17' | ||
distribution: 'adopt' | ||
|
||
- name: Grant execute permission for gradlew | ||
run: chmod +x ./gradlew | ||
|
||
- 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: ap-northeast-2 | ||
|
||
- name: Login to Amazon ECR | ||
uses: aws-actions/amazon-ecr-login@v2 | ||
id: login-ecr | ||
|
||
- name: docker build | ||
env: | ||
REGISTRY: ${{ steps.login-ecr.outputs.registry }} | ||
|
||
run: docker build -t $REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG -f DockerFileProd . | ||
|
||
- name: docker build2 | ||
env: | ||
REGISTRY: ${{ steps.login-ecr.outputs.registry }} | ||
|
||
run: | | ||
docker push $REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG | ||
- name: add Github Actions IP to Security group | ||
env: | ||
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | ||
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | ||
AWS_DEFAULT_REGION: ap-northeast-2 | ||
run: | | ||
aws ec2 authorize-security-group-ingress --group-name ${{ secrets.AWS_SECURITY_GROUP }} --protocol tcp --port 22 --cidr ${{ steps.ip.outputs.ipv4 }}/32 | ||
- name: deploy ec2 server | ||
uses: appleboy/ssh-action@v1.0.3 | ||
with: | ||
host: ${{ secrets.AWS_HOST }} | ||
username: ${{ secrets.AWS_USER_NAME }} | ||
key: ${{ secrets.AWS_SSH_KEY }} | ||
script: | | ||
cd ~/wasin-backend/wasin | ||
sudo git pull | ||
aws ecr get-login-password --region ap-northeast-2 | sudo docker login --username AWS --password-stdin ${{ steps.login-ecr.outputs.registry }} | ||
sudo docker compose -f docker-compose.prod.yml pull | ||
sudo docker compose -f docker-compose.prod.yml down nginx wasin | ||
sudo docker compose -f docker-compose.prod.yml up -d | ||
sudo docker image prune -f | ||
- name: remove github Actions IP from security group | ||
env: | ||
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | ||
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | ||
AWS_DEFAULT_REGION: ap-northeast-2 | ||
run: | | ||
aws ec2 revoke-security-group-ingress --group-name ${{ secrets.AWS_SECURITY_GROUP }} --protocol tcp --port 22 --cidr ${{ steps.ip.outputs.ipv4 }}/32 |
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
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,46 @@ | ||
|
||
server { | ||
listen 80; | ||
server_name wasin.site; | ||
server_tokens off; | ||
|
||
location /.well-known/acme-challenge/ { | ||
root /var/www/certbot; | ||
} | ||
|
||
location / { | ||
return 301 https://$host$request_uri; | ||
} | ||
} | ||
|
||
server { | ||
listen 443 ssl; | ||
server_name wasin.site; | ||
server_tokens off; | ||
|
||
# access_log /var/log/nginx/access.log; | ||
# error_log /var/log/nginx/error.log; | ||
|
||
include mime.types; | ||
|
||
ssl_certificate /etc/letsencrypt/live/wasin.site/fullchain.pem; | ||
ssl_certificate_key /etc/letsencrypt/live/wasin.site/privkey.pem; | ||
include /etc/letsencrypt/options-ssl-nginx.conf; | ||
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; | ||
|
||
location /hc { | ||
default_type application/json; | ||
return 200 '{"status":200, "message":"server is healthy"}'; | ||
} | ||
|
||
location /api { | ||
if ($http_host !~* ^(wasin\.site)$ ) { | ||
return 444; | ||
} | ||
proxy_pass http://wasin:8080; | ||
proxy_set_header Host $http_host; | ||
proxy_set_header X-Real-IP $remote_addr; | ||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | ||
proxy_set_header X-RequestID $request_id; | ||
} | ||
} |
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 |
---|---|---|
@@ -1 +1 @@ | ||
rootProject.name = 'backend' | ||
rootProject.name = 'wasin' |
32 changes: 0 additions & 32 deletions
32
wasin/src/main/java/com/wasin/backend/controller/AlertController.java
This file was deleted.
Oops, something went wrong.
21 changes: 0 additions & 21 deletions
21
wasin/src/main/java/com/wasin/backend/domain/dto/AlertRequest.java
This file was deleted.
Oops, something went wrong.
13 changes: 0 additions & 13 deletions
13
wasin/src/main/java/com/wasin/backend/service/BackOfficeService.java
This file was deleted.
Oops, something went wrong.
22 changes: 0 additions & 22 deletions
22
wasin/src/main/java/com/wasin/backend/service/impl/AlertServiceImpl.java
This file was deleted.
Oops, something went wrong.
2 changes: 1 addition & 1 deletion
2
...a/com/wasin/backend/WasinApplication.java → ...ava/com/wasin/wasin/WasinApplication.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
2 changes: 1 addition & 1 deletion
2
...sin/backend/_core/config/AwsS3Config.java → ...wasin/wasin/_core/config/AwsS3Config.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
2 changes: 1 addition & 1 deletion
2
...asin/backend/_core/config/MailConfig.java → .../wasin/wasin/_core/config/MailConfig.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
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
18 changes: 9 additions & 9 deletions
18
.../backend/_core/config/SecurityConfig.java → ...in/wasin/_core/config/SecurityConfig.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
2 changes: 1 addition & 1 deletion
2
...backend/_core/config/WebClientConfig.java → ...n/wasin/_core/config/WebClientConfig.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
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
4 changes: 2 additions & 2 deletions
4
...kend/_core/exception/CustomException.java → ...asin/_core/exception/CustomException.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.