This is an attempt to create an open-source, MIT-license-friendly, content runner for HSPC-style and similar coding contests.
This project was born as a project at RubyforGood 2017.
SubmissionRunner is used to compile and run the language of choice in order to score a
SubmissionRunners::Base handles the logic for building docker containers used in compiling the language and running the submission. Each language's runner should inherit from
Base and provide methods for the image, how to compile the language, and how to run it.
We are using TTY::Command to interface with the docker command line.
SubmissionRunners::Base offers a
docker_run method, which a language runner's
run methods should utilize.
docker_run accepts a splatted
command parameter. This gets passed through to the docker container as its run command.
For example, a program
Foobar is compiled via
$ javac Foobar.java
Acceptable inputs to
docker_run might look like:
After compilation, running a class
Foobar is accomplished with
$ java Foobar
Acceptable inputs might look like:
#source_file method returns a
Pathname subclass) instance bound to the
basename of the participant-submitted source code file for this run. It responds to
#without_extension, which returns an extension-less instance (helpful for compiler targets), as well as the entire
If your language doesn't need a build step (the vast majority of interpreted languages don't, for example), then you can omit a
#build method for your runner.
$ bundle exec rake # all specs $ bundle exec rake ci # all specs + rubocop $ bundle exec rake minus_docker # non-docker specs $ bundle exec rake dev_specs # non-docker specs + rubocop
- David Bock (firstname.lastname@example.org, @bokmann), Team Lead
- Daniel P. Clark (email@example.com, @danielpclark)
- Brandon Rice (firstname.lastname@example.org, @brandonlrice)
(contributors, please add your information here.)
- Install Ruby v2.4.1
- Install (and start) Redis
mkdir -p /var/lib/milton- You must ensure that the user running the app has permissions in this directory.
- Install Docker
curl -fsSL https://get.docker.com/ | sh; sudo usermod -aG docker $(whoami)
- Pull docker images
git clone https://github.com/rubyforgood/loudoun_codes.git
bundle exec rake db:setup
bundle exec foreman start
If you are running the application for an actual competition, you probably want to use
RAILS_ENV=production bundle exec foreman start in step 7.
After starting the application, you will see this line (or something similar) in your output:
14:25:13 web.1 | * Listening on tcp://0.0.0.0:5100
Browse to the provided address and you will see the web application. Browse to
/sidekiq to see statistics about currently running jobs.
The 'getting started' instructions are above are while this project is in active development. A near-future goal of this project is to make deployment as brain-dead simple as possible. We may, for instance, wrap this code in a mini custom linux distribution so it could be put on a thumb drive and take over a machine for the purpose of the running content. We had previously considered a docker container mimicking the setup of the jenkins docker container, but considering our use of docker containers for the submission judging, we believe the inception scenario there would hurt our heads too much.