Skip to content

An open-source, faster Devin alternative

TypeScript

Remove Deploy Control Plane workflow

Mohamed Habib via Computerc00cbb0dee00
diff --git a/.github/workflows/deploy-server.yml b/.github/workflows/deploy-server.yml
deleted file mode 100644
index 0018e57f..00000000
--- a/.github/workflows/deploy-server.yml
+++ /dev/null
@@ -1,235 +0,0 @@
-name: Deploy Control Plane
-
-on:
- push:
- branches: [main]
- paths:
- - 'cmd/server/**'
- - 'internal/**'
- - 'web/**'
- - 'go.mod'
- - 'go.sum'
- - '.github/workflows/deploy-server.yml'
- workflow_dispatch:
-
-env:
- GOARCH: amd64
-
-jobs:
- deploy:
- name: Deploy Control Plane
- runs-on: ubuntu-latest
- permissions:
- id-token: write
- contents: read
- steps:
- - uses: actions/checkout@v4
-
- - uses: actions/setup-go@v5
- with:
- go-version: '1.23'
-
- - uses: actions/setup-node@v4
- with:
- node-version: '22'
-
- - name: Build server binary
- run: |
- VERSION=$(git rev-parse --short HEAD)
- echo "VERSION=$VERSION" >> $GITHUB_ENV
- CGO_ENABLED=0 GOOS=linux GOARCH=${{ env.GOARCH }} go build \
- -ldflags "-X main.Version=$VERSION" \
- -o bin/opensandbox-server ./cmd/server/
-
- - name: Build web dashboard
- env:
- VITE_PUBLIC_POSTHOG_PROJECT_TOKEN: ${{ secrets.POSTHOG_PROJECT_TOKEN }}
- VITE_PUBLIC_POSTHOG_HOST: ${{ secrets.POSTHOG_HOST }}
- run: cd web && npm ci && npm run build
-
- - name: Package web assets
- run: tar czf bin/web-dist.tar.gz -C web dist
-
- - name: Package Vector configs
- # Bundle deploy/vector/ for distribution to control-plane hosts.
- # install.sh is idempotent: skips Vector install if already present,
- # always refreshes config + restarts. Workers get the same files via
- # the Packer image bake (build-worker-ami.yml).
- run: tar czf bin/vector-deploy.tar.gz -C deploy vector
-
- - name: Azure Login
- uses: azure/login@v2
- with:
- client-id: ${{ secrets.AZURE_CLIENT_ID }}
- tenant-id: ${{ secrets.AZURE_TENANT_ID }}
- subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
-
- - name: Upload artifacts to blob storage
- run: |
- az storage blob upload \
- --account-name ${{ secrets.AZURE_STORAGE_ACCOUNT }} \
- --account-key "${{ secrets.AZURE_STORAGE_KEY }}" \
- --container-name checkpoints \
- --name deploy/opensandbox-server \
- --file bin/opensandbox-server \
- --overwrite true -o none
-
- az storage blob upload \
- --account-name ${{ secrets.AZURE_STORAGE_ACCOUNT }} \
- --account-key "${{ secrets.AZURE_STORAGE_KEY }}" \
- --container-name checkpoints \
- --name deploy/web-dist.tar.gz \
- --file bin/web-dist.tar.gz \
- --overwrite true -o none
-
- az storage blob upload \
- --account-name ${{ secrets.AZURE_STORAGE_ACCOUNT }} \
- --account-key "${{ secrets.AZURE_STORAGE_KEY }}" \
- --container-name checkpoints \
- --name deploy/vector-deploy.tar.gz \
- --file bin/vector-deploy.tar.gz \
- --overwrite true -o none
-
- echo "Artifacts uploaded to blob storage"
-
- - name: Discover control planes
- run: |
- CPS=$(az vm list \
- --resource-group ${{ secrets.AZURE_RESOURCE_GROUP }} \
- --show-details \
- --query "[?contains(name,'controlplane') && powerState=='VM running'].name" \
- -o tsv 2>/dev/null | tr '\n' ',' | sed 's/,$//')
- echo "Discovered CPs: $CPS"
- echo "CP_NAMES=$CPS" >> $GITHUB_ENV
-
- if [ -z "$CPS" ]; then
- echo "ERROR: No running control plane VMs found"
- exit 1
- fi
-
- - name: Deploy to all control planes
- run: |
- IFS=',' read -ra CPS <<< "$CP_NAMES"
-
- for VM in "${CPS[@]}"; do
- echo ""
- echo "=== Deploying to $VM ==="
-
- az vm run-command invoke \
- --resource-group ${{ secrets.AZURE_RESOURCE_GROUP }} \
- --name "$VM" \
- --command-id RunShellScript \
- --scripts "
- set -e
-
- # Download artifacts from blob storage
- az storage blob download \
- --account-name ${{ secrets.AZURE_STORAGE_ACCOUNT }} \
- --account-key '${{ secrets.AZURE_STORAGE_KEY }}' \
- --container-name checkpoints --name deploy/opensandbox-server \
- --file /tmp/opensandbox-server --overwrite true -o none
-
- az storage blob download \
- --account-name ${{ secrets.AZURE_STORAGE_ACCOUNT }} \
- --account-key '${{ secrets.AZURE_STORAGE_KEY }}' \
- --container-name checkpoints --name deploy/web-dist.tar.gz \
- --file /tmp/web-dist.tar.gz --overwrite true -o none
-
- az storage blob download \
- --account-name ${{ secrets.AZURE_STORAGE_ACCOUNT }} \
- --account-key '${{ secrets.AZURE_STORAGE_KEY }}' \
- --container-name checkpoints --name deploy/vector-deploy.tar.gz \
- --file /tmp/vector-deploy.tar.gz --overwrite true -o none
-
- # Stop, replace binary, extract frontend
- systemctl stop opensandbox-server
- sleep 1
- cp /tmp/opensandbox-server /usr/local/bin/opensandbox-server
- chmod +x /usr/local/bin/opensandbox-server
- mkdir -p /opt/opensandbox/web
- tar xzf /tmp/web-dist.tar.gz -C /opt/opensandbox/web
- rm -f /tmp/opensandbox-server /tmp/web-dist.tar.gz
-
- # Ensure WorkingDirectory is set so the server finds web/dist/
- if ! grep -q 'WorkingDirectory=' /etc/systemd/system/opensandbox-server.service; then
- sed -i '/^ExecStart=/i WorkingDirectory=/opt/opensandbox' /etc/systemd/system/opensandbox-server.service
- systemctl daemon-reload
- fi
-
- systemctl start opensandbox-server
-
- # Install/refresh Vector + the KV token populator. install.sh
- # is idempotent (skips Vector install if already present,
- # always refreshes config + reloads). populate-vector-env
- # fetches AXIOM_PLATFORM_TOKEN from KV via the VM's managed
- # identity at every boot (and on this restart).
- mkdir -p /tmp/vector-deploy
- tar xzf /tmp/vector-deploy.tar.gz -C /tmp/vector-deploy
- bash /tmp/vector-deploy/vector/install.sh control-plane
- rm -rf /tmp/vector-deploy /tmp/vector-deploy.tar.gz
-
- echo 'Deploy complete'
- " -o none
-
- echo "$VM deployed"
- done
-
- # Wait for service health
- echo "Waiting for service to be ready..."
- for i in $(seq 1 20); do
- STATUS=$(curl -sf --max-time 5 https://app.opencomputer.dev/health 2>/dev/null | jq -r .status 2>/dev/null)
- if [ "$STATUS" = "ok" ]; then
- echo "Service ready"
- break
- fi
- sleep 3
- done
-
- - name: Smoke test
- run: |
- API_URL="https://app.opencomputer.dev"
-
- # Create sandbox
- SB=$(curl -sf --max-time 30 \
- -H "Content-Type: application/json" \
- -H "X-API-Key: ${{ secrets.API_KEY }}" \
- -X POST "${API_URL}/api/sandboxes" \
- -d '{"timeout":60}' | jq -r .sandboxID)
-
- if [ -z "$SB" ] || [ "$SB" = "null" ]; then
- echo "Smoke test FAILED: could not create sandbox"
- exit 1
- fi
- echo "Created sandbox: $SB"
-
- # Exec with retry — use -s (not -sf) so we see error responses
- RESULT=""
- for attempt in 1 2 3 4 5; do
- sleep 5
- RAW=$(curl -s --max-time 15 \
- -H "Content-Type: application/json" \
- -H "X-API-Key: ${{ secrets.API_KEY }}" \
- -X POST "${API_URL}/api/sandboxes/$SB/exec/run" \
- -d '{"cmd":"echo","args":["deploy-ok"],"timeout":10}')
- RESULT=$(echo "$RAW" | jq -r .stdout 2>/dev/null || echo "")
- echo "Attempt $attempt: stdout='$RESULT' raw='$RAW'"
- echo "$RESULT" | grep -q "deploy-ok" && break
- done
-
- curl -sf --max-time 10 \
- -H "X-API-Key: ${{ secrets.API_KEY }}" \
- -X DELETE "${API_URL}/api/sandboxes/$SB" || true
-
- if echo "$RESULT" | grep -q "deploy-ok"; then
- echo "Smoke test PASSED"
- else
- echo "Smoke test FAILED: exec returned '$RESULT'"
- exit 1
- fi
-
- - name: Summary
- run: |
- echo "## Control Plane Deploy Complete" >> $GITHUB_STEP_SUMMARY
- echo "- **Version:** $VERSION" >> $GITHUB_STEP_SUMMARY
- echo "- **Control planes:** $CP_NAMES" >> $GITHUB_STEP_SUMMARY
- echo "- **Smoke test:** Passed" >> $GITHUB_STEP_SUMMARY