Intermediate

Automate CI/CD and ephemeral staging on Thai cloud with xverctl and REST API

How DevOps teams use xverctl CLI, REST API v2, Reserved IPs and MCP mode to spin up hourly Bangkok staging servers and delete them after tests

On this page
  1. Ephemeral staging lifecycle in CI/CD
  2. 1. Install xverctl and create a scoped API token
  3. 2. Create and delete a staging server in CI/CD
  4. 3. Deploy Container Apps and enable xverctl MCP
  5. Troubleshooting common CI/CD exit codes
  6. Frequently asked questions

DevOps teams can provision Bangkok staging servers, run automated integration suites and delete them the moment tests finish with xverctl CLI and REST API v2. Combined with true hourly billing, CI jobs only pay for the hours a test environment actually exists.

CI/CD tooling & guardrails at a glance

Non-interactive auth

Export XVER_TOKEN in CI secrets and pass -o json so every response is a single clean JSON document

Safe retries

--dry-run previews pricing and blockers before spending credit; --idempotency-key prevents duplicate resources on retries

Covered services

Cloud Servers, Container Apps, Reserved IPs, S3 Object Storage keys and built-in read-only xverctl mcp

Reference docs

xverctl CLI Docs and REST API v2

Ephemeral staging lifecycle in CI/CD#

Each Pull Request can spin up a fresh Bangkok VM, execute integration tests and remove the machine automatically so no idle charges linger overnight.

  • Pull Request opened on GitHub
  • xverctl server create (--idempotency-key)
  • Build and run integration tests
  • xverctl server delete --yes (billing stops immediately)
Hourly staging pipeline flow

Running an integration test for 2 hours on s-2vcpu-4gb and deleting the VM afterward costs a small fraction of a day or month. Live figures from the billing API:

฿1.40

2 hours

2 vCPU · 4 GB

฿16.80

24 hours

2 vCPU · 4 GB

฿419.00

730 hours

2 vCPU · 4 GB

Charged per hour the server exists, never above the monthly price in a calendar month

What you need before setting up CI/CD

1. Install xverctl and create a scoped API token#

Create a least-privilege API token in the console (my.xver.cloud/account/api-tokens) scoped only to what your pipeline needs, then install xverctl and verify connectivity.

Install xverctl and verify token
# macOS / Linux via Homebrew
brew install xver-cloud/tap/xverctl

# Or via the official install script
curl -fsSL https://github.com/xver-cloud/xverctl/releases/latest/download/install.sh | sh

# Verify binary version and active token (with XVER_TOKEN set)
xverctl version
xverctl auth status -o json

2. Create and delete a staging server in CI/CD#

Tie --idempotency-key to the CI run ID so network retries never create duplicate servers, and add --wait to block until the server finishes provisioning.

Provision, test and tear down an hourly staging server
KEY="ci-pr-${PR_NUMBER:-101}-staging"

# 1. Validate inputs and preview pricing without spending credit
xverctl server create "pr-${PR_NUMBER:-101}" \
  --plan s-2vcpu-4gb \
  --os ubuntu-24.04 \
  --idempotency-key "$KEY" \
  --dry-run -o json

# 2. Create the server and wait until it is ready
xverctl server create "pr-${PR_NUMBER:-101}" \
  --plan s-2vcpu-4gb \
  --os ubuntu-24.04 \
  --idempotency-key "$KEY" \
  --wait -o json

# 3. Delete immediately after tests finish so hourly billing stops
xverctl server delete "pr-${PR_NUMBER:-101}" --yes --wait -o json

3. Deploy Container Apps and enable xverctl MCP#

If your app ships as a Docker image, deploy straight to Container Apps with automatic HTTPS and scale-to-zero, or connect AI coding agents safely via xverctl mcp.

Deploy a Container App and register MCP
# Deploy an image and get a public HTTPS URL
xverctl container deploy preview-api \
  --image ghcr.io/team/api:pr-101 \
  --port 3000 \
  --idempotency-key "ci-pr-101-deploy" \
  --wait -o json

# Register XVer MCP server (read-only by default) in Claude Code
claude mcp add xver -- xverctl mcp

Troubleshooting common CI/CD exit codes#

When a CI step fails, check the exit code returned by xverctl and expand the matching fix below.

CI/CD exit codes & deployment fixes

IssueExit code 4 · Missing XVER_TOKEN or unauthenticated
Fix

The runner has no active credentials. Inject XVER_TOKEN in your CI secrets before invoking xverctl.

IssueExit code 5 · Token lacks required scope
Fix

Reissue an API token in the console with the exact scope required by the command, such as servers:manage or servers:delete.

IssueExit code 6 · Destructive command run without --yes
Fix

xverctl blocks non-interactive destructive actions by default. Pass --yes after validation.

IssueExit code 7 · Insufficient credit or account quota reached
Fix

Top up prepaid credit in the console or contact support to request a quota increase.

IssueContainer deploy failed · Port mismatch
Fix

Verify --port matches the port your app listens on, and inspect logs via xverctl container logs <app> --tail 200.

Frequently asked questions#

Does xverctl use the same public REST API v2 documented on xver.cloud?

Yes. Every command maps directly to REST API v2 documented in the API Reference, which also publishes an OpenAPI spec for custom SDK generation.

Can xverctl mcp delete servers by default?

No. xverctl mcp starts in read-only mode by default. Write or delete tools are only exposed if you explicitly pass --allow-write or --allow-delete.

Can I mint scoped S3 Object Storage credentials from the CLI?

Yes. Run xverctl token create <name> --storage write --bucket <bucket> -o json to generate an Access Key ID and Secret Access Key restricted to that bucket.

Follow the guide on your own server

Create a Cloud Server with Ubuntu, Debian or Windows Server, billed by the hour in Thai baht. Support answers 24/7 in Thai and English.