The dotnet 5 sdk can be download from https://dotnet.microsoft.com/download/dotnet/5.0 . Note that to build the CLI environment from the plugins list and the C# server applications (SA), Stormancer requires the SDK and not only the Runtime, on the server.
Git can be installed on the server to enable Git based deployment. However, it’s optional.
The Stormancer CLI is installed as a dotnet tool:
dotnet tool install Stormancer.CLI --global
This command installs stormancer as a global tool. If you intend to be able to run different versions of the Stormancer CLI, you may prefer installing as a local tool. See the dotnet tool documentation to learn how to do that. If running a local tool, use ‘dotnet tool run stormancer’ instead of ‘stormancer’ in all the following commands.
By default, the Stormancer CLI is installed with its server plugin and the NLog logging output. Installed plugins can be listed by running the following command:
stormancer plugins list
A stormancer server needs a configuration file to run. It’s possible to create a default configuration using the CLI:
stormancer new config
This command will create a configuration file name ‘default.json’. This is the configuration name used by default when starting a server with no configuration file specified. However, use -c to create a named configuration:
stormancer new config -c my-server
A server is started by running the start command:
This starts the server with default.json as the configuration file. To choose a configuration, run:
stormancer start -c my-server
To easily test multinode distributed environment, the start command can start serveral server instances at once by specifying several configuration files:
stormancer start -c my-server-1 my-server-2
For the above command to succeed, my-server-1.json and my-server-2.json must exist in the current directory.
On a development computer, you may want to install the Stormancer management CLI. It is available as a plugin of the Stormancer CLI:
stormancer plugins add --id Stormancer.Management.CLI
To update a plugin, use this CLI command:
stormancer plugins update --id Stormancer.Management.CLI
The environment is now ready, however you probably want to try running a first server application.
We provide a simple application that supports authentication, player parties, queue based matchmaking and P2P game sessions on https://github.com/Stormancer/sample-server-app . Let’s install it on the server that was started in the previous steps.
First create a directory from where you will manage the application. This directory can be the same of the server startup directory or another one. It will contain the application profile, a file containing all information required to deploy an app (where to find the application code, the configuration, as well as what cluster the app should be deployed to, the account and name of the application in this cluster).
By default, the server starts with the public HTTP endpoint (used for APIs called by the game client) on http://localhost , the admin API on http://localhost:81 and the UDP transport on port 30100. To add the cluster that we started locally to the CLI managed clusters list, use the manage clusters add command with the admin endpoint of one of the servers in the cluster as argument.:
stormancer manage clusters add --endpoint http://localhost:81
note that if you started the server on a remote computer, you can replace the endpoint.
You can check that the cluster was correctly registered and its id by running the ‘clusters list’ command:
>stormancer manage clusters list ├── Success └── Result └── default └── Endpoint └── http://localhost:81
If the default configuration wasn’t changed, the cluster should be registered with id ‘default’:
The application profile file contains all the information necessary for the CLI to perform operations on a target applications, including creating it, updating its config and deploying.
Create an application profile for the sample app available on github by running the following command:
stormancer new app-profile --cluster default --account tests --app test -o test-app.json --configSource https://raw.githubusercontent.com/Stormancer/sample-server-app/dev/config.json --deploySource git::https://github.com/Stormancer/sample-server-app.git::dev::src
This app profile declares an application named test in the account tests on the cluster with id default in the CLI clusters list.
It associates with this app:
A config file located on https://raw.githubusercontent.com/Stormancer/sample-server-app/dev/config.json . It’s possible to use file path or files in a git directory using the same syntax as the ‘deploySource’ argument.
A set of files to deploy as the application source from a subdirectory in a github Git repository : git::https://github.com/Stormancer/sample-server-app.git::dev::src (syntax: git::<repositoryUrl>::<branch>::<subdirectory> )
Creating the application, uploading a configuration and deploying the application’s code is done using a single command:
stormancer manage app deploy --app .\test-app.json --create --configure --deploy ├── Success └── Result ├── createdApp │ └── True ├── updatedConfig │ └── True └── deployedApp └── True
To perform only part of the process, specify the required flags:
–create creates the account & application on the server if necessary.
–configure updates the app configuration from the app profile config source.
–deploy deploys the app from profile deployment source.