Skip to main content

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​

PartExampleDetails
Metadatarecipe @you/roleplay 1.0.0Recipefile
Server settingsbranch, nanossharp, argRecipefile
Variablesvar port 7777Variables
Config.toml valuesconfig discover.port ${port}Recipefile
Packages and asset packspackage sandbox enableRecipefile
C modulesmodule mysql linux https://...C modules
Filesfile files/NanosSharp.toml NanosSharp.toml templateRecipefile
Servicesuse postgresServices
Secretssecret steam_token promptSecrets
Environmentenv STEAM_TOKEN ${secret.steam_token}Recipefile
Hookshook dotnet buildRecipefile

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​

  1. Write it with nwm recipe init, nwm recipe edit or nwm recipe add, see Editing recipes
  2. Check it with nwm recipe validate
  3. Apply it with nwm server create --recipe or nwm recipe apply, see Applying recipes
  4. Share it through git, a URL, a gist or the registry
  5. Upgrade servers with nwm recipe upgrade when the recipe changes