From 60e986531aa912584f2805a18850a2ae60bcca3d Mon Sep 17 00:00:00 2001 From: mulmuri <68294539+mulmuri@users.noreply.github.com> Date: Tue, 7 Nov 2023 16:51:08 +0900 Subject: [PATCH] add hotfix workflow --- .github/workflows/deploy.hotfix.yml | 49 +++++++++++++++++++++++++++++ Makefile | 6 +++- deploy/docker-compose.hotfix.yml | 17 ++++++++++ 3 files changed, 71 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/deploy.hotfix.yml create mode 100644 deploy/docker-compose.hotfix.yml diff --git a/.github/workflows/deploy.hotfix.yml b/.github/workflows/deploy.hotfix.yml new file mode 100644 index 0000000..9c0fe1b --- /dev/null +++ b/.github/workflows/deploy.hotfix.yml @@ -0,0 +1,49 @@ +name: Deploy Backend on Integration Server + +on: + push: + branches: + - hotfix + - feature/cicd + +env: + HOST: ${{ secrets.HOST }} + USERNAME: ${{ secrets.USERNAME }} + KEY: ${{ secrets.SSH_KEY }} + PORT: ${{ secrets.PORT }} + INSTANCE_PATH: ./backend-hotfix + +jobs: + test: + runs-on: ubuntu-latest + steps: + - name: Test + run: | + echo "test is skipped" + + deploy: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Send + uses: appleboy/scp-action@master + with: + host: ${{ env.HOST }} + username: ${{ env.USERNAME }} + key: ${{ env.KEY }} + port: ${{ env.PORT }} + source: "." + target: ${{ env.INSTANCE_PATH }} + + - name: Deploy + uses: appleboy/ssh-action@master + with: + host: ${{ env.HOST }} + username: ${{ env.USERNAME }} + key: ${{ env.KEY }} + port: ${{ env.PORT }} + script: | + cd ${{ env.INSTANCE_PATH }} + make build-hotfix diff --git a/Makefile b/Makefile index 411728d..d7e5dc5 100644 --- a/Makefile +++ b/Makefile @@ -7,4 +7,8 @@ build-prod: build-intg: docker compose -p backend-intg -f ./deploy/docker-compose.intg.yml down - docker compose -p backend-intg -f ./deploy/docker-compose.intg.yml up --build -d \ No newline at end of file + docker compose -p backend-intg -f ./deploy/docker-compose.intg.yml up --build -d + +build-hotfix: + docker compose -p backend-hotfix -f ./deploy/docker-compose.hotfix.yml down + docker compose -p backend-hotfix -f ./deploy/docker-compose.hotfix.yml up --build -d \ No newline at end of file diff --git a/deploy/docker-compose.hotfix.yml b/deploy/docker-compose.hotfix.yml new file mode 100644 index 0000000..3a464d5 --- /dev/null +++ b/deploy/docker-compose.hotfix.yml @@ -0,0 +1,17 @@ +services: + api: + container_name: prayhelper-server-hotfix + build: + context: ../ + dockerfile: ./deploy/Dockerfile + image: prayhelper-server-hotfix + ports: + - "4008:5000" + volumes: + - ../:/app + environment: + FLASK_APP: app + APP_CONFIG_FILE: config/hotfixuction.py + FLASK_DEBUG: "false" + TZ: "Asia/Seoul" + command: ["python3", "-m", "flask", "run", "--host=0.0.0.0"]