Deploy to the cloud

This page runs you through deploying a project to the cloud.

The quick version

In-China instructions

Only follow the in-China instructions if you are located in China and deploying your game to server nodes hosted in China. You can only deploy to server nodes hosted in China if you're located in China. For more information, contact your account manager or get in touch.

  1. (First time only) Configure the project's spatialos.json file.
  2. Build the project:
    • Outside of China: spatial worker build -t=deployment
    • In China: spatial worker build -t=deployment --environment=cn-production
  3. Upload the built assembly: spatial cloud upload <assembly name>
  4. Choose a snapshot.
  5. Deploy: spatial cloud launch <assembly name> <launch configuration file> <deployment name> --snapshot=<snapshot file>
  6. (Optional) Launch a client: Go to the Console (outside of China/in China).

1. (First time only) Configure the project

The first time you deploy, configure your project's spatialos.json:

  1. In the project's root directory, open spatialos.json. This file holds your project's global configuration.
  2. In the name field, rename the value to your assigned SpatialOS cloud project name.
    You can find your cloud project name in the Console. It'll be something like beta_someword_anotherword_000.

2. Build the project

Now you need to build an assembly.

For exactly what to build, see Building from the command line.

Or, to build the whole project, in the project's root directory, run:

spatial worker build

When this finishes, the result is output to your console.

3. Upload project assembly to the cloud

Outside of China

To upload the assembly you just built from your project, run:

spatial cloud upload <assembly name>

where assembly name is a name you choose. It'll identify the assembly you just built.

When this finishes, the result is output to your console.

In China

In-China instructions

Only follow the in-China instructions if you are located in China and deploying your game to server nodes hosted in China. You can only deploy to server nodes hosted in China if you're located in China. For more information, contact your account manager or get in touch.

To upload the assembly you just built from your project, run:

spatial cloud upload <assembly name> --environment=cn-production

where assembly name is a name you choose. It'll identify the assembly you just built.

When this finishes, the result is output to your console.

When you update SpatialOS versions, you must rebuild the assembly and upload it with a different name. You could add a date or a commit hash to the name; for example, my_assembly_name_160817.

4. Choose the snapshot to start from

All deployments must start from a snapshot. You can:

You'll use this snapshot in step 5.

5. Deploy the project

Outside of China

To deploy the project to the cloud, run:

spatial cloud launch <assembly name> <launch configuration file> <deployment name> --snapshot=<snapshot file> [flags]

This command defaults to deploying to a US production cluster (such as us3-prod). If you're in Europe, add --cluster_region=eu to deploy to a European cluster.

In China

To deploy the project to the cloud, run:

spatial cloud launch <assembly name> <launch configuration file> <deployment name> --snapshot=<snapshot file> [flags] --environment=cn-production

In-China instructions

Only follow the in-China instructions if you are located in China and deploying your game to server nodes hosted in China. You can only deploy to server nodes hosted in China if you're located in China. For more information, contact your account manager or get in touch.

where:

  • assembly name is the name of the assembly you uploaded with spatial cloud upload.
  • launch configuration file is a launch configuration file. It's usually default_launch.json in the project's root directory.
  • deployment name is the label for this deployment in the Console. Must be in lowercase.
  • snapshot file is the snapshot to start the world from, which you chose in step 4
  • flags are optional flags. Run spatial cloud launch --help to see the list of available flags.

Example:

spatial cloud launch my_assembly_name_160809 default_launch.json my_deployment_name --snapshot=snapshots/default.snapshot --cluster_region=eu

Run spatial cloud launch --help for more information.

When this finishes, the result is output to your console, including a link to your deployment in the Console.

6. (Optional) Launch a client

Outside of China

If your project has a client built using the GDK for Unity or GDK for Unreal, you can follow these steps to launch it:

  1. Open the Console.
  2. Find your deployment and click on its name. The page that opens shows an overview of the deployment.
  3. Launch a client:
    1. Click the ▶ Launch button.
    2. If you don't already have it, install the Improbable Launcher (Windows/Mac).
    3. Click Launch:

You can now explore your project from the client.

If you don't want to or can't use the Launcher, you can connect a worker to the deployment.

In China

In-China instructions

Only follow the in-China instructions if you are located in China and deploying your game to server nodes hosted in China. You can only deploy to server nodes hosted in China if you're located in China. For more information, contact your account manager or get in touch.

You need to launch using the Launcher.

7. Stop the deployment

Manually stopping a deployment

We recommend manually stopping a deployment after you've finished with it, to save on resource usage.

To manually stop a deployment:

  1. Open the Console (outside of China/in China).

In-China instructions

Only follow the in-China instructions if you are located in China and deploying your game to server nodes hosted in China. You can only deploy to server nodes hosted in China if you're located in China. For more information, contact your account manager or get in touch.

  1. Find your deployment and click on its name.
  2. In the page that opens, click the STOP button:

Alternatively, you can use the spatial cloud stop command.

Automatically stopping deployments

By default, deployments are stopped automatically 6 hours after they start. You can add tags in the Console to change this behaviour:

  • To keep the deployment running until 5pm UTC on the next weekday, add the tag nightly.
  • If you want to keep deployments running longer, raise a support request (for customers with a service agreement) or ask on our forums.

You can also add tags when you launch a deployment with spatial cloud launch --tags, where tags are a comma-delimited list of tags to add to the new deployment.

Updated 11 months ago


Deploy to the cloud


Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.