Skip to Content
GuidesNanoclBien démarrer4. Utiliser un Statefile

Statefile

Un Statefile décrit l’état souhaité d’un espace de noms.

Au format YAML, le déploiement du Cargo se résume ainsi :

ApiVersion: v0.18 Namespace: global # See all options: # https://docs.next-hat.com/references/nanocl/objects/cargo Cargoes: - Name: my-cargo Containers: - Name: web Image: ghcr.io/next-hat/nanocl-get-started:latest # See all options: # https://docs.next-hat.com/references/nanocl/objects/resource Resources: - Name: deploy-example.com Kind: ncproxy.io/rule/v0.15 Data: Rules: - Domain: deploy-example.com Network: All Locations: - Path: / Target: Key: global.my-cargo.c Port: 9000

Enregistrez ce fichier sous my-cargo.yml et appliquez-le avec :

nanocl state apply -s ./my-cargo.yml

Puis testez avec curl :

curl --header "Host: deploy-example.com" 127.0.0.1

Et voilà.

Dernière mise à jour le