Skip to content

Commit 1334d93

Browse files
authored
Revert "Load-Balancer 서버 구현 (#5)" (#8)
This reverts commit 8916395.
1 parent 8916395 commit 1334d93

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+326
-1489
lines changed

docker-compose.override.yml

Lines changed: 7 additions & 123 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
version: "3.8"
2+
13
services:
24
mysql:
35
image: mysql:8.0
@@ -21,84 +23,14 @@ services:
2123
retries: 3
2224
command: --bind-address=0.0.0.0
2325

24-
collaborative_room1:
26+
collaborative:
2527
build:
2628
context: .
2729
dockerfile: ./packages/collaborative/Dockerfile
28-
container_name: collaborative-room1
30+
container_name: collaborative
2931
ports:
3032
- "3001:3001"
3133
- "9001:9001"
32-
depends_on:
33-
redis:
34-
condition: service_healthy
35-
mysql:
36-
condition: service_healthy
37-
mongodb:
38-
condition: service_healthy
39-
environment:
40-
- MYSQL_HOST=mysql-container
41-
- MYSQL_PORT=3306
42-
- MYSQL_DATABASE=dev_db
43-
- MYSQL_PASSWORD=1234
44-
- MYSQL_USER=honey
45-
- NODE_ENV=dev
46-
- MONGO_HOST=mongodb-container
47-
- MONGO_USER=honey
48-
- MONGO_PASSWORD=1234
49-
- MONGO_DB=dev_db
50-
- LOG_LEVEL=debug
51-
- REDIS_HOST=redis-container
52-
- REDIS_USERNAME=honey
53-
- REDIS_PORT=6530
54-
- REDIS_PASSWORD=1234
55-
- SERVER_ID=room1
56-
- WS_PORT=9001
57-
networks:
58-
- app-network
59-
60-
collaborative_room2:
61-
build:
62-
context: .
63-
dockerfile: ./packages/collaborative/Dockerfile
64-
container_name: collaborative-room2
65-
ports:
66-
- "3002:3002"
67-
- "9002:9002"
68-
depends_on:
69-
redis:
70-
condition: service_healthy
71-
mysql:
72-
condition: service_healthy
73-
mongodb:
74-
condition: service_healthy
75-
environment:
76-
- MYSQL_HOST=mysql-container
77-
- MYSQL_PORT=3306
78-
- MYSQL_DATABASE=dev_db
79-
- MYSQL_PASSWORD=1234
80-
- MYSQL_USER=honey
81-
- NODE_ENV=dev
82-
- MONGO_HOST=mongodb-container
83-
- MONGO_USER=honey
84-
- MONGO_PASSWORD=1234
85-
- MONGO_DB=dev_db
86-
- LOG_LEVEL=debug
87-
- REDIS_HOST=redis-container
88-
- REDIS_USERNAME=honey
89-
- REDIS_PORT=6530
90-
- REDIS_PASSWORD=1234
91-
- SERVER_ID=room2
92-
- WS_PORT=9002
93-
networks:
94-
- app-network
95-
api:
96-
build:
97-
context: .
98-
dockerfile: ./packages/api/Dockerfile
99-
container_name: api
100-
ports:
101-
- "3000:3000"
10234
depends_on:
10335
mysql:
10436
condition: service_healthy
@@ -115,7 +47,7 @@ services:
11547
- MONGO_USER=honey
11648
- MONGO_PASSWORD=1234
11749
- MONGO_DB=dev_db
118-
- LOG_LEVEL=debug
50+
- LOG_LEVEL=info
11951
networks:
12052
- app-network
12153
api:
@@ -145,44 +77,20 @@ services:
14577
networks:
14678
- app-network
14779

148-
load-balancer:
149-
build:
150-
context: .
151-
dockerfile: ./packages/loadbalancer/Dockerfile
152-
container_name: lb-container
153-
ports:
154-
- "4242:4242"
155-
depends_on:
156-
redis:
157-
condition: service_healthy
158-
networks:
159-
- app-network
160-
environment:
161-
- LOG_LEVEL=debug
162-
- REDIS_HOST=redis-container
163-
- REDIS_USERNAME=honey
164-
- REDIS_PORT=6530
165-
- REDIS_PASSWORD=1234
166-
167-
frotend:
80+
frontend:
16881
build:
16982
context: .
17083
dockerfile: ./packages/frontend/Dockerfile
17184
container_name: frontend
17285
ports:
17386
- "80:80"
17487
depends_on:
175-
load-balancer:
176-
condition: service_started
177-
collaborative_room1:
178-
condition: service_started
179-
collaborative_room2:
88+
collaborative:
18089
condition: service_started
18190
api:
18291
condition: service_started
18392
networks:
18493
- app-network
185-
18694
mongodb:
18795
image: mongo:latest
18896
container_name: mongodb-container
@@ -214,30 +122,6 @@ services:
214122
timeout: 5s
215123
retries: 10
216124

217-
redis:
218-
image: redis:latest
219-
container_name: redis-container
220-
ports:
221-
- "6530:6530"
222-
networks:
223-
- app-network
224-
environment:
225-
REDIS_DISABLE_COMMANDS: "FLUSHDB FLUSHALL"
226-
command:
227-
[
228-
"redis-server",
229-
"--port",
230-
"6530",
231-
"--requirepass",
232-
"1234",
233-
"--bind",
234-
"0.0.0.0",
235-
]
236-
healthcheck:
237-
test: ["CMD", "redis-cli", "-p", "6530", "ping"]
238-
interval: 10s
239-
timeout: 5s
240-
retries: 3
241125
volumes:
242126
mysql_data:
243127
mongo_data:

docker-compose.prod.yml

Lines changed: 2 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -8,64 +8,14 @@ services:
88
curl -f telnet://${MYSQL_HOST}:${MYSQL_PORT} || exit 1;
99
curl -f telnet://${MONGO_HOST}:27017 || exit 1;
1010
"
11+
networks:
12+
- app-network
1113
healthcheck:
1214
test: ["CMD", "/bin/sh", "-c", "exit 0"]
1315
interval: 10s
1416
timeout: 5s
1517
retries: 3
1618

17-
loadbalancer:
18-
container_name: loadbalancer
19-
ports:
20-
- "4242:4242"
21-
build:
22-
target: production
23-
environment:
24-
# 배포 환경 세팅
25-
- NODE_ENV=production
26-
27-
# Mongo 세팅
28-
- LOG_LEVEL=${LOG_LEVEL}
29-
30-
# Redis 세팅
31-
- REDIS_USERNAME=${REDIS_USERNAME}
32-
- REDIS_PASSWORD=${REDIS_PASSWORD}
33-
- REDIS_HOST=${REDIS_HOST}
34-
- REDIS_PORT=${REDIS_PORT}
35-
networks:
36-
- app-network
37-
38-
collaborative:
39-
container_name: collaborative
40-
ports:
41-
- "9001:9001"
42-
build:
43-
target: production
44-
environment:
45-
# 배포 환경 세팅
46-
- NODE_ENV=production
47-
48-
# MySQL 세팅
49-
- MYSQL_HOST=${MYSQL_HOST}
50-
- MYSQL_PORT=${MYSQL_PORT}
51-
- MYSQL_USER=${MYSQL_USER}
52-
- MYSQL_PASSWORD=${MYSQL_PASSWORD}
53-
- MYSQL_DATABASE=${MYSQL_DATABASE}
54-
55-
# Mongo 세팅
56-
- MONGO_HOST=${MONGO_HOST}
57-
- MONGO_USER=${MONGO_USER}
58-
- MONGO_PASSWORD=${MONGO_PASSWORD}
59-
- MONGO_DB=${MONGO_DB}
60-
- LOG_LEVEL=${LOG_LEVEL}
61-
62-
# Redis 세팅
63-
- REDIS_USERNAME=${REDIS_USERNAME}
64-
- REDIS_PASSWORD=${REDIS_PASSWORD}
65-
- REDIS_HOST=${REDIS_HOST}
66-
- REDIS_PORT=${REDIS_PORT}
67-
networks:
68-
- app-network
6919
api:
7020
container_name: api
7121
ports:

docker-compose.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,24 @@
1+
services:
2+
api:
3+
build:
4+
context: .
5+
dockerfile: ./packages/api/Dockerfile
6+
restart: unless-stopped
7+
environment:
8+
- NODE_ENV=development
9+
networks:
10+
- app-network
11+
12+
frontend:
13+
build:
14+
context: .
15+
dockerfile: ./packages/frontend/Dockerfile
16+
restart: unless-stopped
17+
environment:
18+
- NODE_ENV=development
19+
networks:
20+
- app-network
21+
122
networks:
223
app-network:
324
driver: bridge

packages/.env.example

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ MONGO_USER=your-mongo-username
1111
MONGO_PASSWORD=your-mongo-password
1212
MONGO_DB=your-mongo-database
1313

14-
# Redis 설정
14+
# Redis 설정 (추가된 telnet 기반 체크를 위해 필요)
1515
REDIS_HOST=your-redis-host
1616
REDIS_PORT=6379
1717

packages/api/src/app.module.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import { getTypeOrmConfig } from './common/config/typeorm.config';
88
import { NoteModule } from './note/note.module';
99
import { SpaceModule } from './space/space.module';
1010
import { TestModule } from './test/test.module';
11-
import { ValidationModule } from './common/validation/validation.module';
1211

1312
@Module({
1413
imports: [
@@ -23,9 +22,8 @@ import { ValidationModule } from './common/validation/validation.module';
2322
inject: [ConfigService],
2423
useFactory: getTypeOrmConfig,
2524
}),
26-
ValidationModule,
27-
NoteModule,
2825
SpaceModule,
26+
NoteModule,
2927
TestModule,
3028
],
3129
})

packages/api/src/common/validation/validation.module.ts

Lines changed: 0 additions & 17 deletions
This file was deleted.

packages/api/src/common/validation/validation.service.spec.ts

Lines changed: 0 additions & 18 deletions
This file was deleted.

packages/api/src/common/validation/validation.service.ts

Lines changed: 0 additions & 58 deletions
This file was deleted.

0 commit comments

Comments
 (0)