|
| 1 | +name: Deploy Testnet |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + tags: ['v*'] |
| 6 | + workflow_dispatch: |
| 7 | + inputs: |
| 8 | + telemetry_host: |
| 9 | + description: 'Telemetry host (e.g., jamtart-32255.eastus.azurecontainer.io:9000)' |
| 10 | + required: false |
| 11 | + default: '' |
| 12 | + |
| 13 | +env: |
| 14 | + RESOURCE_GROUP: tessera-testnet-rg |
| 15 | + ACR_NAME: tesseratestnetacr |
| 16 | + ACI_NAME: tessera-testnet |
| 17 | + DNS_LABEL: tessera-testnet |
| 18 | + LOCATION: eastus |
| 19 | + |
| 20 | +jobs: |
| 21 | + deploy: |
| 22 | + runs-on: ubuntu-latest |
| 23 | + timeout-minutes: 30 |
| 24 | + |
| 25 | + steps: |
| 26 | + - name: Checkout |
| 27 | + uses: actions/checkout@v4 |
| 28 | + with: |
| 29 | + token: ${{ secrets.PRIVATE_REPO_TOKEN }} |
| 30 | + submodules: false |
| 31 | + |
| 32 | + - name: Init submodules |
| 33 | + run: | |
| 34 | + git submodule init deps/tsrkit-pvm deps/py-ark-vrf deps/rockstore deps/tsrkit-asm deps/tsrkit-types |
| 35 | + git -c "url.https://x-access-token:${{ secrets.PRIVATE_REPO_TOKEN }}@github.com/.insteadOf=https://github.com/" \ |
| 36 | + submodule update --recursive --depth 1 \ |
| 37 | + deps/tsrkit-pvm deps/py-ark-vrf deps/rockstore deps/tsrkit-asm deps/tsrkit-types |
| 38 | +
|
| 39 | + - name: Azure Login |
| 40 | + uses: azure/login@v2 |
| 41 | + with: |
| 42 | + creds: ${{ secrets.AZURE_CREDENTIALS }} |
| 43 | + |
| 44 | + - name: Build image (Azure Cloud Build) |
| 45 | + run: | |
| 46 | + az acr build \ |
| 47 | + --registry ${{ env.ACR_NAME }} \ |
| 48 | + --platform linux/amd64 \ |
| 49 | + --image tessera:${{ github.ref_name }} \ |
| 50 | + --image tessera:latest \ |
| 51 | + . |
| 52 | +
|
| 53 | + - name: Deploy to ACI |
| 54 | + run: | |
| 55 | + # Get ACR credentials |
| 56 | + ACR_LOGIN_SERVER=$(az acr show --name ${{ env.ACR_NAME }} --query loginServer -o tsv) |
| 57 | + ACR_USERNAME=$(az acr credential show --name ${{ env.ACR_NAME }} --query username -o tsv) |
| 58 | + ACR_PASSWORD=$(az acr credential show --name ${{ env.ACR_NAME }} --query "passwords[0].value" -o tsv) |
| 59 | + |
| 60 | + # Delete existing |
| 61 | + az container delete --resource-group ${{ env.RESOURCE_GROUP }} --name ${{ env.ACI_NAME }} --yes 2>/dev/null || true |
| 62 | + |
| 63 | + # Deploy |
| 64 | + az container create \ |
| 65 | + --resource-group ${{ env.RESOURCE_GROUP }} \ |
| 66 | + --name ${{ env.ACI_NAME }} \ |
| 67 | + --image $ACR_LOGIN_SERVER/tessera:latest \ |
| 68 | + --registry-login-server $ACR_LOGIN_SERVER \ |
| 69 | + --registry-username $ACR_USERNAME \ |
| 70 | + --registry-password "$ACR_PASSWORD" \ |
| 71 | + --cpu 4 --memory 8 \ |
| 72 | + --ports 19800 \ |
| 73 | + --ip-address Public \ |
| 74 | + --dns-name-label ${{ env.DNS_LABEL }} \ |
| 75 | + --environment-variables TELEMETRY_HOST="${{ github.event.inputs.telemetry_host }}" \ |
| 76 | + --restart-policy Always \ |
| 77 | + --location ${{ env.LOCATION }} |
| 78 | +
|
| 79 | + - name: Verify deployment |
| 80 | + run: | |
| 81 | + sleep 30 |
| 82 | + FQDN=$(az container show --resource-group ${{ env.RESOURCE_GROUP }} --name ${{ env.ACI_NAME }} --query ipAddress.fqdn -o tsv) |
| 83 | + echo "Deployed to: http://$FQDN:19800" |
| 84 | + |
| 85 | + # Check container is running |
| 86 | + STATE=$(az container show --resource-group ${{ env.RESOURCE_GROUP }} --name ${{ env.ACI_NAME }} --query instanceView.state -o tsv) |
| 87 | + if [ "$STATE" != "Running" ]; then |
| 88 | + echo "Container state: $STATE" |
| 89 | + az container logs --resource-group ${{ env.RESOURCE_GROUP }} --name ${{ env.ACI_NAME }} || true |
| 90 | + exit 1 |
| 91 | + fi |
| 92 | + echo "Container is running!" |
0 commit comments