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 10, 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

The buildbot master should be running all along, but if it isn't, run:

(master)     $ buildbot start master
(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)     $ ./run_toggle.sh                   # enable running rounds

Stopping the contest

(master)     $ ./run_toggle.sh                   # toggle running rounds

What if it's broken?

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

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

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