Clusters

A cluster is a group of machines running in the cloud.

Creating a cluster

To create a cluster, the Genvid Bastion must be running. You can use the genvid-bastion script to manage it. The following command starts the minimal services required.

genvid-bastion install --checkmodules

The --checkmodules option will install new modules if none are present or will update the ones already present. The next step is to open a Bastion-UI web site to manage the Clusters.

genvid-bastion monitor
On the Bastion-UI page:
  • Go to the Settings/Config page.
  • Choose a Bastion name.
  • Click on Update
Choosing a unique name for the Bastion
On the clusters page:
  • Click create.
  • Choose a unique cluster id.
Create a cluster

You can select another backend if needed. For now, you can stick with the default values. Some backends may require configuring variables.

Cluster status

After creating a cluster, its status is EMPTY. This means that the cluster needs a module. The cluster statuses are:

  • VOID: The cluster doesn’t exist.
  • EMPTY: Cluster created but without a module.
  • DOWN: Cluster is initialized but resources are empty.
  • UP: Terraform apply has succeeded.
  • BUSY: A command is actually running.
  • ERROR: An error occured when checking the cluster.
  • INVALID: Invalid or unknown status.

Terraform Module

Before configuring the cluster, you must initialize it with a module. This will copy the module template and will download any modules and plugins required by it.

  • Click on the Module link.
  • Select the cluster/default module.
  • Click the Import module button.
Terraform module

You will see an initialization log appear. This step should last only a few seconds.

Terraform Configuration

Terraform settings

Terraform is used to build the cluster insfrastructure, so the settings values are used to configure the cluster infrastructure. Click on the Settings link for your cluster and edit the settings.

  • region is the AWS region where your cluster will be created. The default setting is us-east-1. You can use any region that contains G2 instances [1].
  • game_az is the AWS availability zone, with the region prefix. It should be the same as the one you get in Starting the initialization AMI. The default settings is a. If a zone doesn’t have any G2 instances available you must change to a zone that does. (Currently, there isn’t a way to know in advance if an instance will be available in a specific zone.)
  • admin_password is the administrator password for the Windows machine. It is set to 1genvid6 by default. The Windows machine is only accessible from the other server instances and from other machines that share the same external IP as yours [2].
  • ami_prefix is a common prefix for the game AMI. This is the prefix used in the section Saving the AMI. The default is default. You can change it if you want to experiment with your own AMI.

The next 2 settings’ values are provided automatically to the Terraform configuration via environment variables. So they don’t need to be set manually.

  • cluster is the name of your cluster.
  • bastionid is the name of your Bastion.

See the Terraform Configuration Documentation for more information on how to setup those variables globally or locally.

[1]The region currently must be the same as the default region in your AWS configuration.
[2]Future versions of the Cluster will use a bastion host instead for increased security.

Applying terraform infrastructure

Terraform apply is the operation that builds the cluster infrastructure.

Click on Apply to build the infrastructure

Terraform apply

You should see the log starting to appear.

If Terraform fails to build the infrastructure:
  • Check the error message.
  • Update the settings.
  • Apply again.

At the end of this step, there is a cluster running on the cloud. When you check the Clusters page, the status is Up: Setup needed!. This means that the infrastructure is up, but the Genvid SDK is not yet present in it.

Destroying Terraform infrastructure

To destroy the Terraform infrastructure, click the Destroy button.

Deleting a cluster

To delete a cluster, you have to destroy the Terraform infrastructure first. Go to the clusters page and click the Delete button.

Using custom repositories

You can add and remove individual terraform repository in the bastion. Each repository contain one or more modules that can be used to instantiate a cluster. To list the current repositories, you can use:

genvid-clusters module-list

To add a new module, just run:

genvid-clusters module-add -u {URL} {name}

Where {URL} can be any source compatible with go-getter, including local files, and {name} is the destination folder to this repository on bastion. After the URL being cloned in the bastion repository, it will be available as a source under modules/module. See Terraform’s Module Configuration for more details on using modules.

Bastion remembers the origin of each modules, so you can easily update them by running:

genvid-clusters module-update [name]

The name is optional. If you don’t provide it, all repositories will be update.

Removing a module is as simple as running:

genvid-clusters module-remove {name}

See also

genvid-clusters
Genvid Clusters Management script documentation.
Modules
Bastion API for Terraform
Terraform’s Module Configuration
Documentation of Modules on Terraform
go-getter
A library for fetching URL in Go.