Skip to Content
GuidesNanoclGet Started4. Use Statefile

Statefile

Statefile are a way to describe the state you want for a specific namespace.

It use yaml form we can sumerize the deployment of our cargo as follow :

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

Save this file under my-cargo.yml and apply it using:

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

And test with a simple curl:

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

And voila.

Last updated on