Skip to content
This repository has been archived by the owner on Jul 14, 2020. It is now read-only.

Running a game

Kamila Součková edited this page Oct 8, 2019 · 18 revisions

See Setting up the game infrastructure if you want to create a new environment from scratch instead of working with the one we already have.

During the game, we need to manage:

  • the webserver: provides the front-end for users and calculates scores
  • the master: coordinates the execution of rounds

These run on the same machine, but are separate and only share data via the filesystem.

We run both of these from a single clone of this repository: we clone the repo to ~/scionlab-workshop and run the webserver from ~/scionlab-workshop/webserver and the master from ~/scionlab-workshop/master. In the following, I indicate with (master) or (webserver) where to run the commands. (The webserver commands, i.e. scionlab.sh, can actually be run from a remote machine, assuming that the environment variables are set up.)

The commands need to be run within the respective virtualenv: run pipenv shell in the master/ and webserver/ directories respectively, or prefix everything with pipenv run. Also make sure you've set up the environment variables: see .env (or example.env) in master/ and webserver/.

Clearing the state / removing data from a previous run

Run ./clearstate.sh in the top-level directory in order to clear everything, or inside master/ or webserver/ in order to clear just one component.

Starting a contest

(webserver)  $ python ./webserver.py             # run the webserver
(webserver)  $ ./scionlab.sh manage signup       # enable signup
             # now users can sign up using: $ ./scionlab.sh signup username
(webserver)  $ ./scionlab.sh manage signup       # disable signup
(webserver)  $ ./scionlab.sh manage teams        # create the teams/ folder
(webserver)  $ ./scionlab.sh manage config       # generate the round configs
             # now users can submit by running: $ ./scionlab.sh submit myprog.py
(master)     $ buildbot start buildbot-master    # start the master => run rounds

The current implementation runs rounds whenever the master is up. I intend to change this, so that the buildmaster can be up all the time and we can easily toggle rounds: tracking this in #23.

What if it's broken?

Check the Buildbot dashboard: accessible over HTTP on http://<master_machine>:8010/. If something isn't green, look at its logs to find out why. If rounds aren't starting, check the status of the workers (under "Builds > Workers" in the left sidebar).

Both the master and the webserver can be restarted in place without losing data:

(webserver)  kill webserver; $ python ./webserver
(master)     $ buildbot restart buildbot-master

Stopping a contest

(master)     $ buildbot stop buildbot-master
(webserver)  kill webserver
Clone this wiki locally