-
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.
Merge pull request #30 from DDD-Community/dev
2차 MVP 릴리즈
- Loading branch information
Showing
71 changed files
with
2,905 additions
and
15 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,84 @@ | ||
name: Java CI with Gradle | ||
|
||
on: | ||
push: | ||
branches: [ "dev" ] | ||
|
||
jobs: | ||
build: | ||
## checkout후 자바 21 버전으로 설정을 합니다 | ||
runs-on: ubuntu-latest | ||
env: | ||
DB_URL: ${{ secrets.DB_URL }} | ||
DB_USER: ${{ secrets.DB_USER }} | ||
DB_PASSWORD: ${{ secrets.DB_PASSWORD }} | ||
JASYPT_ENCRYPTOR_PASSWORD: ${{ secrets.JASYPT_ENCRYPTOR_PASSWORD }} | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Set up JDK 21 | ||
uses: actions/setup-java@v4 | ||
with: | ||
java-version: '21' | ||
distribution: 'temurin' | ||
|
||
- name: Set up Gradle | ||
uses: gradle/gradle-build-action@v2 | ||
|
||
- name: Increase Gradle memory settings | ||
run: | | ||
echo "org.gradle.jvmargs=-Xmx4g -Dfile.encoding=UTF-8" >> ~/.gradle/gradle.properties | ||
echo "kotlin.daemon.jvmargs=-Xmx4g" >> ~/.gradle/gradle.properties | ||
## gradlew 의 권한을 줍니다. | ||
- name: Grant execute permission for gradlew | ||
run: chmod +x gradlew | ||
|
||
## gradle build | ||
- name: Build with Gradle | ||
run: ./gradlew clean build -x test | ||
|
||
## 이미지 태그에 시간 설정을 하기위해서 현재 시간을 가져옵니다. | ||
- name: Get current time | ||
uses: 1466587594/get-current-time@v2 | ||
id: current-time | ||
with: | ||
format: YYYY-MM-DDTHH-mm-ss | ||
utcOffset: "+09:00" | ||
|
||
- name: Show Current Time | ||
run: echo "CurrentTime=${{steps.current-time.outputs.formattedTime}}" | ||
## AWS에 로그인. aws-region은 서울로 설정(ap-northeast-2) | ||
- 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: ap-northeast-2 | ||
## ECR에 로그인 | ||
- name: Login to Amazon ECR | ||
id: login-ecr | ||
uses: aws-actions/amazon-ecr-login@v1 | ||
## sample라는 ECR 리파지터리에 현재 시간 태그를 생성하고, 푸쉬 | ||
## 앞의 스탭에서 ${{steps.current-time.outputs.formattedTime}}로 현재 시간을 가져옵니다. | ||
- name: Build, tag, and push image to Amazon ECR | ||
run: | | ||
docker build --build-arg PASSWORD=$PASSWORD -t polabo:${{steps.current-time.outputs.formattedTime}} . | ||
docker tag polabo:${{steps.current-time.outputs.formattedTime}} ${{ secrets.ECR_REGISTRY }}/polabo:${{steps.current-time.outputs.formattedTime}} | ||
docker push ${{ secrets.ECR_REGISTRY }}/polabo:${{steps.current-time.outputs.formattedTime}} | ||
env: | ||
PASSWORD: ${{ secrets.JASYPT_ENCRYPTOR_PASSWORD }} | ||
|
||
- name: Deploy | ||
uses: appleboy/ssh-action@master | ||
with: | ||
host: ${{ secrets.EC2_HOST_DEV }} | ||
username: ${{ secrets.EC2_USERNAME }} | ||
key: ${{ secrets.EC2_KEY }} | ||
script: | | ||
aws ecr get-login-password --region ap-northeast-2 | docker login --username AWS --password-stdin ${{ steps.login-ecr.outputs.registry }}/${{ secrets.ECR_REPOSITORY }} | ||
docker stop polabo-dev | ||
docker rm polabo-dev | ||
docker pull ${{ secrets.ECR_REGISTRY }}/polabo:${{steps.current-time.outputs.formattedTime}} | ||
docker run -d -v /etc/localtime:/etc/localtime:ro -v /usr/share/zoneinfo/Asia/Seoul:/etc/timezone:ro -e ENVIRONMENT_VALUE=-Dspring.profiles.active=dev --name polabo-dev -p 8080:8080 --restart=always --network host ${{ secrets.ECR_REGISTRY }}/polabo:${{steps.current-time.outputs.formattedTime}} | ||
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,84 @@ | ||
name: Java CI with Gradle | ||
|
||
on: | ||
push: | ||
branches: [ "main" ] | ||
|
||
jobs: | ||
build: | ||
## checkout후 자바 21 버전으로 설정을 합니다 | ||
runs-on: ubuntu-latest | ||
env: | ||
DB_URL: ${{ secrets.DB_URL }} | ||
DB_USER: ${{ secrets.DB_USER }} | ||
DB_PASSWORD: ${{ secrets.DB_PASSWORD }} | ||
JASYPT_ENCRYPTOR_PASSWORD: ${{ secrets.JASYPT_ENCRYPTOR_PASSWORD }} | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Set up JDK 21 | ||
uses: actions/setup-java@v4 | ||
with: | ||
java-version: '21' | ||
distribution: 'temurin' | ||
|
||
- name: Set up Gradle | ||
uses: gradle/gradle-build-action@v2 | ||
|
||
- name: Increase Gradle memory settings | ||
run: | | ||
echo "org.gradle.jvmargs=-Xmx4g -Dfile.encoding=UTF-8" >> ~/.gradle/gradle.properties | ||
echo "kotlin.daemon.jvmargs=-Xmx4g" >> ~/.gradle/gradle.properties | ||
## gradlew 의 권한을 줍니다. | ||
- name: Grant execute permission for gradlew | ||
run: chmod +x gradlew | ||
|
||
## gradle build | ||
- name: Build with Gradle | ||
run: ./gradlew clean build -x test | ||
|
||
## 이미지 태그에 시간 설정을 하기위해서 현재 시간을 가져옵니다. | ||
- name: Get current time | ||
uses: 1466587594/get-current-time@v2 | ||
id: current-time | ||
with: | ||
format: YYYY-MM-DDTHH-mm-ss | ||
utcOffset: "+09:00" | ||
|
||
- name: Show Current Time | ||
run: echo "CurrentTime=${{steps.current-time.outputs.formattedTime}}" | ||
## AWS에 로그인. aws-region은 서울로 설정(ap-northeast-2) | ||
- 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: ap-northeast-2 | ||
## ECR에 로그인 | ||
- name: Login to Amazon ECR | ||
id: login-ecr | ||
uses: aws-actions/amazon-ecr-login@v1 | ||
## sample라는 ECR 리파지터리에 현재 시간 태그를 생성하고, 푸쉬 | ||
## 앞의 스탭에서 ${{steps.current-time.outputs.formattedTime}}로 현재 시간을 가져옵니다. | ||
- name: Build, tag, and push image to Amazon ECR | ||
run: | | ||
docker build --build-arg PASSWORD=$PASSWORD -t polabo:${{steps.current-time.outputs.formattedTime}} . | ||
docker tag polabo:${{steps.current-time.outputs.formattedTime}} ${{ secrets.ECR_REGISTRY }}/polabo:${{steps.current-time.outputs.formattedTime}} | ||
docker push ${{ secrets.ECR_REGISTRY }}/polabo:${{steps.current-time.outputs.formattedTime}} | ||
env: | ||
PASSWORD: ${{ secrets.JASYPT_ENCRYPTOR_PASSWORD }} | ||
|
||
- name: Deploy | ||
uses: appleboy/ssh-action@master | ||
with: | ||
host: ${{ secrets.EC2_HOST }} | ||
username: ${{ secrets.EC2_USERNAME }} | ||
key: ${{ secrets.EC2_KEY }} | ||
script: | | ||
aws ecr get-login-password --region ap-northeast-2 | docker login --username AWS --password-stdin ${{ steps.login-ecr.outputs.registry }}/${{ secrets.ECR_REPOSITORY }} | ||
docker stop polabo-dev | ||
docker rm polabo-dev | ||
docker pull ${{ secrets.ECR_REGISTRY }}/polabo:${{steps.current-time.outputs.formattedTime}} | ||
docker run -d -v /etc/localtime:/etc/localtime:ro -v /usr/share/zoneinfo/Asia/Seoul:/etc/timezone:ro -e ENVIRONMENT_VALUE=-Dspring.profiles.active=dev --name polabo-dev -p 8080:8080 --restart=always --network host ${{ secrets.ECR_REGISTRY }}/polabo:${{steps.current-time.outputs.formattedTime}} | ||
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,11 @@ | ||
FROM openjdk:21 | ||
|
||
ARG JAR_FILE=build/libs/*SNAPSHOT.jar | ||
ARG PASSWORD | ||
|
||
COPY ${JAR_FILE} polabo.jar | ||
|
||
ENV JASYPT_ENCRYPTOR_PASSWORD=${PASSWORD} | ||
|
||
#ENTRYPOINT ["sh", "-c", "java -jar /polabo.jar -Djasypt.encryptor.password=${JASYPT_ENCRYPTOR_PASSWORD}"] | ||
ENTRYPOINT ["sh", "-c", "java ${JAVA_OPTS} ${ENVIRONMENT_VALUE} -jar /polabo.jar", "-Djasypt.encryptor.password=${JASYPT_ENCRYPTOR_PASSWORD}"] |
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,26 @@ | ||
version: '3.7' | ||
|
||
services: | ||
mysql: | ||
image: mysql:latest | ||
container_name: polabo_mysql | ||
hostname: polabo_mysql | ||
volumes: | ||
- ./mysqldata:/var/lib/mysql | ||
environment: | ||
- MYSQL_USER=polabo | ||
- MYSQL_PASSWORD=polabo | ||
- MYSQL_ROOT_PASSWORD=polabo | ||
- MYSQL_HOST=localhost | ||
- MYSQL_PORT=3306 | ||
- MYSQL_DATABASE=polabo | ||
ports: | ||
- "3306:3306" | ||
|
||
|
||
# redis: | ||
# image: redis | ||
# container_name: polabo_redis | ||
# hostname: polabo_redis | ||
# ports: | ||
# - "6379:6379" |
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,2 @@ | ||
# Increase the maximum heap size for the Kotlin daemon | ||
kotlin.daemon.jvmargs=-Xmx4g |
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
5 changes: 4 additions & 1 deletion
5
src/main/kotlin/com/ddd/sonnypolabobe/SonnyPolaboBeApplication.kt
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,11 +1,14 @@ | ||
package com.ddd.sonnypolabobe | ||
|
||
import org.slf4j.LoggerFactory | ||
import org.springframework.boot.autoconfigure.SpringBootApplication | ||
import org.springframework.boot.runApplication | ||
import org.springframework.scheduling.annotation.EnableScheduling | ||
|
||
@EnableScheduling | ||
@SpringBootApplication | ||
class SonnyPolaboBeApplication | ||
|
||
inline fun <reified T> T.logger() = LoggerFactory.getLogger(T::class.java)!! | ||
fun main(args: Array<String>) { | ||
runApplication<SonnyPolaboBeApplication>(*args) | ||
} |
Oops, something went wrong.