Skip to content
Playbook: onboard a server Enrol a new VPS into MZPanel and provision its base stack from an AI agent — servers_create, the install one-liner, waiting for the agent, servers_provision and verification.

Playbook: onboard a server

Goal: a fresh Linux VPS shows up online in the fleet, with the base stack it needs: a Docker box, a LEMP box, a Node.js box, or another mix.

Token: full + servers:enroll, with no server allowlist. Only the workspace owner can enrol servers. Adding a server over the plan’s VPS quota fails with 402 server_limit (Free 1 · Plus 3 · Pro 10 · Max 25 servers, plus any vps-slot add-ons).

Box requirements: Ubuntu 24.04+ (also Debian 12/13; Alma or Rocky 9/10 in beta), root access, and outbound HTTPS on port 443. No inbound port is needed.

  1. Check capacity. servers_list returns the servers you already have. If the user is at the quota, stop and say so.

  2. Create the enrolment. servers_create (REST POST /v1/servers):

    {
    "name": "api-prod-1",
    "install_config": {
    "components": ["docker"],
    "timezone": "UTC",
    "swap": "2G",
    "autoUpdates": true,
    "hardenSsh": false
    }
    }
    • components takes any of nginx, php, mariadb, mysql, postgres, docker, nodejs, redis, wpcli, phpmyadmin, certbot, firewall and supervisor. php and docker pull in nginx, and nginx pulls in certbot. If you omit components, you get a PHP/LEMP box (nginx, php, mariadb, redis, wpcli, certbot). Use ["docker"] for a container host and ["nodejs","nginx"] for Node.js.
    • phpVersions (for example ["8.4"]; the first entry is the default) applies only when PHP is installed.
    • When install_config is present, the base stack is provisioned automatically when the agent first connects.

    The response carries one_liner, install_token, install_token_id and expires_at. The install token is valid for 1 hour.

  3. Run the one-liner on the box as root. Give the user the one_liner (a curl -fsSL … | sudo INSTALL_TOKEN=… SERVER_NAME=… bash command) to paste into an SSH session. If you already have a shell on that box yourself, run it there. A token cannot run it for you: install-over-SSH is dashboard-only.

  4. Wait for the agent. Poll servers_list every 5–10 s until the new server shows online: true (usually within a minute of the installer finishing). If it isn’t online after a few minutes, see Agent won’t come online.

  5. Provision (or repair) the base stack if you didn’t pass install_config, or if you need more components later. Call servers_provision {id, body: {components: [...], phpVersions: [...]}} (level full). It is idempotent, so installed parts are skipped. It returns 202 {job_id, …}. Poll jobs_get {id: job_id}, which can take up to 30 minutes.

  6. Verify. servers_provision_get {id} shows the provisioning state and the applied config. servers_inventory {id, kind: "services"} lists the running services, and servers_inventory {id, kind: "facts"} the OS facts.

  • Name and tag it. servers_update {id, body: {name, notes?, tagId?}}, plus server_tags_list / server_tags_create.
  • Reuse a template. templates_list returns saved install configs. Pass the template’s config as install_config: template_id alone is only recorded. To re-apply a saved template to an existing box, call servers_provision_remediate {id, body: {template_id}}.
  • Set the agent update policy. agent_policy_get / agent_policy_set {id}.
  • Add monitoring. See Uptime monitors and alerts.

servers_delete {id} (full + servers:delete, owner only) removes the server from the fleet. If the server is online, its agent uninstalls itself. Sites, apps and data on the box are left in place. An unused install token can be revoked with install_tokens_revoke {id}.