Skip to content

Commit c95a8ea

Browse files
committed
# Conflicts: # build.gradle.kts # src/main/resources/application.yml
2 parents 0fe0f65 + a6a3cdc commit c95a8ea

File tree

8 files changed

+177
-32
lines changed

8 files changed

+177
-32
lines changed

.env.default

Whitespace-only changes.

.gitignore

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,4 +39,10 @@ out/
3939
### Custom ###
4040
db_dev.mv.db
4141
db_dev.trace.db
42-
.env
42+
.env
43+
44+
### Terraform ###
45+
/infra/terraform/.terraform
46+
/infra/terraform/.terraform.lock.hcl
47+
/infra/terraform/terraform.tfstate
48+
/infra/terraform/terraform.tfstate.backup

infra/terraform/main.tf

Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
terraform {
2+
// aws 라이브러리 불러옴
3+
required_providers {
4+
aws = {
5+
source = "hashicorp/aws"
6+
}
7+
}
8+
}
9+
10+
# 디폴드 리전 설정
11+
provider "aws" {
12+
region = "ap-northeast-2"
13+
}
14+
15+
# VPC_1
16+
resource "aws_vpc" "vpc_1" {
17+
cidr_block = "10.0.0.0/16"
18+
enable_dns_support = true
19+
enable_dns_hostnames = true
20+
21+
tags = {
22+
Name = "team5-vpc-1"
23+
}
24+
}
25+
26+
# 퍼블릭 서브넷 (Subnet_1)
27+
resource "aws_subnet" "subnet_1" {
28+
vpc_id = aws_vpc.vpc_1.id
29+
cidr_block = "10.0.1.0/24"
30+
availability_zone = "ap-northeast-2a"
31+
map_public_ip_on_launch = true # 퍼블릭 IP 자동 할당
32+
33+
tags = {
34+
Name = "team5-subnet-1-public"
35+
}
36+
}
37+
38+
# 프라이빗 서브넷 (Subnet_2)
39+
resource "aws_subnet" "subnet_2" {
40+
vpc_id = aws_vpc.vpc_1.id
41+
cidr_block = "10.0.2.0/24"
42+
availability_zone = "ap-northeast-2b"
43+
44+
tags = {
45+
Name = "team5-subnet-2-private"
46+
}
47+
}
48+
49+
# 인터넷 게이트 웨이
50+
resource "aws_internet_gateway" "igw_1" {
51+
vpc_id = aws_vpc.vpc_1.id
52+
53+
tags = {
54+
Name = "team5-igw-1"
55+
}
56+
}
57+
58+
# 라우팅 테이블
59+
resource "aws_route_table" "rt_1" {
60+
vpc_id = aws_vpc.vpc_1.id
61+
62+
# 모든 트래픽에 대해 인터넷 게이트웨이로 보냄
63+
route {
64+
cidr_block = "0.0.0.0/0"
65+
gateway_id = aws_internet_gateway.igw_1.id
66+
}
67+
68+
tags = {
69+
Name = "team5-rt-1"
70+
}
71+
}
72+
73+
resource "aws_route_table_association" "association_1" {
74+
# 연결할 서브넷
75+
subnet_id = aws_subnet.subnet_1.id
76+
77+
# 연결할 라우트 테이블 지정
78+
route_table_id = aws_route_table.rt_1.id
79+
}
80+
81+
resource "aws_route_table_association" "association_2" {
82+
# 연결할 서브넷
83+
subnet_id = aws_subnet.subnet_2.id
84+
85+
# 연결할 라우트 테이블 지정
86+
route_table_id = aws_route_table.rt_1.id
87+
}
88+
89+
resource "aws_security_group" "sg_1" {
90+
name = "team5-sg-1"
91+
description = "Allow SSH and HTTP"
92+
vpc_id = aws_vpc.vpc_1.id
93+
94+
ingress {
95+
from_port = 0
96+
to_port = 0
97+
protocol = "all" # 모든 프로토콜
98+
cidr_blocks = ["0.0.0.0/0"] # 모든 IP 허용
99+
}
100+
101+
egress {
102+
from_port = 0
103+
to_port = 0
104+
protocol = "all" # 모든 프로토콜
105+
cidr_blocks = ["0.0.0.0/0"] # 모든 IP 허용
106+
}
107+
}
108+
109+
resource "aws_instance" "ec2_1" {
110+
ami = "ami-077ad873396d76f6a"
111+
instance_type = "t2.micro"
112+
113+
subnet_id = aws_subnet.subnet_1.id
114+
vpc_security_group_ids = [aws_security_group.sg_1.id]
115+
116+
associate_public_ip_address = true
117+
118+
tags = {
119+
Name = "team5-ec2-1"
120+
}
121+
}

