Skip to content

Commit

Permalink
Revert "infra : ci/cd 관련 작업 (#63)"
Browse files Browse the repository at this point in the history
This reverts commit 3591447.
  • Loading branch information
oownahcohc authored Mar 31, 2024
1 parent 3591447 commit 1c4d2c1
Show file tree
Hide file tree
Showing 21 changed files with 215 additions and 233 deletions.
62 changes: 0 additions & 62 deletions .github/workflows/cd.yml

This file was deleted.

49 changes: 0 additions & 49 deletions .github/workflows/ci.yml

This file was deleted.

3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -39,5 +39,8 @@ out/
### log ###
logs

### firebase ###
src/main/resources/external/firebase

### .http auth
http/local/auth
3 changes: 0 additions & 3 deletions .gitmodules

This file was deleted.

23 changes: 0 additions & 23 deletions appspec.yml

This file was deleted.

36 changes: 0 additions & 36 deletions scripts/deploy.sh

This file was deleted.

12 changes: 0 additions & 12 deletions scripts/stop.sh

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ public void addInterceptors(@NotNull InterceptorRegistry registry) {
registry.addInterceptor(authenticationInterceptor)
.addPathPatterns("/**")
.excludePathPatterns("/")
.excludePathPatterns("/health")
.excludePathPatterns("/v1/auth/login/kakao")
.excludePathPatterns("/v1/auth/reissue");
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,39 +1,9 @@
package univ.earthbreaker.namu.external.aws.image;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Profile;

import com.amazonaws.auth.AWSStaticCredentialsProvider;
import com.amazonaws.auth.BasicAWSCredentials;
import com.amazonaws.services.s3.AmazonS3;
import com.amazonaws.services.s3.AmazonS3ClientBuilder;

@Configuration
@Profile("dev")
@Profile("prod")
public class S3Config {

private final String accessKey;
private final String secretKey;
private final String region;

public S3Config(
@Value("${cloud.aws.credentials.access-key}") String accessKey,
@Value("${cloud.aws.credentials.secret-key}") String secretKey,
@Value("${cloud.aws.region.static}") String region
) {
this.accessKey = accessKey;
this.secretKey = secretKey;
this.region = region;
}

@Bean
public AmazonS3 amazonS3() {
BasicAWSCredentials awsCredentials = new BasicAWSCredentials(accessKey, secretKey);
return AmazonS3ClientBuilder.standard()
.withRegion(region)
.withCredentials(new AWSStaticCredentialsProvider(awsCredentials))
.build();
}
}
18 changes: 17 additions & 1 deletion src/main/resources/application.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
spring.profiles.active: local

spring:
config:
import: classpath:/namu-backend-config/application.yml
import:
- classpath:logging/logging.yml
- classpath:database/database.yml
- classpath:external/external.yml
- classpath:token/token.yml
web.resources.add-mappings: false

---
spring.config.activate.on-profile: local

---
spring.config.activate.on-profile: dev

---
spring.config.activate.on-profile: prod
46 changes: 46 additions & 0 deletions src/main/resources/database/database.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
spring:
jpa:
open-in-view: false
hibernate:
ddl-auto: none
properties:
hibernate.default_batch_fetch_size: 100

---
spring.config.activate.on-profile: local

spring:
jpa:
hibernate:
ddl-auto: create
properties:
hibernate:
format_sql: true
show_sql: true
h2:
console:
enabled: true

---
spring.config.activate.on-profile: local-dev

spring:
jpa:
hibernate:
ddl-auto: validate
properties:
hibernate:
show_log: true
format_sql: true
show-sql: true

database:
datasource:
core:
driver-class-name: com.mysql.cj.jdbc.Driver
jdbc-url: jdbc:mysql://${db.database.core.url}
username: ${db.database.core.username}
password: ${db.database.core.password}

---
spring.config.activate.on-profile: prod
19 changes: 19 additions & 0 deletions src/main/resources/external/aws/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
version: "3"

services:
localstack:
image: localstack/localstack:0.12.6 # 혹시나 자동 버전업으로 인한 오류를 막기위해 tag 명시
container_name: localstack
ports:
- "4566:4566"
environment:
- SERVICES=s3
- DEBUG=1
- DATA_DIR=/tmp/localstack/data
- AWS_ACCESS_KEY_ID=access-key
- AWS_SECRET_ACCESS_KEY=secret-key
- AWS_REGION=us-east-1
volumes:
- "${TMPDIR:-/tmp/localstack}:/tmp/localstack" # localstack 이 생성하는 파일을 직접 편집하고 싶을 때
- "/var/run/docker.sock:/var/run/docker.sock"
- ./data:/opt/data
13 changes: 13 additions & 0 deletions src/main/resources/external/aws/localstack-start.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/bash

# shellcheck disable=SC2164
cd "$(dirname "$0")"

export SERVICES=s3 # 사용하는 서비스들을 필요 시 추가
export TMPDIR=/private$TMPDIR # temp directory 를 별도로 지정
export PORT_WEB_UI=8080

docker-compose up -d

docker-compose exec localstack bash
docker exec -it localstack bash
7 changes: 7 additions & 0 deletions src/main/resources/external/aws/localstack-terminate.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/bash

# 현재 스크립트가 위치한 디렉토리로 이동
# shellcheck disable=SC2164
cd "$(dirname "$0")"

docker-compose stop
22 changes: 22 additions & 0 deletions src/main/resources/external/external.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
feign:
client:
oauth:
kakao:
name: kakaoAuthApiCaller
url: https://kapi.kakao.com

firebase:
fcm:
config:
path: external/firebase/namu-firebase-adminsdk.json

cloud:
aws:
s3:
bucket-name: localstack-bucket
localstack:
endpoint: http://localhost:4566
bucket-name: localstack-bucket

image:
post-dir: complete_mission_post
Loading

0 comments on commit 1c4d2c1

Please sign in to comment.