From c1b007d4a1581cc2a041a9f4d4a0839522404c39 Mon Sep 17 00:00:00 2001 From: fewensa <37804932+fewensa@users.noreply.github.com> Date: Thu, 30 May 2024 20:56:09 +0800 Subject: [PATCH 1/7] Try deploy --- .../workflows/{publish.yml => release.yml} | 24 +++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) rename .github/workflows/{publish.yml => release.yml} (71%) diff --git a/.github/workflows/publish.yml b/.github/workflows/release.yml similarity index 71% rename from .github/workflows/publish.yml rename to .github/workflows/release.yml index 4590869..3a2d1a8 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/release.yml @@ -11,8 +11,8 @@ env: DOCKER_REGISTRY: ghcr.io jobs: - publish-indexer: - name: Publish indexer + publish-docker-image: + name: Publish runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 @@ -69,3 +69,23 @@ jobs: ${{ env.DOCKER_REGISTRY }}/${{ github.repository }}/ponder:${{ steps.tag-name.outputs.tag }} + deploy-railway: + name: Deploy railway + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + + - name: Deploy apollo-prd + uses: fewensa/railway-deploy@main + if: startsWith(github.ref, 'refs/tags/v') + with: + railway_token: ${{ secrets.RAILWAY_TOKEN_PRD }} + service: "apollo-prd" + + - name: Deploy apollo-stg + uses: fewensa/railway-deploy@main + if: ${{ !startsWith(github.ref, 'refs/tags/v') }} + with: + railway_token: ${{ secrets.RAILWAY_TOKEN_STG }} + service: "apollo-stg" + From 68499de13184c9592cf80c32c27e17e2f850c4d8 Mon Sep 17 00:00:00 2001 From: fewensa <37804932+fewensa@users.noreply.github.com> Date: Thu, 30 May 2024 20:57:51 +0800 Subject: [PATCH 2/7] Revert workflow files name --- .github/workflows/{release.yml => publish.yml} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename .github/workflows/{release.yml => publish.yml} (100%) diff --git a/.github/workflows/release.yml b/.github/workflows/publish.yml similarity index 100% rename from .github/workflows/release.yml rename to .github/workflows/publish.yml From 14c30484a1aab0729e836ca337522c62052159ce Mon Sep 17 00:00:00 2001 From: fewensa <37804932+fewensa@users.noreply.github.com> Date: Thu, 30 May 2024 21:07:25 +0800 Subject: [PATCH 3/7] Add path --- .github/workflows/publish.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 3a2d1a8..1aed991 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -80,12 +80,14 @@ jobs: if: startsWith(github.ref, 'refs/tags/v') with: railway_token: ${{ secrets.RAILWAY_TOKEN_PRD }} - service: "apollo-prd" + service: apollo-prd + path: apollo - name: Deploy apollo-stg uses: fewensa/railway-deploy@main if: ${{ !startsWith(github.ref, 'refs/tags/v') }} with: railway_token: ${{ secrets.RAILWAY_TOKEN_STG }} - service: "apollo-stg" + service: apollo-stg + path: apollo From ca0a056fe4c452ce4b71c19fb24ff6405bb0afff Mon Sep 17 00:00:00 2001 From: fewensa <37804932+fewensa@users.noreply.github.com> Date: Thu, 30 May 2024 21:11:54 +0800 Subject: [PATCH 4/7] Update dockerfile --- apollo/Dockerfile | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/apollo/Dockerfile b/apollo/Dockerfile index e7c0c1b..e09796b 100644 --- a/apollo/Dockerfile +++ b/apollo/Dockerfile @@ -1,12 +1,12 @@ -FROM node:14-alpine +FROM node:21-alpine -COPY ./apollo /opt/indexer +COPY . /app -RUN cd /opt/indexer && \ +RUN cd /app && \ yarn install && \ npx prisma generate -WORKDIR /opt/indexer +WORKDIR /app EXPOSE 4002 @@ -14,4 +14,4 @@ ENV VERSION_MODE prod # CMD [ "node", "index.js" ] -ENTRYPOINT /opt/indexer/scripts/entrypoint.sh ${VERSION_MODE} +ENTRYPOINT /app/scripts/entrypoint.sh ${VERSION_MODE} From 892de8906246cedcdee8e531d1d032374ecac9a9 Mon Sep 17 00:00:00 2001 From: fewensa <37804932+fewensa@users.noreply.github.com> Date: Fri, 31 May 2024 09:33:08 +0800 Subject: [PATCH 5/7] Update CI --- .github/workflows/publish.yml | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 1aed991..4b452b9 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -40,6 +40,7 @@ jobs: file: apollo/Dockerfile tags: | ${{ env.DOCKER_REGISTRY }}/${{ github.repository }}/apollo:sha-${{ steps.short-sha.outputs.sha }} + ${{ env.DOCKER_REGISTRY }}/${{ github.repository }}/apollo:staging - name: Build apollo with tag uses: docker/build-push-action@v3 @@ -50,6 +51,7 @@ jobs: file: apollo/Dockerfile tags: | ${{ env.DOCKER_REGISTRY }}/${{ github.repository }}/apollo:${{ steps.tag-name.outputs.tag }} + ${{ env.DOCKER_REGISTRY }}/${{ github.repository }}/apollo:latest - name: Build ponder with sha uses: docker/build-push-action@v3 @@ -58,6 +60,7 @@ jobs: context: ponder/lnv3 tags: | ${{ env.DOCKER_REGISTRY }}/${{ github.repository }}/ponder:sha-${{ steps.short-sha.outputs.sha }} + ${{ env.DOCKER_REGISTRY }}/${{ github.repository }}/ponder:staging - name: Build ponder with tag uses: docker/build-push-action@v3 @@ -67,27 +70,28 @@ jobs: context: ponder/lnv3 tags: | ${{ env.DOCKER_REGISTRY }}/${{ github.repository }}/ponder:${{ steps.tag-name.outputs.tag }} - + ${{ env.DOCKER_REGISTRY }}/${{ github.repository }}/ponder:latest deploy-railway: name: Deploy railway runs-on: ubuntu-latest + needs: [publish-docker-image] steps: - uses: actions/checkout@v2 - name: Deploy apollo-prd - uses: fewensa/railway-deploy@main + uses: fewensa/railway-redeploy@main if: startsWith(github.ref, 'refs/tags/v') with: - railway_token: ${{ secrets.RAILWAY_TOKEN_PRD }} - service: apollo-prd - path: apollo + railway_token: ${{ secrets.RAILWAY_TOKEN }} + environment_id: "97eba9bb-0d0e-43ce-a9c1-5ea78b7891ef" + service_id: "15b7ef1b-90f0-4fae-8404-97a4d790c271" - name: Deploy apollo-stg - uses: fewensa/railway-deploy@main + uses: fewensa/railway-redeploy@main if: ${{ !startsWith(github.ref, 'refs/tags/v') }} with: - railway_token: ${{ secrets.RAILWAY_TOKEN_STG }} - service: apollo-stg - path: apollo + railway_token: ${{ secrets.RAILWAY_TOKEN }} + environment_id: "97eba9bb-0d0e-43ce-a9c1-5ea78b7891ef" + service_id: "07ce396e-d868-459e-a0f2-5563483d7aba" From 128dce4844738a31422f7ce4c31e5b6c994e8a96 Mon Sep 17 00:00:00 2001 From: fewensa <37804932+fewensa@users.noreply.github.com> Date: Fri, 31 May 2024 09:36:31 +0800 Subject: [PATCH 6/7] Fix CI --- .github/workflows/publish.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 4b452b9..58c80c7 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -80,7 +80,7 @@ jobs: - uses: actions/checkout@v2 - name: Deploy apollo-prd - uses: fewensa/railway-redeploy@main + uses: fewensa/action-railway-redeploy@main if: startsWith(github.ref, 'refs/tags/v') with: railway_token: ${{ secrets.RAILWAY_TOKEN }} @@ -88,7 +88,7 @@ jobs: service_id: "15b7ef1b-90f0-4fae-8404-97a4d790c271" - name: Deploy apollo-stg - uses: fewensa/railway-redeploy@main + uses: fewensa/action-railway-redeploy@main if: ${{ !startsWith(github.ref, 'refs/tags/v') }} with: railway_token: ${{ secrets.RAILWAY_TOKEN }} From bec099f485a99bd2ec1090325cae8af62d856ef2 Mon Sep 17 00:00:00 2001 From: fewensa <37804932+fewensa@users.noreply.github.com> Date: Fri, 31 May 2024 09:58:08 +0800 Subject: [PATCH 7/7] Fix docker image for apollo --- .github/workflows/publish.yml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 58c80c7..b4578cb 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -36,8 +36,7 @@ jobs: uses: docker/build-push-action@v3 with: push: true - context: . - file: apollo/Dockerfile + context: apollo tags: | ${{ env.DOCKER_REGISTRY }}/${{ github.repository }}/apollo:sha-${{ steps.short-sha.outputs.sha }} ${{ env.DOCKER_REGISTRY }}/${{ github.repository }}/apollo:staging @@ -47,8 +46,7 @@ jobs: if: startsWith(github.ref, 'refs/tags/v') with: push: true - context: . - file: apollo/Dockerfile + context: apollo tags: | ${{ env.DOCKER_REGISTRY }}/${{ github.repository }}/apollo:${{ steps.tag-name.outputs.tag }} ${{ env.DOCKER_REGISTRY }}/${{ github.repository }}/apollo:latest