Skip to content

Commit

Permalink
chore: CICD 전체 주석처리
Browse files Browse the repository at this point in the history
  • Loading branch information
hannah0226 committed Mar 16, 2024
1 parent 60d3407 commit 76ec905
Show file tree
Hide file tree
Showing 4 changed files with 136 additions and 136 deletions.
146 changes: 73 additions & 73 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -1,73 +1,73 @@
# This is a basic workflow to help you get started with Actions

name: Deploy to Amazon EC2
# Controls when the workflow will run
on:
# Triggers the workflow on push or pull request events but only for the "main" branch
push:
branches:
- main

env:
AWS_REGION: ap-northeast-2
S3_BUCKET_NAME: meltingpot-github-actions-s3-bucket
CODE_DEPLOY_APPLICATION_NAME: meltingpot-codedeploy-app
CODE_DEPLOY_DEPLOYMENT_GROUP_NAME: meltingpot-codedeploy-deployment-group
APPLICATION: ${{ secrets.APPLICATION }}

permissions:
contents: read

jobs:
deploy:
name: Deploy
runs-on: ubuntu-latest
environment: production

steps:
- name: Checkout
uses: actions/checkout@v3

- name: Set up JDK 17
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '17'
- name: Grant execute permission for gradlew
run: chmod +x gradlew

- uses: actions/checkout@v2
- run: touch ./src/main/resources/application.yml
- run: echo "${{env.APPLICATION}}" > ./src/main/resources/application.yml
- uses: actions/upload-artifact@v2
with:
name: application.yml
path: ./src/main/resources/application.yml

- name: Build with Gradle
uses: gradle/gradle-build-action@0d13054264b0bb894ded474f08ebb30921341cee
with:
arguments: clean build -x test

- 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: Upload to AWS S3
run: |
aws deploy push \
--application-name ${{ env.CODE_DEPLOY_APPLICATION_NAME }} \
--ignore-hidden-files \
--s3-location s3://$S3_BUCKET_NAME/$GITHUB_SHA.zip \
--source .
- name: Deploy to AWS EC2 from S3
run: |
aws deploy create-deployment \
--application-name ${{ env.CODE_DEPLOY_APPLICATION_NAME }} \
--deployment-config-name CodeDeployDefault.AllAtOnce \
--deployment-group-name ${{ env.CODE_DEPLOY_DEPLOYMENT_GROUP_NAME }} \
--s3-location bucket=$S3_BUCKET_NAME,key=$GITHUB_SHA.zip,bundleType=zip
## This is a basic workflow to help you get started with Actions
#
#name: Deploy to Amazon EC2
## Controls when the workflow will run
#on:
# # Triggers the workflow on push or pull request events but only for the "main" branch
# push:
# branches:
# - main
#
#env:
# AWS_REGION: ap-northeast-2
# S3_BUCKET_NAME: meltingpot-github-actions-s3-bucket
# CODE_DEPLOY_APPLICATION_NAME: meltingpot-codedeploy-app
# CODE_DEPLOY_DEPLOYMENT_GROUP_NAME: meltingpot-codedeploy-deployment-group
# APPLICATION: ${{ secrets.APPLICATION }}
#
#permissions:
# contents: read
#
#jobs:
# deploy:
# name: Deploy
# runs-on: ubuntu-latest
# environment: production
#
# steps:
# - name: Checkout
# uses: actions/checkout@v3
#
# - name: Set up JDK 17
# uses: actions/setup-java@v3
# with:
# distribution: 'temurin'
# java-version: '17'
# - name: Grant execute permission for gradlew
# run: chmod +x gradlew
#
# - uses: actions/checkout@v2
# - run: touch ./src/main/resources/application.yml
# - run: echo "${{env.APPLICATION}}" > ./src/main/resources/application.yml
# - uses: actions/upload-artifact@v2
# with:
# name: application.yml
# path: ./src/main/resources/application.yml
#
# - name: Build with Gradle
# uses: gradle/gradle-build-action@0d13054264b0bb894ded474f08ebb30921341cee
# with:
# arguments: clean build -x test
#
# - 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: Upload to AWS S3
# run: |
# aws deploy push \
# --application-name ${{ env.CODE_DEPLOY_APPLICATION_NAME }} \
# --ignore-hidden-files \
# --s3-location s3://$S3_BUCKET_NAME/$GITHUB_SHA.zip \
# --source .
#
# - name: Deploy to AWS EC2 from S3
# run: |
# aws deploy create-deployment \
# --application-name ${{ env.CODE_DEPLOY_APPLICATION_NAME }} \
# --deployment-config-name CodeDeployDefault.AllAtOnce \
# --deployment-group-name ${{ env.CODE_DEPLOY_DEPLOYMENT_GROUP_NAME }} \
# --s3-location bucket=$S3_BUCKET_NAME,key=$GITHUB_SHA.zip,bundleType=zip
46 changes: 23 additions & 23 deletions appspec.yml
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
version: 0.0
os: linux

