Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 6 additions & 15 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ jobs:

steps:
- uses: actions/checkout@v4
with:
submodules: true # 서브모듈 활성화
token: ${{ secrets.ACTION_TOKEN }} # Private 서브모듈 접근용 토큰

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
Expand Down Expand Up @@ -51,23 +54,10 @@ jobs:
--cache-from type=registry,ref=${{ secrets.DOCKERHUB_USERNAME }}/assu-app:dependency-cache \
.

- name: Create application-secret.yml
run: echo "${{ secrets.APPLICATION_SECRET }}" > ./application-secret.yml
shell: bash

- name: Create service-account.json
run: echo "${{ secrets.SERVICE_ACCOUNT_B64 }}" | base64 -d > ./service-account.json
shell: bash

- name: Copy application-secret.yml to EC2
uses: appleboy/scp-action@v0.1.3
with:
username: ubuntu
host: ${{ secrets.EC2_HOST }}
key: ${{ secrets.EC2_SSH_KEY }}
source: ./application-secret.yml
target: /home/ubuntu/secret/

- name: Copy service-account.json to EC2
uses: appleboy/scp-action@v0.1.3
with:
Expand Down Expand Up @@ -107,15 +97,17 @@ jobs:
sudo chmod +x /home/ubuntu/cicd/deploy.sh
sudo /home/ubuntu/cicd/deploy.sh

# 테스트 서버로 복사할 파일 목록에서 application-secret.yml 제거
- name: TEST Copy Files to Test EC2
uses: appleboy/scp-action@v0.1.3
with:
host: ${{ secrets.TEST_EC2_HOST }}
username: ubuntu
key: ${{ secrets.TEST_EC2_SSH_KEY }}
source: "./application-secret.yml,./service-account.json,./docker-compose.test.yml"
source: "./service-account.json,./docker-compose.test.yml"
target: "/home/ubuntu/cicd_temp/"

# 테스트 서버 폴더 정리 단계에서 application-secret.yml 이동 명령어 제거
- name: TEST Organize Files and Directories
uses: appleboy/ssh-action@v1.0.0
with:
Expand All @@ -124,7 +116,6 @@ jobs:
key: ${{ secrets.TEST_EC2_SSH_KEY }}
script: |
mkdir -p /home/ubuntu/secret /home/ubuntu/cicd
mv /home/ubuntu/cicd_temp/application-secret.yml /home/ubuntu/secret/
mv /home/ubuntu/cicd_temp/service-account.json /home/ubuntu/secret/
mv /home/ubuntu/cicd_temp/docker-compose.test.yml /home/ubuntu/cicd/
rm -rf /home/ubuntu/cicd_temp
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ jobs:

steps:
- uses: actions/checkout@v4
with:
submodules: true # 서브모듈 활성화
token: ${{ secrets.ACTION_TOKEN }} # Private 서브모듈 접근용 토큰

Comment on lines 16 to 20
- name: Set up JDK 17
uses: actions/setup-java@v4
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ out/

### Secret ###
src/main/resources/application-secret.yml
src/main/resources/application-local.yml
src/main/resources/application-dev.yml
src/main/resources/application-prod.yml

### Firebase ###
src/main/resources/firebase/
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "ASSU_config"]
path = ASSU_config
url = https://github.com/ASSU-dev/ASSU_config.git
1 change: 1 addition & 0 deletions ASSU_config
Submodule ASSU_config added at 9c4ec1
15 changes: 15 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -115,3 +115,18 @@ dependencies {
tasks.named('test') {
useJUnitPlatform()
}

tasks.register('copyPrivateConfig', Copy) {
from './ASSU_config/local'
from './ASSU_config/dev'
from './ASSU_config/prod'

into 'src/main/resources'

exclude '.git'
exclude 'README.md'
}

tasks.named('processResources') {
dependsOn 'copyPrivateConfig'
}
4 changes: 0 additions & 4 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,7 @@ services:
- "8080:8080"
environment:
- SPRING_PROFILES_ACTIVE=blue
- SPRING_CONFIG_ADDITIONAL_LOCATION=file:/app/config/
volumes:
- /home/ubuntu/secret/application-secret.yml:/app/config/application-secret.yml:ro
- /home/ubuntu/secret/service-account.json:/app/config/service-account.json:ro
networks:
- assu-network
Expand All @@ -26,9 +24,7 @@ services:
- "8081:8080"
environment:
- SPRING_PROFILES_ACTIVE=green
- SPRING_CONFIG_ADDITIONAL_LOCATION=file:/app/config/
volumes:
- /home/ubuntu/secret/application-secret.yml:/app/config/application-secret.yml:ro
- /home/ubuntu/secret/service-account.json:/app/config/service-account.json:ro
networks:
- assu-network
Expand Down
23 changes: 19 additions & 4 deletions src/main/resources/application.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,28 @@
spring:
application:
name: assu
profiles:
group:
"local": "local"
"dev": "dev"
"green": "green, prod"
"blue": "blue, prod"
active: local
thymeleaf:
enabled: true
servlet:
multipart:
max-file-size: 100MB
max-request-size: 100MB
batch:
jdbc:
initialize-schema: never
job:
enabled: false
config:
import:
- optional:classpath:application-secret.yml
- optional:file:/app/config/application-secret.yml
# config:
# import:
# - optional:classpath:application-secret.yml
# - optional:file:/app/config/application-secret.yml
Comment on lines +22 to +25
jpa:
hibernate:
ddl-auto: update
Expand Down
Loading