SDK in the cloud¶
One a cluster is up. The SDK and the project need to be uploaded to this cluster.
Loading the sdk to a cluster¶
To load a project in the cloud the first step is to upload the SDK images to a s3 bucket. This step may take a while.
genvid-sdk -c myclusterid upload-images-sdk
The next step is to setup the sdk.
genvid-sdk -c myclusterid setup
After this short step, some services are available in genvid-UI. Go to the clusters page and then click on Jobs. The list of jobs is empty.
genvid-sdk -c myclusterid load-config-sdk
The sdk definition was loaded and now there is one job. services
.
Loading a project in a cluster¶
The file config/stream.hcl
should contains your key and
channel as explained in Configuring Live Streaming:
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 = "secrettochange"
}
command {
GENVID_COMMAND_SECRET = "anothersecret"
}
}
Build tutorial for the cloud¶
This step assumes that docker host was setup correctly as explained in Building with Docker. You can now build the images for the tutorial by calling:
py tutorial.py build-cloud
Now, upload the images and load the project definition:
py tutorial.py -c myclusterid upload-images
py tutorial.py -c myclusterid load
After this step, the images are available on S3, and the project configuration is loaded and ready to use in the cloud. You can now open the Jobs page:
genvid-sdk -c myclusterid monitor
Click on start all button. When the Tutorial Demo
link becomes
enable. Click on it. Check that everything is working correctly.
To stop the services, simply click on the Stop All
button.
Running the Unreal Tournament game¶
Unreal Tournament is a large game, and requires some preparation in order to simplify transfers to the server. To start, you need to create a package.
The first thing to do is to package your game project. Follow the
Unreal Engine Documentation on Packaging Projects
and create a Package for the WindowsNoEditor
platform in
Development
mode. The [UT Folder]
below corresponds to the
[PackageDirectory]\\WindowsNoEditor
folder of the documentation.
aws s3 mb s3://[some_unique_name]/v1/
aws s3 sync [UT Folder]/ s3://[some_unique_name]/v1/
Now, edit the bucket in your configuration files. For the sample, we
add a section in config/stream.hcl
for this purpose. An
example is available under config/steam.example.hcl
:
config {
cloud {
artifact {
s3url = "s3://[some_unique_name]/v1/"
destination = "z:\\game\\"
}
}
}
The destination
value is the folder in which the game will be
downloaded on the game machine. We are using the Z:
drive,
which is a local drive to the AWS instance, to avoid hitting IO limits
of an EBS volume which would otherwise stall the game process.
Ensure the cluster is properly setup:
genvid-sdk -c myclusterid clean
genvid-sdk -c myclusterid setup
genvid-sdk -c myclusterid load-config-sdk
Load the project definition into the cluster
py ut4.py -c myclusterid load
And then start the custom job for updating the game:
genvid-sdk -c myclusterid start update
This will start a job. It takes about 5 minutes, and you can see the last output and status of the job using:
genvid-sdk -c myclusterid log -t update
Or simply look it up on the hashi-ui webpage.
During this time, you can build the website as normal and upload it to S3 too:
py ut4.py -c myclusterid build-cloud
py ut4.py -c myclusterid upload-images
The last command will ensure that the Docker images are all up-to-date.
Once the update job is finished, you can start the game as usual:
genvid-sdk -c myclusterid start
After a couple of seconds, the website should be ready. Open the webpage with the command:
genvid-sdk -c myclusterid open web
For stopping the game after that, just run:
genvid-sdk -c myclusterid stop # Stop the game but not the servers.