files:
- source: /
destination: /home/ubuntu/EwhaSinmungo-Back
overwrite: yes
file_exists_behavior: OVERWRITE
permissions:
- object: /
pattern: "**"
owner: ubuntu
group: ubuntu

hooks:
AfterInstall:
- location: scripts/stop.sh
timeout: 60
runas: ubuntu
ApplicationStart:
- location: scripts/start.sh
timeout: 60
runas: ubuntu
#version: 0.0
#os: linux
#
#files:
# - source: /
# destination: /home/ubuntu/EwhaSinmungo-Back
# overwrite: yes
#file_exists_behavior: OVERWRITE
#permissions:
# - object: /
# pattern: "**"
# owner: ubuntu
# group: ubuntu
#
#hooks:
# AfterInstall:
# - location: scripts/stop.sh
# timeout: 60
# runas: ubuntu
# ApplicationStart:
# - location: scripts/start.sh
# timeout: 60
# runas: ubuntu
42 changes: 21 additions & 21 deletions scripts/start.sh
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
#!/usr/bin/env bash

PROJECT_ROOT="/home/ubuntu/EwhaSinmungo-Back"
JAR_FILE="$PROJECT_ROOT/spring-webapp.jar"

APP_LOG="$PROJECT_ROOT/application.log"
ERROR_LOG="$PROJECT_ROOT/error.log"
DEPLOY_LOG="$PROJECT_ROOT/deploy.log"

TIME_NOW=$(date +%c)

# build 파일 복사
echo "$TIME_NOW > $JAR_FILE 파일 복사" >> $DEPLOY_LOG
cp $PROJECT_ROOT/build/libs/*.jar $JAR_FILE

# jar 파일 실행
echo "$TIME_NOW > $JAR_FILE 파일 실행" >> $DEPLOY_LOG
nohup java -jar $JAR_FILE > $APP_LOG 2> $ERROR_LOG &

CURRENT_PID=$(pgrep -f $JAR_FILE)
echo "$TIME_NOW > 실행된 프로세스 아이디 $CURRENT_PID 입니다." >> $DEPLOY_LOG
##!/usr/bin/env bash
#
#PROJECT_ROOT="/home/ubuntu/EwhaSinmungo-Back"
#JAR_FILE="$PROJECT_ROOT/spring-webapp.jar"
#
#APP_LOG="$PROJECT_ROOT/application.log"
#ERROR_LOG="$PROJECT_ROOT/error.log"
#DEPLOY_LOG="$PROJECT_ROOT/deploy.log"
#
#TIME_NOW=$(date +%c)
#
## build 파일 복사
#echo "$TIME_NOW > $JAR_FILE 파일 복사" >> $DEPLOY_LOG
#cp $PROJECT_ROOT/build/libs/*.jar $JAR_FILE
#
## jar 파일 실행
#echo "$TIME_NOW > $JAR_FILE 파일 실행" >> $DEPLOY_LOG
#nohup java -jar $JAR_FILE > $APP_LOG 2> $ERROR_LOG &
#
#CURRENT_PID=$(pgrep -f $JAR_FILE)
#echo "$TIME_NOW > 실행된 프로세스 아이디 $CURRENT_PID 입니다." >> $DEPLOY_LOG
38 changes: 19 additions & 19 deletions scripts/stop.sh
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
#!/usr/bin/env bash

PROJECT_ROOT="/home/ubuntu/EwhaSinmungo-Back"
JAR_FILE="$PROJECT_ROOT/spring-webapp.jar"

DEPLOY_LOG="$PROJECT_ROOT/deploy.log"

TIME_NOW=$(date +%c)

# 현재 구동 중인 애플리케이션 pid 확인
CURRENT_PID=$(pgrep -f $JAR_FILE)

# 프로세스가 켜져 있으면 종료
if [ -z $CURRENT_PID ]; then
echo "$TIME_NOW > 현재 실행중인 애플리케이션이 없습니다" >> $DEPLOY_LOG
else
echo "$TIME_NOW > 실행중인 $CURRENT_PID 애플리케이션 종료 " >> $DEPLOY_LOG
kill -15 $CURRENT_PID
fi
##!/usr/bin/env bash
#
#PROJECT_ROOT="/home/ubuntu/EwhaSinmungo-Back"
#JAR_FILE="$PROJECT_ROOT/spring-webapp.jar"
#
#DEPLOY_LOG="$PROJECT_ROOT/deploy.log"
#
#TIME_NOW=$(date +%c)
#
## 현재 구동 중인 애플리케이션 pid 확인
#CURRENT_PID=$(pgrep -f $JAR_FILE)
#
## 프로세스가 켜져 있으면 종료
#if [ -z $CURRENT_PID ]; then
# echo "$TIME_NOW > 현재 실행중인 애플리케이션이 없습니다" >> $DEPLOY_LOG
#else
# echo "$TIME_NOW > 실행중인 $CURRENT_PID 애플리케이션 종료 " >> $DEPLOY_LOG
# kill -15 $CURRENT_PID
#fi

0 comments on commit 76ec905

Please sign in to comment.