-
Notifications
You must be signed in to change notification settings - Fork 1
[DEPLOY] 백엔드 v2.1.1 배포 #241
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
ca816b4
[FEAT] 웹소켓을 활용한 정보 공유 파이프라인 구현 (#221)
coli-geonwoo 563db63
[FEAT] 미완료된 투표 완료 처리 (#227)
unifolio0 dcba2c9
[FEAT] 기관별 템플릿 조회 기능 구현 (#228)
leegwichan 6e6e123
[CHORE] 무중단 배포 (#226)
unifolio0 e118bad
[FEAT] 기관별 템플릿 조회 기능 구현 (#229)
leegwichan 3bd25cf
[CHORE] NoSuchMethodError를 openapi 버전이 호환되도록 수정하여 해결 (#231)
coli-geonwoo 4c0045b
[Test] 시간 기반 테스트 수정 (#232)
leegwichan 068748b
[REFACTOR] 인프라 구조를 Docker로 전환 (#237)
leegwichan 7584705
[CHORE] 팀이름 최대 길이를 15자로 수정 (#239)
coli-geonwoo b531985
[REFACTOR] 인프라 구조를 Docker로 전환 - 2 (#240)
leegwichan File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| FROM eclipse-temurin:17-jdk-alpine AS builder | ||
| WORKDIR /workspace | ||
| ARG JAR_FILE=build/libs/*.jar | ||
| COPY ${JAR_FILE} app.jar | ||
| RUN java -Djarmode=layertools -jar app.jar extract | ||
|
|
||
| FROM eclipse-temurin:17-jre-alpine | ||
| WORKDIR /workspace | ||
|
|
||
| ADD https://dtdg.co/latest-java-tracer ./dd-java-agent.jar | ||
|
|
||
| COPY --from=builder /workspace/dependencies/ ./ | ||
| COPY --from=builder /workspace/spring-boot-loader/ ./ | ||
| COPY --from=builder /workspace/snapshot-dependencies/ ./ | ||
| COPY --from=builder /workspace/application/ ./ | ||
|
|
||
| ENTRYPOINT ["java", "-javaagent:./dd-java-agent.jar", "org.springframework.boot.loader.launch.JarLauncher"] | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,54 @@ | ||
| services: | ||
| application: | ||
| image: debatetimer/debate_timer:${ENV:-dev} | ||
| container_name: application | ||
| environment: | ||
| - SERVER_FORWARD_HEADERS_STRATEGY=framework | ||
| - SPRING_PROFILES_ACTIVE=${ENV:-dev},monitor | ||
| - TZ=Asia/Seoul | ||
|
|
||
| - DD_AGENT_HOST=datadog-agent | ||
| - DD_SERVICE=debate-timer | ||
| - DD_ENV=${ENV:-dev} | ||
| - DD_VERSION=${APP_VERSION:-1.0.0} | ||
| - DD_LOGS_INJECTION=true | ||
| - DD_PROFILING_ENABLED=true | ||
| - DD_PROFILING_ALLOCATION_ENABLED=true | ||
| - DD_PROFILING_HEAP_ENABLED=true | ||
|
|
||
| - MANAGEMENT_STATSD_METRICS_EXPORT_ENABLED=true | ||
| - MANAGEMENT_STATSD_METRICS_EXPORT_FLAVOR=datadog | ||
| - MANAGEMENT_STATSD_METRICS_EXPORT_HOST=datadog-agent | ||
| - MANAGEMENT_STATSD_METRICS_EXPORT_PORT=8125 | ||
| - MANAGEMENT_STATSD_METRICS_EXPORT_PROTOCOL=UDP | ||
|
|
||
| networks: | ||
| - debate-timer-net | ||
|
|
||
| depends_on: | ||
| traefik: | ||
| condition: service_healthy | ||
|
|
||
| healthcheck: | ||
| test: [ "CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://localhost:8083/monitoring/health" ] | ||
leegwichan marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| interval: 60s | ||
| retries: 10 | ||
| start_period: 450s | ||
|
|
||
| labels: | ||
| - "traefik.enable=true" | ||
| - "traefik.http.routers.application.rule=Host(`api.${ENV:-dev}.debate-timer.com`)" | ||
| - "traefik.http.routers.application.entrypoints=websecure" | ||
| - "traefik.http.routers.application.tls=true" | ||
| - "traefik.http.routers.application.tls.certresolver=myresolver" | ||
| - "traefik.http.routers.application.service=application" | ||
| - "traefik.http.services.application.loadbalancer.server.port=8080" | ||
|
|
||
| - "traefik.http.routers.application-monitor.rule=PathPrefix(`/`)" | ||
| - "traefik.http.routers.application-monitor.entrypoints=monitoring" | ||
| - "traefik.http.routers.application-monitor.service=application-monitor-svc" | ||
| - "traefik.http.services.application-monitor-svc.loadbalancer.server.port=8083" | ||
|
|
||
| - "com.datadoghq.ad.logs=[{\"source\": \"java\", \"service\": \"debate-timer\"}]" | ||
|
|
||
| restart: unless-stopped | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| services: | ||
| datadog-agent: | ||
| image: gcr.io/datadoghq/agent:7 | ||
| container_name: datadog-agent | ||
| environment: | ||
| - DD_API_KEY=${DD_API_KEY} | ||
| - DD_SITE=us5.datadoghq.com | ||
| - DD_HOSTNAME=debate-timer-${ENV:-dev}-server | ||
| - DD_APM_ENABLED=true | ||
| - DD_APM_NON_LOCAL_TRAFFIC=true | ||
| - DD_APM_IGNORE_RESOURCES=/monitoring/health | ||
| - DD_DOGSTATSD_NON_LOCAL_TRAFFIC=true | ||
| - DD_LOGS_ENABLED=true | ||
| - DD_LOGS_CONFIG_CONTAINER_COLLECT_ALL=true | ||
| - DD_PROCESS_AGENT_ENABLED=true | ||
| - DD_TAGS=env:${ENV:-dev},project:debate-timer | ||
| ports: | ||
| - "8125:8125/udp" # Metrics (StatsD) | ||
| - "8126:8126/tcp" # APM (Trace) | ||
| volumes: | ||
| - /var/run/docker.sock:/var/run/docker.sock:ro # 로그 수집 필수 | ||
| - /proc/:/host/proc/:ro | ||
| - /sys/fs/cgroup/:/host/sys/fs/cgroup/:ro | ||
| networks: | ||
| - debate-timer-net | ||
| healthcheck: | ||
| test: ["CMD", "agent", "health"] | ||
| interval: 60s | ||
| timeout: 30s | ||
| retries: 5 | ||
| start_period: 120s |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| name: debate-timer-server | ||
|
|
||
| include: | ||
| - ./application/docker-compose.application.yml | ||
| - ./datadog/docker-compose.datadog.yml | ||
| - ./traefik/docker-compose.traefik.yml | ||
| - ./webhook/docker-compose.webhook.yml | ||
|
|
||
| networks: | ||
| debate-timer-net: | ||
| name: debate-timer-net | ||
| driver: bridge |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| services: | ||
| traefik: | ||
| image: traefik:v2.11 | ||
| container_name: traefik | ||
| ports: | ||
| - "80:80" | ||
| - "443:443" | ||
| - "8080:8080" | ||
| - "8083:8083" | ||
| environment: | ||
| - DOCKER_API_VERSION=1.44 | ||
| command: | ||
| - "--api.insecure=true" | ||
leegwichan marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| - "--ping=true" | ||
| - "--log.level=INFO" | ||
| - "--providers.docker=true" | ||
| - "--providers.docker.exposedbydefault=false" | ||
|
|
||
| - "--entrypoints.web.address=:80" | ||
| - "--entrypoints.web.http.redirections.entryPoint.to=websecure" | ||
| - "--entrypoints.web.http.redirections.entryPoint.scheme=https" | ||
| - "--entrypoints.websecure.address=:443" | ||
|
|
||
| - "--certificatesresolvers.myresolver.acme.tlschallenge=true" | ||
| - "--certificatesresolvers.myresolver.acme.email=debatetimekeeping@gmail.com" | ||
| - "--certificatesresolvers.myresolver.acme.storage=/letsencrypt/acme.json" | ||
|
|
||
| - "--entrypoints.monitoring.address=:8083" | ||
| healthcheck: | ||
| test: ["CMD", "wget", "--spider", "--quiet", "http://localhost:8080/ping"] | ||
| interval: 60s | ||
| timeout: 10s | ||
| retries: 5 | ||
| start_period: 120s | ||
| volumes: | ||
| - /var/run/docker.sock:/var/run/docker.sock:ro | ||
| - ../../letsencrypt:/letsencrypt | ||
| networks: | ||
| - debate-timer-net | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| services: | ||
| webhook: | ||
| build: | ||
| context: .. | ||
| dockerfile: ./webhook/webhook.Dockerfile | ||
| container_name: webhook | ||
| user: root | ||
leegwichan marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| command: ["-verbose", "-hooks=/etc/webhook/hooks.json", "-hotreload"] | ||
| environment: | ||
| - ENV=${ENV:-dev} | ||
| - SECRET_TOKEN=${WEBHOOK_KEY} | ||
| labels: | ||
| - "traefik.enable=true" | ||
| - "traefik.http.routers.webhook.rule=Host(`webhook.${ENV:-dev}.debate-timer.com`)" | ||
| - "traefik.http.routers.webhook.entrypoints=websecure" | ||
| - "traefik.http.routers.webhook.tls=true" | ||
| - "traefik.http.routers.webhook.tls.certresolver=myresolver" | ||
| - "traefik.http.services.webhook.loadbalancer.server.port=9000" | ||
| volumes: | ||
| - /var/run/docker.sock:/var/run/docker.sock | ||
leegwichan marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| - /home/ubuntu/.docker:/root/.docker:ro | ||
| - ./hooks.json:/etc/webhook/hooks.json | ||
| - ../..:/home/ubuntu/debate-timer | ||
| networks: | ||
| - debate-timer-net | ||
| depends_on: | ||
| traefik: | ||
| condition: service_healthy | ||
| healthcheck: | ||
| test: ["CMD-SHELL", "nc -z localhost 9000 || exit 1"] | ||
| interval: 120s | ||
| timeout: 30s | ||
| retries: 5 | ||
| start_period: 30s | ||
| restart: always | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,38 @@ | ||
| [ | ||
| { | ||
| "id": "deploy", | ||
| "http-methods": ["POST"], | ||
| "execute-command": "/home/ubuntu/debate-timer/scripts/deploy/deploy-docker.sh", | ||
| "command-working-directory": "/home/ubuntu/debate-timer", | ||
| "pass-environment-to-command": [ | ||
| { | ||
| "source": "header", | ||
| "name": "X-Deploy-Token", | ||
| "envname": "REQUEST_TOKEN" | ||
| } | ||
| ], | ||
| "pass-arguments-to-command": [ | ||
| { "source": "entire-payload" } | ||
| ] | ||
| }, | ||
| { | ||
| "id": "status", | ||
| "http-methods": ["GET"], | ||
| "execute-command": "/home/ubuntu/debate-timer/scripts/deploy/check-deploy-status.sh", | ||
| "command-working-directory": "/home/ubuntu/debate-timer", | ||
| "include-command-output-in-response": true, | ||
| "response-headers": [ | ||
| { | ||
| "name": "Content-Type", | ||
| "value": "application/json" | ||
| } | ||
| ], | ||
| "pass-environment-to-command": [ | ||
| { | ||
| "source": "header", | ||
| "name": "X-Deploy-Token", | ||
| "envname": "REQUEST_TOKEN" | ||
| } | ||
| ] | ||
| } | ||
| ] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| FROM almir/webhook:2.8.3 | ||
| USER root | ||
| RUN apk add --no-cache docker-cli-compose curl bash util-linux git | ||
leegwichan marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| WORKDIR /etc/webhook | ||
|
|
||
| RUN git config --global --add safe.directory /home/ubuntu/debate-timer | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| upstream debate_timer_backend { | ||
| server 127.0.0.1:8080; | ||
| keepalive 32; | ||
| } | ||
|
|
||
| server { | ||
| server_name api.dev.debate-timer.com; | ||
|
|
||
| location / { | ||
| proxy_pass http://debate_timer_backend; | ||
| proxy_set_header Host $host; | ||
| proxy_set_header X-Real-IP $remote_addr; | ||
| proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | ||
| proxy_set_header X-Forwarded-Proto $scheme; | ||
| } | ||
|
|
||
| listen [::]:443 ssl ipv6only=on; # managed by Certbot | ||
| listen 443 ssl; # managed by Certbot | ||
| ssl_certificate /etc/letsencrypt/live/api.dev.debate-timer.com/fullchain.pem; # managed by Certbot | ||
| ssl_certificate_key /etc/letsencrypt/live/api.dev.debate-timer.com/privkey.pem; # managed by Certbot | ||
| include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot | ||
| ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot | ||
| } | ||
|
|
||
| server { | ||
| if ($host = api.dev.debate-timer.com) { | ||
| return 308 https://$host$request_uri; | ||
| } # managed by Certbot | ||
|
|
||
| listen 80; | ||
| listen [::]:80; | ||
| server_name api.dev.debate-timer.com; | ||
| return 404; # managed by Certbot | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.