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
directx.py: Sample script for the directx Sample
unity.py
: Sample script for the unity Sampleut4.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 directx.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 directx.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:
Change the
version
number to 1.7.0.Remove the
name
section (now included in the settings info section).Change
depends_on
from your job todependencies
.Remove the
event
section (now handled by having anevents.json
file in the config directory).For the logs, there are various changes:
stdout
andlogfilename
where replaced with a single fieldfileName
. If you have alogfilename
, just use the same value forfileName
. If you havestdout
to true, setfileName
to “stdout”. If it is false, setfileName
to “stderr”.Settings for video
encode
(input and output) andinfo
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" } }
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.