Skip to main content

sng CLI

sng is the StackNGO CLI. It applies your manifests, reads the state of your tenant, and drives everyday operations. Everything it does goes through the HTTP API: an sng command can always be reproduced with curl.

Installation: Install the CLI. Configuration and environment variables: Configuration.

Command tree​

sng
├── sso login | logout | whoami Sign-in and identity
├── config create | show | use-cluster Local configuration file
├── template list | search | gen Catalog of manifest templates
├── apply [PATH] Apply manifests
├── validate [PATH] Check the structure
├── plan [PATH] Compare with the desired state
├── pull [DIR] Export the desired state
├── destroy FILE.yml Delete what a file describes
├── kind list | get | edit | delete Read, edit, delete by kind and name
├── detect [PATH] Detect programs, generate Dockerfile and App
├── run [DIR] -p PORT Run a folder over HTTPS, ephemeral
├── app list | create | describe | patch | scale | restart | logs | delete
├── secret list | describe | get | set | create | versions | rotate | restore | delete
├── cdn list | create | delete | upload | enable | disable | clear-cache
├── dns zone (list | create | describe | delete) · record (list | set | describe | delete)
├── registry login | create | pull | build | delete | access-key credentials
├── monitor list | create | delete
├── tenant list | create | use | assume | destroy
│ ├── policy list | get | create | update | delete | attach | detach | principals
│ ├── tier list | show | set
│ ├── oidc list | create | delete
│ └── billing get | set (administrators)
├── env list | checkout | refresh | restore | create-tenant
├── iam init | config | user | app | role | group Accounts of your end users
├── domain search | list | purchase | renew | remove (not available)
└── completion bash | zsh | fish | powershell
GroupStatusPage
sso, configAvailablesng sso, sng config
template, apply, validate, plan, pullAvailablesng template, sng apply
kind (list, get, edit, delete)Availablesng kind
destroyAvailablesng destroy
detectBetasng detect
runBetasng run
appBetasng app
secretAvailablesng secret
cdnBetasng cdn
dnsBetasng dns
registryBetasng registry
monitorBetasng monitor
tenant (+ policy, tier, oidc, billing)Availablesng tenant
envAvailablesng env
iamAvailablesng iam
domainComing soonsng domain

Global flags​

Available on every command.

FlagDefaultEffect
--config PATH~/.config/stackngo/config.yamlConfiguration file to use
--jsondisabledIndented JSON output instead of text or tables
-v, --verbosedisabledAdds the HTTP method and URL to API error messages
--version—Prints the binary's version and exits
-h, --help—Command help

Output​

  • Text: aligned tables (TENANT POLICIES CURRENT) or key: value lines.

  • --json: the API response, as is, indented. This is the form to use in a script:

    sng tenant list --json | jq -r '.tenants[].tenant'
  • YAML: sng kind get TYPE NAME, sng template gen, and the --dry-run commands write YAML (a manifest), not JSON.

Exit codes​

CodeMeaning
0Success
1Any error: invalid argument, not signed in, API refusal, network. The message is written to standard error.

An API error is displayed as:

forbidden (no policy of this tenant allows it: see sng tenant policy list)

With -v:

forbidden (no policy of this tenant allows it: see sng tenant policy list) (GET https://api.dev.stackngo.fr/v1/secrets)

HTTP codes are explained in API errors.

Tokens and renewal​

The CLI keeps two tokens: your identity (after sng sso login) and the session of the current tenant (after sng tenant use). The session lasts one hour; when the API responds 401, the CLI opens a new one with your identity and replays the command. You have nothing to do as long as your identity is valid. If it has expired: sng sso login.

Page conventions​

Each group page describes its commands with: synopsis, description, arguments, flags (name, type, default, effect), examples, --json output, and typical errors. Aliases (sng kind get TYPE for sng kind list TYPE) are pointed out.