Recipes
A recipe describes a complete server setup as code. Instead of a wiki page that says "install these packages, set these config values, start a database, copy this file", you write it down once and let nwm do it:
recipe @you/roleplay 1.0.0
description "Roleplay development server"
nanossharp
var port 7777
config discover.name "RP ${server.name}"
config discover.port ${port}
package sandbox enable
package rp-core git https://github.com/you/rp-core.git ref v2.1.0 enable
use postgres
use redis
secret steam_token prompt
env STEAM_TOKEN ${secret.steam_token}
hook in Packages/rp-core dotnet build
nwm server create rp --recipe ./roleplay
What a recipe can contain
| Part | Example | Details |
|---|---|---|
| Metadata | recipe @you/roleplay 1.0.0 | Recipefile |
| Server settings | branch, nanossharp, arg | Recipefile |
| Variables | var port 7777 | Variables |
| Config.toml values | config discover.port ${port} | Recipefile |
| Packages and asset packs | package sandbox enable | Recipefile |
| C modules | module mysql linux https://... | C modules |
| Files | file files/NanosSharp.toml NanosSharp.toml template | Recipefile |
| Services | use postgres | Services |
| Secrets | secret steam_token prompt | Secrets |
| Environment | env STEAM_TOKEN ${secret.steam_token} | Recipefile |
| Hooks | hook dotnet build | Recipefile |
Two formats
Recipes are usually written as a Recipefile, a line based format designed for humans and for the
interactive editor. nwm also understands recipe.toml, which holds the same data as TOML tables.
Convert between them at any time with nwm recipe convert --to toml or --to dsl. See
recipe.toml.
A folder can also hold several recipes with their own names, such as dev.Recipefile and staging.Recipefile, which
share the same files/ and packages/ folders.
Lifecycle
- Write it with
nwm recipe init,nwm recipe editornwm recipe add, see Editing recipes - Check it with
nwm recipe validate - Apply it with
nwm server create --recipeornwm recipe apply, see Applying recipes - Share it through git, a URL, a gist or the registry
- Upgrade servers with
nwm recipe upgradewhen the recipe changes