fix: resolve Web App startup timeout — exclude node_modules from zip, add startup.sh, increase timeout to 600s

- Remove node_modules from deploy zip (302MB -> ~1MB), let Oryx build on Azure
- Add startup.sh: creates .env/.langgraph_api prereqs, installs pnpm, runs langgraphjs dev
- Azure config: WEBSITES_CONTAINER_START_TIME_LIMIT=600, SCM_DO_BUILD_DURING_DEPLOYMENT=true, ENABLE_ORYX_BUILD=true, PRE_BUILD_COMMAND="npm install -g pnpm@10"
- Delete auto-generated main_soc-langgraph.yml (conflicts with deploy-langgraph.yml)
- Enable Always On to avoid cold starts

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
gongzhiyong
2026-04-10 06:17:47 +08:00
co-authored by Claude Opus 4.6
parent 092c6fe600
commit 45685e8b4a
3 changed files with 30 additions and 76 deletions
+5 -11
View File
@@ -25,21 +25,15 @@ jobs:
with:
node-version: "20"
- name: Install pnpm and dependencies
run: |
npm install -g pnpm@10
cd langgraph
pnpm install --frozen-lockfile
# Create .env placeholder (langgraphjs dev requires it)
touch .env
mkdir -p .langgraph_api
echo ".langgraph_api" >> .gitignore
- name: Package for deployment
run: |
cd langgraph
# Create langgraphjs dev prerequisites
touch .env
mkdir -p .langgraph_api
# Package source only — Oryx will install node_modules on Azure
zip -r ../deploy-langgraph.zip . \
-x ".git/*" "dist/*" ".DS_Store"
-x "node_modules/*" ".git/*" "dist/*" ".DS_Store"
- name: Login to Azure
uses: azure/login@v2
-65
View File
@@ -1,65 +0,0 @@
# Docs for the Azure Web Apps Deploy action: https://github.com/Azure/webapps-deploy
# More GitHub Actions for Azure: https://github.com/Azure/actions
name: Build and deploy Node.js app to Azure Web App - soc-langgraph
on:
push:
branches:
- main
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read #This is required for actions/checkout
steps:
- uses: actions/checkout@v4
- name: Set up Node.js version
uses: actions/setup-node@v3
with:
node-version: '20.x'
- name: npm install, build, and test
run: |
npm install
npm run build --if-present
npm run test --if-present
- name: Upload artifact for deployment job
uses: actions/upload-artifact@v4
with:
name: node-app
path: .
deploy:
runs-on: ubuntu-latest
needs: build
permissions:
id-token: write #This is required for requesting the JWT
contents: read #This is required for actions/checkout
steps:
- name: Download artifact from build job
uses: actions/download-artifact@v4
with:
name: node-app
- name: Login to Azure
uses: azure/login@v2
with:
client-id: ${{ secrets.AZUREAPPSERVICE_CLIENTID_8AFD875AB99C43E08E547E8C05B52C0E }}
tenant-id: ${{ secrets.AZUREAPPSERVICE_TENANTID_AED8BF6E858D44D589AE7C2EDFED2325 }}
subscription-id: ${{ secrets.AZUREAPPSERVICE_SUBSCRIPTIONID_6BF05B223C23470E904C4CFECEB28649 }}
- name: 'Deploy to Azure Web App'
id: deploy-to-webapp
uses: azure/webapps-deploy@v3
with:
app-name: 'soc-langgraph'
slot-name: 'Production'
package: .
+25
View File
@@ -0,0 +1,25 @@
#!/bin/bash
set -e
echo "=== LangGraph Server Startup ==="
cd /home/site/wwwroot
# Ensure langgraphjs dev prerequisites exist
touch .env
mkdir -p .langgraph_api
# Install pnpm globally if not available
if ! command -v pnpm &> /dev/null; then
echo "Installing pnpm..."
npm install -g pnpm@10
fi
# Install dependencies if node_modules is missing (Oryx should have done this, but fallback)
if [ ! -d "node_modules" ]; then
echo "node_modules not found, installing dependencies..."
pnpm install --frozen-lockfile
fi
echo "Starting LangGraph server on port 2024..."
exec npx langgraphjs dev --host 0.0.0.0 --port 2024 --no-browser