The metaplay command-line tool is used to manage projects using Metaplay, to build and deploy the game server into the cloud, and to interact with the cloud environments.
The installation is easiest using any of the supported package managers or install scripts.
Using Homebrew (recommended):
brew tap metaplay/homebrew-tap
brew install metaplayUsing install script:
bash <(curl -sSfL https://metaplay.github.io/cli/install.sh)Using Scoop (recommended):
scoop bucket add metaplay https://github.com/metaplay/scoop-bucket
scoop install metaplayUsing Chocolatey:
choco install metaplayUsing install script:
bash <(curl -sSfL https://metaplay.github.io/cli/install.sh)You can find the latest release on our Github releases page.
-
We provide 64-bit builds for Linux, macOS (both Intel and Apple Silicon), and Windows.
-
Download the correct archive for your OS and CPU architecture as indicated on the filename (e.g.
MetaplayCLI_0.1.0_Linux_x86_64.tar.gz). -
Unpack the contents into a directory that is included in your
PATHenvironment variable, or create a new directory and add it to yourPATH. -
Now you can run the
metaplayexecutable in your terminal and it will output further instructions. See section Usage for details.
You can add Metaplay SDK to your existing game using the integration wizard in the CLI by running:
MyProject$ metaplay init projectThis will link your local project to the Metaplay Portal, download and extract the SDK, and add the game-specific backend project.
For a new game, see the Sample Projects documentation for ready-to-run samples and starter projects to build on.
You must run the steps in the same directory as your metaplay-project.yaml project config file
is located.
First, build the game server docker image.
MyProject$ metaplay build image <image>:<tag>Then, deploy the game server to an environment:
MyProject$ metaplay deploy server <environment> <image>:<tag>The command also pushes the docker image to the environment's registry.
To get logs from your game server running in the cloud, use the following:
metaplay debug logs ENVIRONMENTBy default, it shows time-ordered logs from all pods, but you can also only target a single pod with:
metaplay debug logs ENVIRONMENT --pod=POD_NAMEIt's enough to provide only the environment ID's suffix. For example, in project lovely-wombats-build, the environment lovely-wombats-build-quickly can be targeted with just:
metaplay debug logs quicklyAlternatively, you can run the command without any parameters and the CLI will ask you the project and environment:
metaplay debug logsTo access the Kubernetes control plane for your environment, you can do the following:
# Get the kubeconfig file for the environment.
metaplay get kubeconfig ENVIRONMENT -o <pathToKubeconfig>
# Configure kubectl to use the kubeconfig file.
export KUBECONFIG=<pathToKubeconfig>
# Check the status of your pods.
kubectl get podsBy default, the generated kubeconfig file will invoke the metaplay CLI itself to resolve the credentials used to communicate with the Kubernetes control plane.
For detailed instructions on how to set up your CI system, see the Setup CI Pipeline guide.
It's generally easiest to run the metaplay CLI in your project directory, i.e., where metaplay-project.yaml is located. This way the CLI knows the project you're working with and can target operations to operate on that.
If you wish to run in another directory, provide the path to the project directory with -p <pathToProject>.
If you have any issues running a command, give it the --verbose flag to get more detailed output on what is happening, e.g.:
metaplay deploy server <environment> <image>:<tag> --verboseThe CLI supports storing multiple sessions at the same time. This can be useful when working with projects that use 3rd party authentication instead of Metaplay Portal for their authentication.
The authentication provider is determined from the metaplay-project.yaml and thus any authentication operations are dependent on the project in the context of which the CLI is run.
If you have a paid support contract with Metaplay, you can open a ticket on the Metaplay portal's support page.
If you develop the CLI or the Metaplay platform, see DEVELOPMENT.md for building and testing the CLI, for development builds and update channels, and for running it against a local or test environment.
This module and all files within are distributed under the Apache-2.0 license.
