From 534e76dc9bdca72f64fac51de919689c2956181d Mon Sep 17 00:00:00 2001 From: Choi Jun Ho Date: Sat, 11 May 2024 15:59:31 +0900 Subject: [PATCH 1/2] =?UTF-8?q?fix(CI/CD)=20:=20=ED=8C=8C=EC=9D=BC=20?= =?UTF-8?q?=EC=8B=A4=ED=96=89=20=EC=97=90=EB=9F=AC=20=ED=95=B4=EA=B2=B0.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/cd.yml | 4 ++-- .github/workflows/ci.yml | 3 +-- script/deploy.sh | 2 +- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index fcc3de6..31f756f 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -1,4 +1,4 @@ -name: Java CI with Gradle +name: SpringBoot deploy with Docker on: # after merge to main with pr @@ -63,7 +63,7 @@ jobs: script: | cd /home/${{ secrets.REMOTE_USERNAME }}/gdsc-project/script chmod +x deploy.sh - ./deploy.sh + sudo ./deploy.sh dependency-submission: runs-on: ubuntu-latest diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7c68834..27d038f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,7 +1,6 @@ -name: Java CI with Gradle +name: SpringBoot test with Redis on: - # after merge to main with pr pull_request: types: [ opened, synchronize, reopened ] branches: [ "develop" ] diff --git a/script/deploy.sh b/script/deploy.sh index a41ebc6..3f6b892 100644 --- a/script/deploy.sh +++ b/script/deploy.sh @@ -4,4 +4,4 @@ cd .. docker-compose -f docker-compose.dev.yaml up --build -d -docker-compose ps +docker-compose -f docker-compose.dev.yaml ps From f6787d2f0ba28745ec8b31ed41159300ba7b8757 Mon Sep 17 00:00:00 2001 From: Choi Jun Ho Date: Sat, 11 May 2024 17:43:57 +0900 Subject: [PATCH 2/2] =?UTF-8?q?fix(CI/CD)=20:=20=ED=99=98=EA=B2=BD=20?= =?UTF-8?q?=EB=B3=80=EC=88=98=20=EB=AC=B8=EC=A0=9C=20=ED=95=B4=EA=B2=B0.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/cd.yml | 13 +++++-------- docker-compose.dev.yaml | 7 +++++++ 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index 31f756f..f0fe8ac 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -22,13 +22,6 @@ jobs: - name: Build with Gradle Wrapper run: ./gradlew build -x test - env: - REDIS_HOST: ${{ secrets.REDIS_HOST }} - REDIS_PORT: ${{ secrets.REDIS_PORT }} - GOOGLE_CLIENT_ID: ${{ secrets.GOOGLE_CLIENT_ID }} - GOOGLE_CLIENT_SECRET: ${{ secrets.GOOGLE_CLIENT_SECRET }} - GOOGLE_REDIRECT_URI: ${{ secrets.GOOGLE_REDIRECT_URI }} - JWT_SECRET: ${{ secrets.JWT_SECRET }} - name: Login to Docker Hub uses: docker/login-action@v2 @@ -43,7 +36,11 @@ jobs: - name: Modify docker-compose.dev.yaml run: | - sed -i "s|REPLACE_IMAGE_TAG|${{ secrets.DOCKERHUB_USERNAME }}/${{ secrets.DOCKER_REPOSITORY }}:${{ github.sha }}|g" docker-compose.dev.yaml + sed -i "s|REPLACE_IMAGE_TAG|${{ secrets.DOCKERHUB_USERNAME }}/${{ secrets.DOCKER_REPOSITORY }}:${{ github.sha }}|g" docker-compose.dev.yaml && + sed -i "s|REPLACE_GOOGLE_CLIENT_ID|${{ secrets.GOOGLE_CLIENT_ID }}|g" docker-compose.dev.yaml && + sed -i "s|REPLACE_GOOGLE_CLIENT_SECRET|${{ secrets.GOOGLE_CLIENT_SECRET }}|g" docker-compose.dev.yaml && + sed -i "s|REPLACE_GOOGLE_REDIRECT_URI|${{ secrets.GOOGLE_REDIRECT_URI }}|g" docker-compose.dev.yaml && + sed -i "s|REPLACE_JWT_SECRET|${{ secrets.JWT_SECRET }}|g" docker-compose.dev.yaml - name: Send script to remote server uses: appleboy/scp-action@master diff --git a/docker-compose.dev.yaml b/docker-compose.dev.yaml index feae087..bf17b9c 100644 --- a/docker-compose.dev.yaml +++ b/docker-compose.dev.yaml @@ -9,6 +9,13 @@ services: gradingx-server: image: REPLACE_IMAGE_TAG + environment: + - REDIS_HOST=localhost + - REDIS_PORT=6379 + - GOOGLE_CLIENT_ID=REPLACE_GOOGLE_CLIENT_ID + - GOOGLE_CLIENT_SECRET=REPLACE_GOOGLE_CLIENT_SECRET + - GOOGLE_REDIRECT_URI=REPLACE_GOOGLE_REDIRECT_URI + - JWT_SECRET=REPLACE_JWT_SECRET ports: - "8080:8080" depends_on: