Monarch Of The Hill - base infrastructure for computer-based puzzle contests
Go to file
John Donaldson d612e17d14 HTML-escape hexdump content so it doesn't break pages 2018-09-27 16:07:03 -05:00
contrib Cache points.json and puzzles.json 2018-09-20 03:44:34 +00:00
devel HTML-escape hexdump content so it doesn't break pages 2018-09-27 16:07:03 -05:00
docs Merge branch 'mothv3' 2018-09-20 17:51:46 +00:00
example-puzzles Add a counting example puzzle 2018-04-12 14:58:12 +00:00
res Fix puzzles on iOS 2018-09-21 23:45:28 +00:00
src Merge branch 'master' of https://github.com/dirtbags/moth 2018-09-24 20:00:21 +00:00
www Cleanup from merge 2018-09-20 17:53:15 +00:00
.dockerignore More dockering 2017-09-11 16:12:22 +00:00
.gitignore Reworked some basics of how the Puzzle class works. Shouldn't look to different from the outside. 2016-10-17 13:24:54 -06:00
Dockerfile.moth Remove legacy cruft, back to original name for moth package 2018-09-20 16:32:12 +00:00
Dockerfile.moth-devel Update devel server build rules for new layout 2018-09-26 18:32:18 +00:00
LICENSE.md Change license to comply with LANL legal request 2017-09-08 20:58:33 +00:00
README.md Remove legacy cruft, back to original name for moth package 2018-09-20 16:32:12 +00:00
build.sh Update devel server build rules for new layout 2018-09-26 18:32:18 +00:00
devel.sh update usage message 2017-09-15 10:27:53 -06:00

README.md

Dirtbags Monarch Of The Hill Server

This is a set of thingies to run our Monarch-Of-The-Hill contest, which in the past has been called "Tracer FIRE", "Project 2", "HACK", "Queen Of The Hill", "Cyber Spark", "Cyber Fire", "Cyber Fire Puzzles", and "Cyber Fire Foundry".

Information about these events is at http://dirtbags.net/contest/

This software serves up puzzles in a manner similar to Jeopardy. It also tracks scores, and comes with a JavaScript-based scoreboard to display team rankings.

Running a Development Server

docker run --rm -it -p 8080:8080 dirtbags/moth-devel

And point a browser to http://localhost:8080/ (or whatever host is running the server).

When you're ready to create your own puzzles, read the devel server documentation.

Click the [mb] link by a puzzle category to compile and download a mothball that the production server can read.

Running a Production Server

docker run --rm -it -p 8080:8080 -v /path/to/moth:/moth dirtbags/moth

You can be more fine-grained about directories, if you like. Inside the container, you need the following paths:

  • /moth/state (rw) Where state is stored. Read the overview to learn what's what in here.
  • /moth/mothballs (ro) Mothballs (puzzle bundles) as provided by the development server.
  • /moth/resources (ro) Overrides for built-in HTML/CSS resources.

Getting Started Developing

If you don't have a puzzles directory, you can copy the example puzzles as a starting point:

$ cp -r example-puzzles puzzles

Then launch the development server:

$ python3 tools/devel-server.py

Point a web browser at http://localhost:8080/ and start hacking on things in your puzzles directory.

More on how the devel sever works in the devel server documentation

Running A Production Server

Run dirtbags/moth (Docker) or mothd (native).

mothd assumes you're running a contest out of /moth. For Docker, you'll need to bind-mount your actual directories (state, mothballs, and optionally resources) into /moth/.

You can override any path with an option, run mothd -help for usage.

State Directory

Pausing scoring

Create the file state/disabled to pause scoring, and remove it to resume. You can use the Unix touch command to create the file:

touch state/disabled

When scoring is paused, participants can still submit answers, and the system will tell them whether the answer is correct. As soon as you unpause, all correctly-submitted answers will be scored.

Resetting an instance

Remove the file state/initialized, and the server will zap everything.

Setting up custom team IDs

The file state/teamids.txt has all the team IDs, one per line. This defaults to all 4-digit natural numbers. You can edit it to be whatever strings you like.

We sometimes to set teamids.txt to a bunch of random 8-digit hex values:

for i in $(seq 50); do od -x /dev/urandom | awk '{print $2 $3; exit;}'; done

Remember that team IDs are essentially passwords.

Mothball Directory

Installing puzzle categories

The development server will provide you with a .mb (mothball) file, when you click the [mb] link next to a category.

Just drop that file into the mothballs directory, and the server will pick it up.

If you remove a mothball, the category will vanish, but points scored in that category won't!