Skip to content

Commit

Permalink
fix: 배포 CICD 테스트 (#76) (KAN-131)
Browse files Browse the repository at this point in the history
  • Loading branch information
ywonchae1 committed Nov 6, 2024
1 parent af3292c commit f879031
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 49 deletions.
11 changes: 0 additions & 11 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,16 +75,6 @@ jobs:
path: .env
remote_path: /home/${{ secrets.EC2_USERNAME }}/

- name: 서버로 traefik 정적 파일 전송
uses: burnett01/[email protected]
with:
switches: -avzr --delete
remote_host: ${{ secrets.EC2_HOST }}
remote_user: ${{ secrets.EC2_USERNAME }}
remote_key: ${{ secrets.EC2_PRIVATE_KEY }}
path: scripts/traefik.yml
remote_path: /home/${{ secrets.EC2_USERNAME }}/

- name: 서버로 docker compose 파일 전송
uses: burnett01/[email protected]
with:
Expand All @@ -106,6 +96,5 @@ jobs:
envs: IMAGE_FULL_URL, DOCKERHUB_IMAGE_NAME # docker-compose.yml 에서 사용할 환경 변수
script: |
echo "${{ secrets.DOCKERHUB_ACCESS_TOKEN }}" | docker login -u "${{ env.DOCKERHUB_USERNAME }}" --password-stdin
docker container restart traefik
docker compose down --remove-orphans
docker compose up --build -d
56 changes: 52 additions & 4 deletions scripts/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,52 @@
version: "3.3"
version: "3.8"

services:
traefik:
image: traefik:v3.1.4
command:
- --api.dashboard=true
- --log.level=INFO
#- --log.filepath=/var/log/traefik.log
- --accesslog=true
#- --accesslog.filepath=/var/log/traefik-access.log
- --providers.docker.network=proxy
- --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
# remove next line when using Traefik v2
- --entrypoints.websecure.asDefault=true
- --entrypoints.websecure.http.tls.certresolver=letsencrypt
- --certificatesresolvers.letsencrypt.acme.email=meonghanyang@gmail.com
- --certificatesresolvers.letsencrypt.acme.tlschallenge=true
- --certificatesresolvers.letsencrypt.acme.storage=/letsencrypt/acme.json
- --providers.docker.network=mhn-net
ports:
- target: 443
published: 443
protocol: tcp
mode: host
- target: 80
published: 80
protocol: tcp
mode: host
- target: 8080
published: 8000
protocol: tcp
mode: host
volumes:
- "/var/run/docker.sock:/var/run/docker.sock"
- "./acme.json:/letsencrypt/acme.json"
labels:
- "traefik.http.routers.dashboard.rule=Host(`api.test-wonchae.p-e.kr`) && PathPrefix(`/dashboard`)"
- "traefik.http.routers.dashboard.service=api@internal"
- "traefik.http.routers.dashboard.middlewares=auth"
- "traefik.http.middlewares.auth.basicauth.users=test:$$apr1$$H6uskkkW$$IgXLP6ewTrSuBkTrqE8wj/,test2:$$apr1$$d9hr9HBB$$4HxwgUir3HP4EsggP/QNo0"
- "traefik.docker.network=mhn-net"
networks:
- mhn-net

server:
image: ${IMAGE_FULL_URL}
container_name: ${DOCKERHUB_IMAGE_NAME}
Expand All @@ -13,11 +59,13 @@ services:
volumes:
- "./client_secret.json:/client_secret.json"
labels:
- "traefik.enable=true"
- "traefik.http.services.server.loadbalancer.server.port=8080"
- "traefik.http.routers.server.entrypoints=websecure"
- "traefik.http.routers.server.rule=Host(`api.test-wonchae.p-e.kr`)"
- "traefik.http.routers.server.tls=true"
- "traefik.http.routers.server.tls.certresolver=myresolver"
- "traefik.http.routers.server.service=server"
# - "traefik.http.services.server.loadbalancer.server.port=8080"
- "traefik.http.routers.server.tls.certresolver=letsencrypt"
- "traefik.docker.network=mhn-net"
networks:
- mhn-net

Expand Down
34 changes: 0 additions & 34 deletions scripts/traefik.yml

This file was deleted.

0 comments on commit f879031

Please sign in to comment.