src/main/java/com/back/Application.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,4 @@ public static void main(String[] args) {
1212
SpringApplication.run(Application.class, args);
1313
}
1414

15-
}
15+
}

src/main/java/com/back/global/config/SpringDocConfig.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ public class SpringDocConfig {
1414
@Bean
1515
public GroupedOpenApi groupApiV1() {
1616
return GroupedOpenApi.builder()
17-
.group("apiV1")
18-
.pathsToMatch("/api/v1/**")
17+
.group("api")
18+
.pathsToMatch("/api/**")
1919
.build();
2020
}
2121
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
spring:
2+
datasource:
3+
url: jdbc:h2:./db_dev;MODE=MySQL
4+
driver-class-name: org.h2.Driver
5+
username: sa
6+
password:
7+
8+
config:
9+
import: optional:file:.env[.properties]
10+
11+
jpa:
12+
database-platform: org.hibernate.dialect.H2Dialect
13+
hibernate:
14+
ddl-auto: update # [none | validate | update | create | create-drop]
15+
show-sql: true
16+
properties:
17+
hibernate:
18+
format_sql: true
19+
highlight_sql: true
20+
use_sql_comments: true
21+
22+
springdoc:
23+
default-produces-media-type: application/json;charset=UTF-8
24+
25+
logging:
26+
level:
27+
org.hibernate.orm.jdbc.bind: trace
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
spring:
2+
jpa:
3+
database-platform: org.hibernate.dialect.MySQLDialect
4+
hibernate:
5+
ddl-auto: validate # [none | validate | update | create | create-drop]
6+
7+
config:
8+
import: optional:file:.env[.properties]
9+
10+
datasource:
11+
url: jdbc:mysql://${MYSQL_HOST}:3306/${MYSQL_DATABASE}?serverTimezone=Asia/Seoul&characterEncoding=UTF-8
12+
driver-class-name: com.mysql.cj.jdbc.Driver
13+
username: ${MYSQL_USERNAME}
14+
password: ${MYSQL_PASSWORD}
15+
16+
springdoc:
17+
default-produces-media-type: application/json;charset=UTF-8

src/main/resources/application.yml

Lines changed: 2 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -2,31 +2,5 @@ spring:
22
application:
33
name: catfe-backend
44

5-
datasource:
6-
url: jdbc:h2:./db_dev;MODE=MySQL
7-
driver-class-name: org.h2.Driver
8-
username: sa
9-
password:
10-
11-
config:
12-
import: optional:file:.env
13-
14-
jpa:
15-
database-platform: org.hibernate.dialect.H2Dialect
16-
hibernate:
17-
ddl-auto: update # [none | validate | update | create | create-drop]
18-
show-sql: true
19-
properties:
20-
hibernate:
21-
format_sql: true
22-
highlight_sql: true
23-
use_sql_comments: true
24-
25-
springdoc:
26-
default-produces-media-type: application/json;charset=UTF-8
27-
28-
logging:
29-
level:
30-
org.hibernate.orm.jdbc.bind: trace
31-
org.springframework.web.socket: DEBUG
32-
org.springframework.messaging: DEBUG
5+
profiles:
6+
active: dev

0 commit comments

Comments
 (0)