Skip to content

Commit

Permalink
Merge pull request #501 from Kernel360/refactor/#500-dev-server-remove
Browse files Browse the repository at this point in the history
[refactor] dev 환경이 사라짐에 따른 코드, 설정, ci/cd 수정
  • Loading branch information
mooncw authored Apr 5, 2024
2 parents be9c281 + 4795ec0 commit d45974a
Show file tree
Hide file tree
Showing 24 changed files with 304 additions and 578 deletions.
104 changes: 0 additions & 104 deletions .github/workflows/cd-dev.yml

This file was deleted.

53 changes: 7 additions & 46 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,68 +14,29 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

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

- run: echo "${{ secrets.MEMBER_APPLICATION }}" > ./member-api/src/main/resources/application.yml
- uses: actions/upload-artifact@v2
- name: Checkout
uses: actions/checkout@v3
with:
name: application.yml
path: ./member-api/src/main/resources/application.yml
ref: ${{ github.event.pull_request.head.sha }}

- name: Set up JDK 21
uses: actions/setup-java@v3
with:
java-version: '21'
distribution: 'temurin'

# - name: Set up member-api application.yml
# uses: microsoft/variable-substitution@v1
# with:
# files: ./member-api/src/main/resources/application.yml
# env:
# spring.datasource.url: ${{ secrets.LOCAL_DB_URL }}
# spring.datasource.username: ${{ secrets.LOCAL_DB_HOST }}
# spring.datasource.password: ${{ secrets.LOCAL_DB_PASSWORD }}
# spring.redis.host: ${{ secrets.REDIS_HOST }}
# spring.redis.port: ${{ secrets.REDIS_PORT }}
# spring.data.mongodb.uri: ${{ secrets.MONGO_URI }}
# spring.security.jwt.secret: ${{ secrets.JWT_SECRET_KEY }}
# cloud.aws.s3.bucket: ${{ secrets.S3_BUCKET_NAME }}
# cloud.aws.region.static: ${{ secrets.S3_REGION }}
# cloud.aws.credentials.accessKey: ${{ secrets.AWS_ACCESS_KEY }}
# cloud.aws.credentials.secretKey: ${{ secrets.AWS_ACCESS_SECRET }}
# kafka.url: ${{ secrets.KAFKA_URL }}
# custom.domain.image.baseUrl: ${{ secrets.BASE_URL }}
# chatgpt.rest-api-key: ${{ secrets.CHAT_GPT_API_KEY }}

# - name: Set up domain-mysql application.yml
# uses: microsoft/variable-substitution@v1
# with:
# files: ./domain-mysql/src/main/resources/application.yml
# env:
# spring.datasource.url: ${{ secrets.LOCAL_DB_URL }}
# spring.datasource.username: ${{ secrets.LOCAL_DB_HOST }}
# spring.datasource.password: ${{ secrets.LOCAL_DB_PASSWORD }}

- name: Set up domain-mongodb application.yml
- name: Set up member-api application-common.yml
uses: microsoft/variable-substitution@v1
with:
files: ./domain-mongodb/src/main/resources/application.yml
files: ./member-api/src/main/resources/application-common.yml
env:
spring.data.mongodb.uri: ${{ secrets.MONGO_URI }}
jasypt.password: ${{ secrets.JASYPT_PASSWORD }}

- name: Build member-api with Gradle
run : |
cd member-api
chmod +x ./gradlew
./gradlew clean build
./gradlew build
- name: Login to DockerHub
uses: docker/login-action@v1
Expand Down
47 changes: 28 additions & 19 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,31 +23,40 @@ jobs:
java-version: '21'
distribution: 'temurin'

- name: Set up DataHub with Docker
run: |
echo "${{ secrets.CI_DOCKER_COMPOSE }}" > docker-compose.yml
docker-compose up -d
docker ps
- name: Test domain-mysql with Gradle
run: |
cd domain-mysql
chmod +x ./gradlew
./gradlew test
- name: Set up domain-mongodb test application.yml
uses: microsoft/variable-substitution@v1
with:
files: ./domain-mongodb/src/test/resources/application.yml
env:
spring.data.mongodb.uri: ${{ secrets.MONGO_TEST_URI }}
jasypt.password: ${{ secrets.JASYPT_PASSWORD }}

