Upgrade from 1.6.0 to 1.7.0

In this release, local.py and cloud.py have been deprecated and replaced with a new set of tools.

  • Bastion API: Web API to manage clusters and run terraform scripts
  • genvid-bastion: Console application used to start a local bastion an cluster
  • genvid-clusters: Console application used to manage clusters
  • genvid-sdk: Console application used to configure a cluster
  • tutorial.py: Sample script for the tutorial Sample
  • unity.py: Sample script for the unity Sample
  • ut4.py: Sample script for the ut4 Sample

You can look at the samples for how the new structure is working. Each sample have now a personalised script and configuration files. The content of the genvid.hcl have been split in multiple files under the config folder. So all configuration is under the same folder.

Upgrade a project

In order to upgrade your project, you can start by using tutorial.py as a base script. This script was done in a way to simplify as much as possible the upgrade process.

The first step is to copy tutorial.py under your working folder and rename it as you see fit, for example mygame.py.

Building your project

Edit the build and build_cloud function inside the mygame.py script that you copied from the last step to build your application and web site. You can skip this part if you have custom scripts.

def build(self, targets: List[str]):
    if "game" in targets:
        self.pyrun(os.path.join(self.base_dir, "run.py"), "build")
    if "web" in targets:
        self.pyrun(os.path.join(self.base_dir, "web", "build.py"), "build")

def build_cloud(self, targets: List[str]):
    if "game" in targets:
        self.pyrun(os.path.join(self.base_dir, "run.py"), "all")
    if "web" in targets:
        self.pyrun(os.path.join(self.base_dir, "web", "build-docker.py"), "all")

Try doing py mygame.py build to see if it is working.

Move genvid.hcl and edit the file

With this update we can now split our configuration in multiple files. The game and the web can now be decouple.

Move genvid.hcl to the config folder related to your script. You can split this file according to your need. To be up to date with version 1.7.0, you need to do various changes to your genvid.hcl file:

  1. Change the version number to 1.7.0.

  2. Remove the name section (now included in the settings info section).

  3. Change depends_on from your job to dependencies.

  4. Remove the event section (now handled by having an events.json file in the config directory).

  5. For the logs, there are various changes: stdout and logfilename where replaced with a single field fileName. If you have a logfilename, just use the same value for fileName. If you have stdout to true, set fileName to “stdout”. If it is false, set fileName to “stderr”.

  6. Settings for video encode (input and output) and info about the project are now added in this file.

    settings {
      encode {
        input {
          width  = 1280
          height = 720
        }
        output {
          width  = 1280
          height = 720
        }
      }
      info {
        description = "Genvid Technologies Unity3D Sample"
        game        = "unitySample"
        name        = "unity sample"
      }
    }
    
  7. Remove all the script sections. We now handle the build command directly with the Python script.

Edit the CONFIG_FILES variable inside the mygame.py script ythat you made for your project. Tell the script which config file needs to be loaded and in what order.

CONFIG_FILES = [
    dict(name="genvid", required=True), // The file you just moved
    dict(name="stream", required=True),
    dict(name="events", required=True),
]
"The configuration files to load in order. The order is important "
    "as later files may override values from previous files."

Either edit config/stream.example.hcl and rename it to stream.hcl, or create a stream.hcl directly. You can put your settings and secrets here.

version = "1.7.0"

settings {
  encode {
    stream {
      enable  = true
      addr    = "a.rtmp.youtube.com/live2"
      // YOU MUST CHANGE THE CHANNEL AND KEY VALUE
      service = "youtube"
      channel = ""
      key     = ""
    }
  }
}
secrets {
  disco {
    GENVID_DISCO_SECRET = "discosecret"
  }
  command {
    GENVID_COMMAND_SECRET = "commandsecret"
  }
}

Nomad templates

Move the template under the folder templates/local and templates/cloud. This is where the script is looking for the templates. Make sure that the template files matches the name of their jobs.

Images upload

You can now upload your images directly from your script. Edit the IMAGES list to upload to the cloud.

IMAGES = dict(game="my_game_dev_", web="my_web_dev_")
"The list of images to upload"

Moving the events definition into the config

Create and edit config/events.json. Copy the content of the mr.json file into the game element.

{
  "version": "1.7.0",
  "event": {
    "game": {} // Copy mr.json contents inside the braces
  }
}

Optional: Split your configuration into multiple files

Your configuration can now be split into multiple files. This is useful when separate teams are working on the web site and the game. To do so, simply create another configuration file and move the parts that you want into it. See also the load-config command of genvid-sdk.