Deploying to the cloud
1. (First time only) Configure the project
The first time you deploy, configure your
- In the project’s root directory, open
spatialos.json. This file holds your project’s global configuration.
namefield, rename the value to your assigned SpatialOS project name.
You can find your project name in the Console. It’ll be something like
2. Build the project
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 --target=deployment
When it finishes successfully, you’ll see
build finished in your console output.
3. Upload project assembly to the cloud
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 has run successfully, you’ll see
upload <assembly name> finished in your
4. Choose the snapshot to start from
All deployments must start from a snapshot. You can:
- download a snapshot from a previous deployment
- choose an existing snapshot you’ve already created
- create a snapshot from scratch
You’ll use this snapshot in step 5.
5. Deploy the project
To deploy the project to the cloud, run
spatial cloud launch <assembly name> <launch configuration file> <deployment name> --snapshot=<snapshot file> [flags]
- assembly name is the name of the assembly you uploaded with
spatial cloud upload.
- launch configuration file is a launch configuration file. It’s
default_launch.jsonin 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 --helpto see the list of available flags.
spatial cloud launch my_assembly_name_160809 default_launch.json my_deployment_name --snapshot=snapshots/default.snapshot --cluster_region=eu
spatial cloud launch --help for more information.
When this finishes successfully, you’ll see
Successfully created deployment in your console output.
The output will also give you a link to your deployment in
6. (Optional) Launch a client
- Open the Console.
- Find your deployment and click on its name. The page that opens will shows an overview of the deployment.
Launch a client:
Click the ▶ Launch button.
Click Launch Your Deployment:
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.
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:
Open the Console.
Find your deployment and click on its name.
In the page that opens, click the STOP button:
Alternatively, you can use the spatial cloud delete 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
- 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.