From 7c2528d0fa116279523e7fc395e091cb553c8d72 Mon Sep 17 00:00:00 2001 From: aiaug Date: Mon, 13 Jan 2025 13:23:21 +0900 Subject: [PATCH 1/8] feat:this commit should create the api-web3-stage --- .github/workflows/web3-staging.yaml | 49 +++++++++++++++++++++++++++++ eve/tools/replicate_tool.py | 2 +- 2 files changed, 50 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/web3-staging.yaml diff --git a/.github/workflows/web3-staging.yaml b/.github/workflows/web3-staging.yaml new file mode 100644 index 0000000..b66aeb3 --- /dev/null +++ b/.github/workflows/web3-staging.yaml @@ -0,0 +1,49 @@ +name: Deploy to Modal Staging + +on: + push: + branches: + - web3-staging + pull_request: + types: [closed] + branches: + - web3-staging + +jobs: + deploy: + if: github.ref == 'refs/heads/staging' && (github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.pull_request.merged == true)) + runs-on: ubuntu-latest + env: + DB: STAGE + + steps: + - name: Checkout workflows repo + uses: actions/checkout@v4 + with: + repository: edenartlab/workflows + path: workflows + + - name: Checkout main repo + uses: actions/checkout@v4 + with: + path: eve + + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: '3.11' + + - name: Install the latest version of rye + uses: eifinger/setup-rye@v4 + + - name: Install dependencies + working-directory: eve + run: rye sync + + - name: Configure Modal token + working-directory: eve + run: rye run modal token set --token-id ${{ secrets.MODAL_TOKEN_ID }} --token-secret ${{ secrets.MODAL_TOKEN_SECRET }} + + - name: Deploy to Modal + working-directory: eve + run: rye run modal deploy ./eve/api/api.py diff --git a/eve/tools/replicate_tool.py b/eve/tools/replicate_tool.py index 73420dc..8f6157c 100644 --- a/eve/tools/replicate_tool.py +++ b/eve/tools/replicate_tool.py @@ -162,7 +162,7 @@ async def _create_prediction(self, args: dict, webhook=True): return prediction def get_webhook_url(): - env = "api-prod" if os.getenv("DB") == "PROD" else "api-stage" + env = "api-prod" if os.getenv("DB") == "PROD" else "api-web3-stage" dev = "-dev" if os.getenv("DB") == "STAGE" and os.getenv("MODAL_SERVE") == "1" else "" webhook_url = f"https://edenartlab--{env}-fastapi-app{dev}.modal.run/update" return webhook_url From fcfceb05556ab60da469622666030cd6546d1c8b Mon Sep 17 00:00:00 2001 From: aiaug Date: Mon, 13 Jan 2025 13:26:51 +0900 Subject: [PATCH 2/8] fix:ths commit should change the DB name for web3-staging --- .github/workflows/web3-staging.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/web3-staging.yaml b/.github/workflows/web3-staging.yaml index b66aeb3..73658cc 100644 --- a/.github/workflows/web3-staging.yaml +++ b/.github/workflows/web3-staging.yaml @@ -14,7 +14,7 @@ jobs: if: github.ref == 'refs/heads/staging' && (github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.pull_request.merged == true)) runs-on: ubuntu-latest env: - DB: STAGE + DB: WEB3-STAGE steps: - name: Checkout workflows repo From ba013fd95b27e3f8d3461b7bbf4cd11aa5c3d01f Mon Sep 17 00:00:00 2001 From: aiaug Date: Mon, 13 Jan 2025 13:36:51 +0900 Subject: [PATCH 3/8] fix:this commit should fix the webhook_url --- eve/tools/replicate_tool.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/eve/tools/replicate_tool.py b/eve/tools/replicate_tool.py index 8f6157c..fb52827 100644 --- a/eve/tools/replicate_tool.py +++ b/eve/tools/replicate_tool.py @@ -162,8 +162,8 @@ async def _create_prediction(self, args: dict, webhook=True): return prediction def get_webhook_url(): - env = "api-prod" if os.getenv("DB") == "PROD" else "api-web3-stage" - dev = "-dev" if os.getenv("DB") == "STAGE" and os.getenv("MODAL_SERVE") == "1" else "" + env = "api-web3-prod" if os.getenv("DB") == "PROD" else "api-web3-stage" + dev = "-dev" if os.getenv("DB") == "WEB#-STAGE" and os.getenv("MODAL_SERVE") == "1" else "" webhook_url = f"https://edenartlab--{env}-fastapi-app{dev}.modal.run/update" return webhook_url From 58ef5bdcdce251330cd793dfc04c99ec9035bcc5 Mon Sep 17 00:00:00 2001 From: aiaug Date: Mon, 13 Jan 2025 13:38:29 +0900 Subject: [PATCH 4/8] fix:this commit should fix some issue --- eve/tools/replicate_tool.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/eve/tools/replicate_tool.py b/eve/tools/replicate_tool.py index fb52827..72707e5 100644 --- a/eve/tools/replicate_tool.py +++ b/eve/tools/replicate_tool.py @@ -162,8 +162,8 @@ async def _create_prediction(self, args: dict, webhook=True): return prediction def get_webhook_url(): - env = "api-web3-prod" if os.getenv("DB") == "PROD" else "api-web3-stage" - dev = "-dev" if os.getenv("DB") == "WEB#-STAGE" and os.getenv("MODAL_SERVE") == "1" else "" + env = "api-web3-prod" if os.getenv("DB") == "WEB3-PROD" else "api-web3-stage" + dev = "-dev" if os.getenv("DB") == "WEB3-STAGE" and os.getenv("MODAL_SERVE") == "1" else "" webhook_url = f"https://edenartlab--{env}-fastapi-app{dev}.modal.run/update" return webhook_url From 7ac3ab1e5eb147fbb8c3a95581e4880c2702d6f3 Mon Sep 17 00:00:00 2001 From: aiaug Date: Mon, 13 Jan 2025 13:49:16 +0900 Subject: [PATCH 5/8] fix:this commit should fix th env --- .github/workflows/web3-staging.yaml | 2 +- eve/tools/replicate_tool.py | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/.github/workflows/web3-staging.yaml b/.github/workflows/web3-staging.yaml index 73658cc..b052e2a 100644 --- a/.github/workflows/web3-staging.yaml +++ b/.github/workflows/web3-staging.yaml @@ -1,4 +1,4 @@ -name: Deploy to Modal Staging +name: Deploy to Modal Web3-Staging on: push: diff --git a/eve/tools/replicate_tool.py b/eve/tools/replicate_tool.py index 72707e5..ec327d0 100644 --- a/eve/tools/replicate_tool.py +++ b/eve/tools/replicate_tool.py @@ -162,7 +162,12 @@ async def _create_prediction(self, args: dict, webhook=True): return prediction def get_webhook_url(): - env = "api-web3-prod" if os.getenv("DB") == "WEB3-PROD" else "api-web3-stage" + env = { + "PROD": "api-prod", + "STAGE": "api-stage", + "WEB3-PROD": "api-web3-prod", + "WEB3-STAGE": "api-web3-stage" + }.get(os.getenv("DB"), "api-web3-stage") dev = "-dev" if os.getenv("DB") == "WEB3-STAGE" and os.getenv("MODAL_SERVE") == "1" else "" webhook_url = f"https://edenartlab--{env}-fastapi-app{dev}.modal.run/update" return webhook_url From 1162c4ac89476c8c482e1d6c11fbadf4860c4cd8 Mon Sep 17 00:00:00 2001 From: aiaug Date: Mon, 13 Jan 2025 14:13:24 +0900 Subject: [PATCH 6/8] feat:this commit should create web3-staging --- .github/workflows/web3-staging.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/web3-staging.yaml b/.github/workflows/web3-staging.yaml index b052e2a..9bcf097 100644 --- a/.github/workflows/web3-staging.yaml +++ b/.github/workflows/web3-staging.yaml @@ -3,11 +3,11 @@ name: Deploy to Modal Web3-Staging on: push: branches: - - web3-staging + - staging pull_request: types: [closed] branches: - - web3-staging + - staging jobs: deploy: From 634d3f125ba20869bcfae29d0249043504ef9cf3 Mon Sep 17 00:00:00 2001 From: aiaug Date: Mon, 13 Jan 2025 14:15:53 +0900 Subject: [PATCH 7/8] feat:this commit should create web3-prod --- .github/workflows/web3-prod.yaml | 49 ++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 .github/workflows/web3-prod.yaml diff --git a/.github/workflows/web3-prod.yaml b/.github/workflows/web3-prod.yaml new file mode 100644 index 0000000..40aa782 --- /dev/null +++ b/.github/workflows/web3-prod.yaml @@ -0,0 +1,49 @@ +name: Deploy to Modal Web3-Production + +on: + push: + branches: + - main + pull_request: + types: [closed] + branches: + - main + +jobs: + deploy: + if: github.ref == 'refs/heads/main' && (github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.pull_request.merged == true)) + runs-on: ubuntu-latest + env: + DB: WEB3-PROD + + steps: + - name: Checkout workflows repo + uses: actions/checkout@v4 + with: + repository: edenartlab/workflows + path: workflows + + - name: Checkout main repo + uses: actions/checkout@v4 + with: + path: eve + + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: '3.11' + + - name: Install the latest version of rye + uses: eifinger/setup-rye@v4 + + - name: Install dependencies + working-directory: eve + run: rye sync + + - name: Configure Modal token + working-directory: eve + run: rye run modal token set --token-id ${{ secrets.MODAL_TOKEN_ID }} --token-secret ${{ secrets.MODAL_TOKEN_SECRET }} + + - name: Deploy to Modal + working-directory: eve + run: rye run modal deploy ./eve/api/api.py From d6712f96c3dd0c94d020f9f2dbad9a18b65f52b2 Mon Sep 17 00:00:00 2001 From: aiaug Date: Mon, 13 Jan 2025 14:19:45 +0900 Subject: [PATCH 8/8] fix:this commit should fix the setting for dev env --- eve/tools/replicate_tool.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/eve/tools/replicate_tool.py b/eve/tools/replicate_tool.py index ec327d0..73d82f2 100644 --- a/eve/tools/replicate_tool.py +++ b/eve/tools/replicate_tool.py @@ -168,7 +168,8 @@ def get_webhook_url(): "WEB3-PROD": "api-web3-prod", "WEB3-STAGE": "api-web3-stage" }.get(os.getenv("DB"), "api-web3-stage") - dev = "-dev" if os.getenv("DB") == "WEB3-STAGE" and os.getenv("MODAL_SERVE") == "1" else "" + dev = "-dev" if os.getenv("DB") in ["WEB3-STAGE", "STAGE"] and os.getenv("MODAL_SERVE") == "1" else "" + webhook_url = f"https://edenartlab--{env}-fastapi-app{dev}.modal.run/update" return webhook_url