Skip to main content

Statefile Arguments

Statefile Arguments are a way to reuse your Statefile by taking advantage of Liquid templating.
Let considere this example, create a new file called my-deployment.yml and add the following content :


Now if you apply it with:

nanocl state apply -s my-deployment.yml

You will notice the following error message:

error: the following required arguments were not provided:
--name <name>
--domain <domain>
--image <image>
--port <port>

Usage: nanocl state args -- --name <name> --domain <domain> --image <image> --port <port>

For more information, try '--help'.

The Statefile now require arguments that will be used for rendering

The correct command is now:

state apply -s my-deployment.yml -- --name deploy-example \
--domain deploy-example.com \
--image ghcr.io/next-hat/nanocl-get-started:latest \
--port 9000

That why you can quickly deploy any Http service really easily.
Now you have the basics to create a awsome Statefile !