Skip to content

Commit 6ce4c62

Browse files
authored
feat: Redis Sorted Set 기반 대기열 가시화 및 입장 제어 구현 (#209)
* feat: Redis Sorted Set 기반 대기열 가시화 및 입장 제어 구현 * feat: Redis Sorted Set 기반 대기열 가시화 및 입장 제어 구현 * infra: Redis 이중화(Core/MQ) 및 모니터링 환경 구축 * feat: Redis Sorted Set 기반 대기열 및 입장 제어 구현
1 parent c48ab5f commit 6ce4c62

24 files changed

Lines changed: 710 additions & 319 deletions

.github/workflows/deploy.yml

Lines changed: 54 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -1,54 +1,54 @@
1-
name: Deploy to Amazon EC2
2-
3-
on:
4-
push:
5-
branches: [ "develop" ]
6-
pull_request:
7-
branches: [ "develop" ]
8-
9-
env:
10-
AWS_REGION: ${{ secrets.AWS_REGION }}
11-
S3_BUCKET_NAME: ${{ secrets.DEPLOY_S3_BUCKET_NAME }}
12-
CODE_DEPLOY_APPLICATION_NAME: trainus-codedeploy-app
13-
CODE_DEPLOY_DEPLOYMENT_GROUP_NAME: trainus-deploy-group
14-
15-
jobs:
16-
build-and-deploy:
17-
runs-on: ubuntu-latest
18-
steps:
19-
- uses: actions/checkout@v4
20-
21-
- name: Set up JDK 21
22-
uses: actions/setup-java@v4
23-
with:
24-
java-version: '21'
25-
distribution: 'temurin'
26-
27-
- name: Grant execute permission for gradlew
28-
run: chmod +x gradlew
29-
30-
- name: Build with Gradle
31-
run: ./gradlew build -x test
32-
33-
- name: Configure AWS credentials
34-
if: github.event_name == 'push'
35-
uses: aws-actions/configure-aws-credentials@v4
36-
with:
37-
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
38-
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
39-
aws-region: ${{ secrets.AWS_REGION }}
40-
41-
- name: Upload to S3
42-
if: github.event_name == 'push'
43-
run: |
44-
zip -r deploy.zip .
45-
aws s3 cp deploy.zip s3://$S3_BUCKET_NAME/deploy.zip
46-
47-
- name: CodeDeploy Deploy
48-
if: github.event_name == 'push'
49-
run: |
50-
aws deploy create-deployment \
51-
--application-name $CODE_DEPLOY_APPLICATION_NAME \
52-
--deployment-config-name CodeDeployDefault.OneAtATime \
53-
--deployment-group-name $CODE_DEPLOY_DEPLOYMENT_GROUP_NAME \
54-
--s3-location bucket=$S3_BUCKET_NAME,bundleType=zip,key=deploy.zip
1+
name: Deploy to Amazon EC2
2+
3+
on:
4+
push:
5+
branches: [ "develop" ]
6+
pull_request:
7+
branches: [ "develop" ]
8+
9+
env:
10+
AWS_REGION: ${{ secrets.AWS_REGION }}
11+
S3_BUCKET_NAME: ${{ secrets.DEPLOY_S3_BUCKET_NAME }}
12+
CODE_DEPLOY_APPLICATION_NAME: trainus-codedeploy-app
13+
CODE_DEPLOY_DEPLOYMENT_GROUP_NAME: trainus-deploy-group
14+
15+
jobs:
16+
build-and-deploy:
17+
runs-on: ubuntu-latest
18+
steps:
19+
- uses: actions/checkout@v4
20+
21+
- name: Set up JDK 21
22+
uses: actions/setup-java@v4
23+
with:
24+
java-version: '21'
25+
distribution: 'temurin'
26+
27+
- name: Grant execute permission for gradlew
28+
run: chmod +x gradlew
29+
30+
- name: Build with Gradle
31+
run: ./gradlew build -x test
32+
33+
- name: Configure AWS credentials
34+
if: github.event_name == 'push'
35+
uses: aws-actions/configure-aws-credentials@v4
36+
with:
37+
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
38+
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
39+
aws-region: ${{ secrets.AWS_REGION }}
40+
41+
- name: Upload to S3
42+
if: github.event_name == 'push'
43+
run: |
44+
zip -r deploy.zip .
45+
aws s3 cp deploy.zip s3://$S3_BUCKET_NAME/deploy.zip
46+
47+
- name: CodeDeploy Deploy
48+
if: github.event_name == 'push'
49+
run: |
50+
aws deploy create-deployment \
51+
--application-name $CODE_DEPLOY_APPLICATION_NAME \
52+
--deployment-config-name CodeDeployDefault.OneAtATime \
53+
--deployment-group-name $CODE_DEPLOY_DEPLOYMENT_GROUP_NAME \
54+
--s3-location bucket=$S3_BUCKET_NAME,bundleType=zip,key=deploy.zip

appspec.yml

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,27 @@
1-
version: 0.0
2-
os: linux
3-
files:
4-
- source: /
5-
destination: /home/ec2-user/app
6-
overwrite: yes
7-
8-
permissions:
9-
- object: /home/ec2-user/app
10-
pattern: "**"
11-
owner: ec2-user
12-
group: ec2-user
13-
mode: 755
14-
15-
hooks:
16-
BeforeInstall:
17-
- location: scripts/setup.sh
18-
timeout: 60
19-
runas: root
20-
ApplicationStop:
21-
- location: scripts/stop.sh
22-
timeout: 300
23-
runas: ec2-user
24-
AfterInstall:
25-
- location: scripts/start.sh
26-
timeout: 300
27-
runas: ec2-user
1+
version: 0.0
2+
os: linux
3+
files:
4+
- source: /
5+
destination: /home/ec2-user/app
6+
overwrite: yes
7+
8+
permissions:
9+
- object: /home/ec2-user/app
10+
pattern: "**"
11+
owner: ec2-user
12+
group: ec2-user
13+
mode: 755
14+
15+
hooks:
16+
BeforeInstall:
17+
- location: scripts/setup.sh
18+
timeout: 60
19+
runas: root
20+
ApplicationStop:
21+
- location: scripts/stop.sh
22+
timeout: 300
23+
runas: ec2-user
24+
AfterInstall:
25+
- location: scripts/start.sh
26+
timeout: 300
27+
runas: ec2-user

docker-compose-db.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
services:
22
postgres:
33
image: postgis/postgis:17-3.5
4-
container_name: dedicated-postgres
4+
container_name: postgres-db
55
restart: always
66
env_file:
77
- .env
Lines changed: 38 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -1,51 +1,38 @@
1-
services:
2-
redis:
3-
image: redis:7-alpine
4-
container_name: data-redis
5-
restart: always
6-
ports:
7-
- "6379:6379"
8-
command: redis-server --appendonly yes
9-
volumes:
10-
- ./redis-data:/data
11-
networks:
12-
- data-network
13-
14-
prometheus:
15-
image: prom/prometheus:v3.2.1
16-
container_name: data-prometheus
17-
restart: always
18-
volumes:
19-
- ./prometheus-grafana/prometheus/config/prometheus.yml:/etc/prometheus/prometheus.yml
20-
- ./prometheus-data:/prometheus
21-
ports:
22-
- "9090:9090"
23-
command:
24-
- '--config.file=/etc/prometheus/prometheus.yml'
25-
- '--storage.tsdb.path=/prometheus'
26-
- '--web.console.libraries=/usr/share/prometheus/console_libraries'
27-
- '--web.console.templates=/usr/share/prometheus/consoles'
28-
networks:
29-
- data-network
30-
31-
grafana:
32-
image: grafana/grafana:11.5.2
33-
container_name: data-grafana
34-
restart: always
35-
ports:
36-
- "3000:3000"
37-
volumes:
38-
- ./grafana-data:/var/lib/grafana
39-
environment:
40-
- GF_SECURITY_ADMIN_PASSWORD=admin
41-
networks:
42-
- data-network
43-
44-
networks:
45-
data-network:
46-
driver: bridge
47-
48-
volumes:
49-
redis-data:
50-
prometheus-data:
51-
grafana-data:
1+
services:
2+
monitoring-prometheus:
3+
image: prom/prometheus:v3.2.1
4+
container_name: monitoring-prometheus
5+
restart: always
6+
volumes:
7+
- ./prometheus-grafana/prometheus/config/prometheus.yml:/etc/prometheus/prometheus.yml
8+
- ./prometheus-data:/prometheus
9+
ports:
10+
- "9090:9090"
11+
command:
12+
- '--config.file=/etc/prometheus/prometheus.yml'
13+
- '--storage.tsdb.path=/prometheus'
14+
- '--web.console.libraries=/usr/share/prometheus/console_libraries'
15+
- '--web.console.templates=/usr/share/prometheus/consoles'
16+
networks:
17+
- monitoring-network
18+
19+
monitoring-grafana:
20+
image: grafana/grafana:11.5.2
21+
container_name: monitoring-grafana
22+
restart: always
23+
ports:
24+
- "3000:3000"
25+
volumes:
26+
- ./grafana-data:/var/lib/grafana
27+
environment:
28+
- GF_SECURITY_ADMIN_PASSWORD=admin
29+
networks:
30+
- monitoring-network
31+
32+
networks:
33+
monitoring-network:
34+
driver: bridge
35+
36+
volumes:
37+
prometheus-data:
38+
grafana-data:

docker-compose-redis.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
services:
2+
redis-core:
3+
image: redis:7-alpine
4+
container_name: redis-core
5+
restart: always
6+
ports:
7+
- "6379:6379"
8+
volumes:
9+
- ./redis-core-data:/data
10+
command: redis-server --appendonly yes
11+
networks:
12+
- redis-network
13+
14+
redis-mq:
15+
image: redis:7-alpine
16+
container_name: redis-mq
17+
restart: always
18+
ports:
19+
- "6380:6379"
20+
volumes:
21+
- ./redis-mq-data:/data
22+
command: redis-server --appendonly yes
23+
networks:
24+
- redis-network
25+
26+
networks:
27+
redis-network:
28+
driver: bridge
29+
30+
volumes:
31+
redis-core-data:
32+
redis-mq-data:

lombok.config

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
config.stopBubbling = true
2+
lombok.copyableAnnotations += org.springframework.beans.factory.annotation.Qualifier

0 commit comments

Comments
 (0)