Overview
platform talks to the API from a terminal. It manages tenants, app
services, instances, images, volumes, snapshots, backup policies, SSH keys,
firewalls, floating IPs, operations, and the catalog.
Sign in
Section titled “Sign in”platform login --rest https://api.m12p.comThe CLI opens your browser at the M12P sign-in page. You sign in there, with your password and authenticator, and the browser hands the session back to the CLI. The CLI never sees your password.
The session is kept in ~/.platform/config.json, which only you can read. The
access token lasts 15 minutes. The CLI renews it with a refresh token that
lasts 30 days and is replaced on every use. --rest is remembered, so you
pass it once.
| Flag | What it does |
|---|---|
--rest <url> | API address to sign in to and use from now on |
--no-browser | Print the sign-in address instead of opening a browser, for a remote shell |
--with-token | Read an access token from standard input |
--client-id <id> --tenant <tenant> --client-secret-stdin | Sign in as a service principal with its secret |
--client-id <id> --tenant <tenant> --github | Sign in as a service principal from GitHub Actions, without a secret |
platform logout removes the session, and a stored service principal secret.
platform token prints a fresh access token, for a curl you run yourself.
Production uses REST
Section titled “Production uses REST”M12P publishes only the REST API, at https://api.m12p.com. gRPC is not
public. The commands under tenant and service use REST, so they work
against production. The other commands use gRPC, and work against a local
stack.
Tenants and app services
Section titled “Tenants and app services”| Command | What it does |
|---|---|
platform tenant list | List the tenants you can open |
platform tenant rename <tenant-id> <name> | Change the name people see |
platform service list [--app <id>] | List app services in every app you can open |
platform service get <id> | Containers, domains, and the names of environment values |
platform service pods <id> [--container <name>] | Pods, and why any of them is not ready |
platform service events <id> [--warnings] | What Kubernetes reported for the service, newest first |
platform service logs <id> [--container <name>] [--tail 200] [--previous] | A container’s log. --previous shows the run before the last restart |
platform service deployments <id> | Recent deployments and their result |
platform service deploy <id> [--compose <file>] [--restart <container>] [--wait] [--timeout 10m] | Deploy |
platform service rename <id> <name> | Rename. The id, domains, deploy hook, and pods stay as they are |
service get prints environment names only. No command prints a secret
value or the registry password.
service deploy --compose docker-compose.paas.yml replaces the saved Compose
file with yours, then deploys it. Without --compose it deploys what is
saved. The platform answers at once and deploys in the background. With
--wait the CLI follows that deployment. When it fails, the CLI prints why
and exits non-zero, so a pipeline fails with it.
platform service listplatform service events service_06gsviu9kcdrn6dn2rfuq1u924 --warningsplatform service deploy service_06gsviu9kcdrn6dn2rfuq1u924 --compose docker-compose.paas.yml --waitWhen an app does not start, read Troubleshooting.
Infrastructure
Section titled “Infrastructure”| Command | What it does |
|---|---|
platform catalog types | List instance types |
platform instance list | List compute instances |
platform instance create --name web-1 | Create an instance |
platform instance get <id> | Show one instance |
platform volume list | List storage volumes |
platform snapshot list | List disk snapshots |
platform backup-policy list | List scheduled volume backups |
platform ssh-key list | List SSH key pairs |
platform firewall list | List security groups |
platform floating-ip list | List floating IPs |
platform operation list | Inspect long-running operations |
platform image list | List SYSTEM and MACHINE images |
Configuration
Section titled “Configuration”~/.platform/config.json holds endpoint, rest_endpoint, app, and the
session. These environment variables override it:
| Variable | Meaning |
|---|---|
PLATFORM_REST | REST address |
PLATFORM_GRPC | gRPC address |
PLATFORM_TOKEN | Access token to use as is |
PLATFORM_APP | App, when the file names none |
PLATFORM_CLIENT_ID, PLATFORM_TENANT | Sign in as this service principal. Nothing is written to disk |
PLATFORM_CLIENT_SECRET | The principal’s secret |
PLATFORM_FEDERATION=github | Use the GitHub Actions token instead of a secret |
If you set nothing: REST http://127.0.0.1:8080, gRPC 127.0.0.1:9090,
app app_default. On a local compose stack, use
PLATFORM_REST=http://cloud-api.localhost.