From d37ce91966a868cc0502d9f66373f88690dbc6db Mon Sep 17 00:00:00 2001 From: aiaug Date: Mon, 13 Jan 2025 13:26:02 +0900 Subject: [PATCH 1/3] feat:this commit should create web3-prod action --- .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..aaa6ff1 --- /dev/null +++ b/.github/workflows/web3-prod.yaml @@ -0,0 +1,49 @@ +name: Deploy to Modal Production + +on: + push: + branches: + - web3-prod + pull_request: + types: [closed] + branches: + - web3-prod + +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 f6a5bc565c59c72115ce994310171c921f5e31be Mon Sep 17 00:00:00 2001 From: aiaug Date: Mon, 13 Jan 2025 13:34:32 +0900 Subject: [PATCH 2/3] fix:this commit should replace he 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 2f3d398..be865e3 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("ENV") == "PROD" else "api-stage" - dev = "-dev" if os.getenv("ENV") == "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 d6f354af292aaf8318a91a0eacf957b40f911129 Mon Sep 17 00:00:00 2001 From: aiaug Date: Mon, 13 Jan 2025 13:51:19 +0900 Subject: [PATCH 3/3] fix:this commit should fix the env --- .github/workflows/web3-prod.yaml | 2 +- eve/tools/replicate_tool.py | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/.github/workflows/web3-prod.yaml b/.github/workflows/web3-prod.yaml index aaa6ff1..8972c60 100644 --- a/.github/workflows/web3-prod.yaml +++ b/.github/workflows/web3-prod.yaml @@ -1,4 +1,4 @@ -name: Deploy to Modal Production +name: Deploy to Modal Web3-Production on: push: diff --git a/eve/tools/replicate_tool.py b/eve/tools/replicate_tool.py index be865e3..537ea5e 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