sng cdn
Deployed and supported. The fields and commands described here are stable within version v1alpha1.
The sng cdn group manages the static sites of your tenant: <site>.<tenant>.dev.stackngo.app,
with content in the platform's storage (or your own object storage bucket), served behind a
cache. Each site is a CDNSite manifest of the
desired state: create, enable, disable, and delete change it, and the platform applies
it within a few minutes. upload and clear-cache act immediately.
All commands require a session on the tenant. Otherwise:
tenant session required: run sng tenant use NAME. The global
flags (--config, --json, -v, --version) are described in the CLI index.
Site name (the NAME argument everywhere): lowercase, digits, and -, at most 63
characters, no - at the start or end. Otherwise: nom de site invalide "X" : minuscules, chiffres et '-' (63 max.).
IAM actions per command (resource cdn/<site>):
| Command | IAM action | Route |
|---|---|---|
list | cdn:list (on cdn/*) | GET /v1/cdn |
create | cdn:write (on cdn/* then cdn/<site>) | POST /v1/cdn |
delete | cdn:delete | DELETE /v1/cdn/{name} |
upload | cdn:upload, and cdn:purge to clear the cache | POST /v1/cdn/{name}/uploads, POST /v1/cdn/{name}/uploads/complete |
enable, disable | cdn:write | POST /v1/cdn/{name}/enable, …/disable |
clear-cache | cdn:purge | POST /v1/cdn/{name}/cache/clear |
The managed policies readwrite and admin cover everything; readonly covers list. A
refusal shows forbidden (no policy of this tenant allows it: see sng tenant policy list).
sng apply or sng kind delete of a CDNSite also require cdn:write / cdn:delete on the site.
If the CDN is not enabled on the API: cdn not configured (501).
sng cdn list
sng cdn list
Lists the sites of the current tenant, as declared. The real state can be read in
the STATE column, or with sng kind get CDNSite NAME.
| Flag | Type | Default | Description |
|---|---|---|---|
| (no flags of its own) |
sng cdn list
NAME URL STORAGE STATUS STATE
assets https://assets.acme.dev.stackngo.app custom enabled Ready
blog https://blog.exemple.fr default enabled Waiting
docs https://docs.acme.dev.stackngo.app default disabled Ready
blog: en attente d'une zone DNS vérifiée couvrant "blog.exemple.fr"
STORAGE: default (platform storage) or custom (your bucket). STATUS: disabled when
the site is in maintenance. STATE: the phase of the site (Ready when it is served,
Waiting while it waits for its DNS zone to be verified, Pending, Invalid, Conflict, or -
if unknown); the waiting message is shown under the table. Without sites: aucun site.
--json output:
{
"sites": [
{
"name": "docs",
"domain": "docs.acme.dev.stackngo.app",
"url": "https://docs.acme.dev.stackngo.app",
"storage": "default",
"maintenance": true,
"fallback": "index.html"
}
]
}
sng cdn create
sng cdn create NAME [--fallback FILE]
[--s3-bucket B --s3-credentials SECRET [--s3-endpoint URL] [--s3-region R]
[--s3-prefix P] [--s3-path-style]]
Creates the site NAME.<tenant>.dev.stackngo.app. Without --s3-* options, the site uses the
platform's storage and is fed with sng cdn upload.
| Argument | Description |
|---|---|
NAME | site name, first label of the domain |
| Flag | Type | Default | Description |
|---|---|---|---|
--fallback | string | index.html | file served for extensionless routes that are not found; "" for none |
--s3-bucket | string | your bucket (with --s3-credentials) | |
--s3-credentials | string | Secret of your tenant carrying accessKeyId and secretAccessKey | |
--s3-endpoint | string | (AWS) | public endpoint of the object storage, over https |
--s3-region | string | (us-east-1) | region of the bucket |
--s3-prefix | string | bucket folder served at the site root | |
--s3-path-style | bool | false | path-style URLs (MinIO, some providers) |
sng cdn create docs
sng cdn create app --fallback ""
sng cdn create assets --s3-bucket acme-assets --s3-credentials acme-assets-s3 \
--s3-endpoint https://s3.gra.io.cloud.ovh.net --s3-region gra --s3-path-style
site docs créé : https://docs.acme.dev.stackngo.app (stockage default)
déposez le contenu : sng cdn upload docs ./dist
le site est servi …
--json output: the site, same shape as an item of list.
Errors:
| Message | Cause |
|---|---|
… : --s3-bucket et --s3-credentials sont requis ensemble | incomplete --s3-* option (local check) |
le site "docs" existe déjà (409) | same name in the tenant |
spec.s3 ne peut pas viser le bucket par défaut : retirer spec.s3 (400) | platform bucket |
spec.s3.endpoint "http://…" : https://hôte[:port] attendu (400) | unencrypted endpoint; also hôte interne interdit, adresse non publique |
spec.fallback "/index.html" : chemin relatif attendu (400) | absolute fallback |
stockage par défaut (501) | platform storage unavailable: contact support |
sng cdn upload
sng cdn upload NAME DIR [--prune] [--concurrency N]
Alias: uploads. Sends each file of DIR to the site (default storage only), then clears
the site's cache.
| Argument | Description |
|---|---|
NAME | site name |
DIR | directory to publish; its content becomes the site root |
| Flag | Type | Default | Description |
|---|---|---|---|
--prune | bool | false | remove from the site the files absent from DIR |
--concurrency | int | 8 | parallel uploads, from 1 to 32 |
sng cdn upload docs ./dist --prune
envoyé 42/42
site docs : 42 fichier(s) publié(s), 3 retiré(s)
Progress (envoyé N/M, in batches of 1,000) and ignored files
(ignoré (pas un fichier régulier) : lien) are written to standard error. .git/ and
.DS_Store files are never sent; symbolic links are ignored.
--json output: {"uploaded": 42, "deleted": 3, "cache_purged": true}. If the cache could
not be cleared, the command succeeds but warns: attention : cache non vidé, relancez sng cdn clear-cache docs.
Errors:
| Message | Cause |
|---|---|
nom de fichier non publiable "mes docs/a.html" : lettres, chiffres et ._~@+=,- seulement | space, accent, or special character in a path |
fichier trop gros "video.mp4" (… octets, max 104857600) | file larger than 100 MiB |
aucun fichier à publier dans ./dist | empty directory |
20001 fichiers : 20000 maximum par site | too many files |
./dist n'est pas un dossier | DIR is a file |
--concurrency : de 1 à 32 | value out of bounds |
le site "assets" sert un … : déposez les fichiers dans ce bucket (409) | the site serves your own bucket |
site "docs" (404) | unknown site in the tenant |
3 fichier(s) non déposé(s), dont "a.js" (400) | an upload did not arrive (URL expired after 15 min, network); run again |
sng cdn enable
sng cdn enable NAME
Lifts maintenance: the site serves its content again.
| Argument | Description |
|---|---|
NAME | site name |
sng cdn enable docs
site docs réactivé (…)
No effect if the site is not in maintenance. --json output: the site, same shape as an item
of list. Errors: site "docs" (404); site "docs" modifié entre-temps, réessayez (409).
sng cdn disable
sng cdn disable NAME
Puts the site into maintenance: 503 with a maintenance page, content and domain kept.
| Argument | Description |
|---|---|
NAME | site name |
sng cdn disable docs
site docs en maintenance (…)
The site's cache is cleared right away, then 1, 3, and 6 minutes later. Output and errors:
as for enable.
sng cdn clear-cache
sng cdn clear-cache NAME
Alias: clear_cache. Clears the site's cache on all CDN servers.
| Argument | Description |
|---|---|
NAME | site name |
sng cdn clear-cache docs
cache du site docs vidé
No --json output of its own (the API responds 204). Errors: site "docs" (404);
purge du cache (501) if purging is not configured on the API.
sng cdn delete
sng cdn delete NAME [--yes]
Deletes the site, its content (default storage), and its cache. Irreversible. An injected
bucket is never modified.
| Argument | Description |
|---|---|
NAME | site name |
| Flag | Type | Default | Description |
|---|---|---|---|
--yes, -y | bool | false | confirm without an interactive prompt |
sng cdn delete docs --yes
site docs supprimé (42 fichier(s) retiré(s))
--json output: {"name": "docs", "domain": "docs.acme.dev.stackngo.app", "deleted_objects": 42, "cache_purged": true}.
Errors: confirmation requise : relancez avec --yes ou depuis un terminal interactif;
opération annulée; site "docs" (404).
See also
- Guides: Publish a static site, Maintenance and cache.
- Kind: CDNSite.
- Generic commands:
sng kind get CDNSite docs(status),sng kind delete CDNSite docs(Resources).