- name: Test domain-mongodb with Gradle
run: |
cd domain-mongodb
chmod +x ./gradlew
./gradlew test
- name: Set up member-api test application.yml
- name: Set up member-api application-common.yml
uses: microsoft/variable-substitution@v1
with:
files: ./member-api/src/test/resources/application.yml
files: ./member-api/src/main/resources/application-common.yml
env:
spring.datasource.url: ${{ secrets.TEST_DB_URL }}
spring.datasource.username: ${{ secrets.TEST_DB_HOST }}
spring.datasource.password: ${{ secrets.TEST_DB_PASSWORD }}
spring.security.jwt.secret: ${{ secrets.JWT_SECRET_KEY }}
spring.data.mongodb.uri: ${{ secrets.MONGO_TEST_URI }}
custom.domain.image.baseUrl: ${{ secrets.BASE_URL }}
cloud.aws.s3.bucket: ${{ secrets.S3_BUCKET_NAME }}
cloud.aws.region.static: ${{ secrets.S3_REGION }}
cloud.aws.credentials.accessKey: ${{ secrets.AWS_ACCESS_KEY }}
cloud.aws.credentials.secretKey: ${{ secrets.AWS_ACCESS_SECRET }}

- name: Run chmod to make gradlew executable
run: chmod +x ./gradlew

- name: Test with Gradle
run: ./gradlew test
jasypt.password: ${{ secrets.JASYPT_PASSWORD }}

- name: Build member-api with Gradle
run: |
cd member-api
chmod +x ./gradlew
./gradlew build
21 changes: 0 additions & 21 deletions .github/workflows/cr.yml

This file was deleted.

4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ member-api/logs/**

member-api/member-api/logs/**

member-api/src/main/resources/application-local.yml

core/src/test/java/com/kernelsqaure/core/config/JasyptConfigTest.java

### STS ###
.apt_generated
.classpath
Expand Down
6 changes: 6 additions & 0 deletions core/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,12 @@ dependencies {
//Monitoring
implementation 'org.springframework.boot:spring-boot-starter-actuator'
implementation 'io.micrometer:micrometer-registry-prometheus'

//jasypt
implementation 'com.github.ulisesbocchio:jasypt-spring-boot-starter:3.0.5'

//Test
testImplementation 'org.springframework.boot:spring-boot-starter-test'
}

tasks.named('test') {
Expand Down
23 changes: 0 additions & 23 deletions core/src/main/java/com/kernelsquare/core/compose/Kafka.yml

This file was deleted.

13 changes: 0 additions & 13 deletions core/src/main/java/com/kernelsquare/core/compose/MongoDB.yml

This file was deleted.

32 changes: 32 additions & 0 deletions core/src/main/java/com/kernelsquare/core/config/JasyptConfig.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package com.kernelsquare.core.config;

import com.ulisesbocchio.jasyptspringboot.annotation.EnableEncryptableProperties;
import org.jasypt.encryption.StringEncryptor;
import org.jasypt.encryption.pbe.PooledPBEStringEncryptor;
import org.jasypt.encryption.pbe.config.SimpleStringPBEConfig;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
@EnableEncryptableProperties
public class JasyptConfig {
@Value("${jasypt.password}")
private String password;

@Bean("jasyptEncryptorAES")
public StringEncryptor stringEncryptor() {
PooledPBEStringEncryptor encryptor = new PooledPBEStringEncryptor();
SimpleStringPBEConfig config = new SimpleStringPBEConfig();
config.setPassword(password);
config.setAlgorithm("PBEWITHHMACSHA512ANDAES_256"); // 알고리즘
config.setKeyObtentionIterations("1000"); // 반복할 해싱 횟수
config.setPoolSize("1"); // 인스턴스 pool
config.setProviderName("SunJCE"); // 기본 암호화 제공자
config.setSaltGeneratorClassName("org.jasypt.salt.RandomSaltGenerator"); // 기본 salt 생성 클래스
config.setIvGeneratorClassName("org.jasypt.iv.RandomIvGenerator"); // 랜덤 초기화 벡터
config.setStringOutputType("base64"); //인코딩 방식
encryptor.setConfig(config);
return encryptor;
}
}
1 change: 0 additions & 1 deletion core/src/main/resources/application.properties

This file was deleted.

3 changes: 3 additions & 0 deletions domain-mongodb/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ dependencies {
//mongodb
implementation 'org.springframework.boot:spring-boot-starter-data-mongodb'

//jasypt
implementation 'com.github.ulisesbocchio:jasypt-spring-boot-starter:3.0.5'

//Test
testImplementation 'org.springframework.boot:spring-boot-starter-test'
}
Expand Down
4 changes: 0 additions & 4 deletions domain-mongodb/src/main/resources/application.yml

This file was deleted.

Loading

0 comments on commit d45974a

Please sign in to comment.