cyber-dojo web server default  start-points


  • The languages start-point page holds the choices where you select your language (eg C#) and test-framework (eg NUnit).
  • The default languages start-point page is called languages.
  • languages is created from the cyber-dojo-languages github repo which contains manifest.json files.


  • The exercises start-point page holds the choices where you select your exercise (eg Fizz Buzz).
  • The default exercises start-point page is called exercises
  • exercises is created from the cyber-dojo-exercises github repo which contains instructions text files.


  • The custom start-point page holds the choices displayed when you switch to custom choices.
  • The default custom start-point is called custom
  • custom is created from the cyber-dojo-custom github repo which contains manifest.json files.

creating a new default start-point

To use a different default start-point simply bring down the server, delete the one you wish to replace, create a new one with that name, and bring the server back up. For example, to create a new languages start-point:
$ ./cyber-dojo down $ ./cyber-dojo start-point rm languages $ ./cyber-dojo start-point create languages --dir=... $ ./cyber-dojo up

$ ./cyber-dojo start-point ...

Start-points are controlled using the start-point command of the cyber-dojo script.
$ ./cyber-dojo start-point Use: cyber-dojo start-point [COMMAND] Manage cyber-dojo start-points Commands: create Creates a new start-point rm Removes a start-point ls Lists the names of all start-points inspect Displays details of a start-point pull Pulls all the images named inside a start-point Run 'cyber-dojo start-point COMMAND --help' for more information on a command

For example:
$ ./cyber-dojo start-point ls NAME TYPE SRC custom custom exercises exercises languages languages

For example:
$ ./cyber-dojo start-point inspect languages MAJOR_NAME MINOR_NAME IMAGE_NAME PULLED? Asm assert cyberdojofoundation/nasm_assert no BCPL all_tests_passed cyberdojofoundation/bcpl_all_tests_passed no Bash bash_unit cyberdojofoundation/bash_unit yes ... C (clang) Cgreen cyberdojofoundation/clang_cgreen no ... C (gcc) Cgreen cyberdojofoundation/gcc_cgreen no ... C# Moq cyberdojofoundation/csharp_moq yes ... C++ (clang++) Cgreen cyberdojofoundation/clangpp_cgreen no ... C++ (g++) Boost.Test cyberdojofoundation/gpp_boosttest no ... Clojure Midje cyberdojofoundation/clojure_midje no ... CoffeeScript jasmine cyberdojofoundation/coffeescript_jasmine no D unittest cyberdojofoundation/d_unittest no Erlang eunit cyberdojofoundation/erlang_eunit no F# NUnit cyberdojofoundation/fsharp_nunit no Fortran FUnit cyberdojofoundation/fortran_funit no Go testing cyberdojofoundation/go_testing no Groovy JUnit cyberdojofoundation/groovy_junit no ... Haskell hunit cyberdojofoundation/haskell_hunit no Java Cucumber cyberdojofoundation/java_cucumber no ... Javascript Mocha+chai+sinon cyberdojofoundation/javascript-node_mocha_chai_sinon no ... PHP PHPUnit cyberdojofoundation/php_phpunit no Perl Test::Simple cyberdojofoundation/perl_test_simple no Python py.test cyberdojofoundation/python_pytest no Python unittest cyberdojofoundation/python_unittest yes R RUnit cyberdojofoundation/r_runit no Ruby Cucumber cyberdojofoundation/ruby_cucumber no ... Rust test cyberdojofoundation/rust_test no Scala scalatest cyberdojofoundation/scala_scalatest no Swift XCTest cyberdojofoundation/swift_xctest yes VHDL assert cyberdojofoundation/vhdl_assert no VisualBasic NUnit cyberdojofoundation/visual-basic_nunit no

$ ./cyber-dojo start-point create Use: cyber-dojo start-point create NAME --git=URL Use: cyber-dojo start-point create NAME --dir=PATH Creates a start-point named NAME from a git clone of URL Creates a start-point named NAME from a copy of PATH

cyber-dojo new release

The new release of cyber-dojo just went live :-)

creating your own server start-points

cyber-dojo's new architecture has customisable start-points.
If you want to use your own start-points you do not need to build a new web server image.

preparing your custom/languages start-point

  • Create a folder for the start-point
    $ md douglas
  • In the top-level folder create a setup.json
    $ touch douglas/setup.json
    This file must specify the type of start-point.
    • custom
      { 'type' : 'custom' }
    • languages
      { 'type' : 'languages' }
  • Create a sub-folder for each start-point entry
    $ md douglas/first
  • Create a manifest.json file in each folder
    $ nano douglas/first/manifest.json
  • Here's an example. Here's an explanation of the manifest.json format.
  • In each folder create the visible files named in manifest.json
    Here's an example

preparing your exercises start-point

  • Create a folder for the start-point
    $ md arthur
  • In the top-level folder create a setup.json
    $ touch arthur/setup.json
    This file must specify the type of start-point.
    { 'type' : 'exercises' }
  • Create a sub-folder for each exercise
    $ md arthur/first
  • Create an instructions file in each folder
    $ nano arthur/first/instructions
    Here's an example

creating your start-point

$ [sudo] ./cyber-dojo start-point create adams --dir=douglas
which attempts to create a start-point called adams from all the files in the douglas directory. If the creation fails the cyber-dojo script will print diagnostics.

starting your server with your start-point

$ sudo ./cyber-dojo up --custom=adams
$ sudo ./cyber-dojo up --languages=adams
$ sudo ./cyber-dojo up --exercises=arthur

adding a new language and unit-test-framework to cyber-dojo

0. make sure docker is installed.

  • For Linux see the first step here.
  • For Mac see the first step here.
  • For Windows see the first step here.

1. create a docker-image for just the language

Make this docker-image unit-test-framework agnostic.
If you are adding a new unit-test-framework to an existing language skip this step.
For example, suppose you were building Lisp
  • create a new folder for your language
    $ md lisp
  • in your language's folder, create a file called Dockerfile
    $ cd Lisp $ touch Dockerfile
    If you can, base your new image on Alpine-linux as this will help keep images small. To do this make the first line of Dockerfile as follows
    FROM cyberdojofoundation/language-base
    Here's one based on Alpine-linux (95 MB: C, assert) C (gcc)/assert/Dockerfile
    Here's one not based on Alpine (Ubuntu 845 MB: C#, NUnit) C#/NUnit/Dockerfile
  • use the Dockerfile to try and build your docker-image.
    For example
    $ docker build -t cyberdojofoundation/lisp .
    which, if it completes, creates a new docker-image called cyberdojofoundation/lisp using the Dockerfile (and build context) in . (the current folder).

2. create a docker-image for the language and unit-test-framework

Repeat the same process, building FROM the docker-image you created in the previous step.
For example, suppose your Lisp unit-test framework is called lunit
  • create a new folder underneath your language folder
    $ cd lisp $ md lunit
  • in your new test folder, create a file called Dockerfile
    $ cd lisp/lunit $ touch Dockerfile
    The first line of this file must name the docker image you built for your language in the previous step.
    Add lines for all the commands needed to install your unit-test framework prefixed with RUN.
    FROM cyberdojofoundation/lisp RUN apt-get install -y lispy-lunit RUN apt-get install -y ...
    If you do not need any commands you should still create a Dockerfile with the single FROM line.
  • use the Dockerfile to try and build your image.
    The name of an image takes the form hub-name/image-name. Do not include a version number in the image-name. For example
    $ docker build -t cyberdojofoundation/lisp_lunit .
    which, if it completes, creates a new docker image called cyberdojofoundation/lisp_lunit using the Dockerfile in . (the current folder).

3. add a red_amber_green.rb file

  • Create a file called red_amber_green.rb containing a Ruby lambda accepting three arguments. cyber-dojo uses this to determine the test's traffic-light colour by passing it the stdout, stderr, and status outcomes of the test run. For example, here is the C#-NUnit red_amber_green.rb:
    lambda { |stdout,stderr,status| output = stdout + stderr return :red if /^Errors and Failures:/.match(output) return :green if /^Tests run: (\d+), Errors: 0, Failures: 0/.match(output) return :amber }
  • The Dockerfile for your language+testFramework must COPY red_amber_green.rb into the /usr/local/bin folder of your image. For example:
    FROM cyberdojofoundation/lisp RUN apt-get install -y lispy-lunit RUN apt-get install -y ... COPY red_amber_green.rb /usr/local/bin
  • I usually start with a red_amber_green.rb that simply returns :red. Then I use cyber-dojo to gather outputs which I use to build up a complete red_amber_green.rb

4. use the image in a new start-point

Use the new image name (eg cyberdojofoundation/lisp_lunit) in a new manifest.json file in a new start-point.

cyber-dojo start-points manifest.json entries explained

Example: the manifest.json file for Java/JUnit looks like this:

{ "display_name": "Java, JUnit", "visible_filenames": [ "", "", "" ], "image_name": "cyberdojofoundation/java_junit", "filename_extension": ".java", "tab_size": 4, "progress_regexs" : [ "Tests run\\: (\\d)+,(\\s)+Failures\\: (\\d)+", "OK \\((\\d)+ test(s)?\\)" ] }

Required entries

"display_name": string

The (major, minor) names as they appear in the start-point setup pages where you select your language,test. Also appears in the practice-details dialog (button at the bottom of some pages). A single string with the major name first, then a comma, then the minor name. Should not contain any digits.

"visible_filenames": [ string, string, ... ]

Filenames that will be visible in the browser's editor when an animal initially enter's a cyber-dojo. Each of these files must exist in the manifest.json's directory. Filenames can be in nested sub-directories, eg "tests/". Must include This is because is the name of the shell file assumed by the ruby code (in the Rails server) to be the start point for running the tests. You can write any actions in the file but clearly any programs it tries to run must be installed in the docker image_name. For example, if runs gcc to compile C files then gcc has to be installed. If runs javac to compile java files then javac has to be installed.

"image_name": string

The name of the docker image used to run a container in which is run. Do not include any version numbers (eg of the compiler or test-framework). The docker image must contain a file called red_amber_green.rb in the /usr/local/bin directory which the cyber-dojo runner uses to determine the traffic-light colour of each test run outcome. For example

lambda { |stdout,stderr,status| output = stdout + stderr return :red if /^Tests run: (\d+),(\s)+Failures: (\d+)/.match(output) return :green if /^OK \((\d+) test/.match(output) return :amber }

Optional entries

"filename_extension": string

The filename extension used when creating a new filename. For example, if set to ".java" the new filename will be
Defaults to the empty string (and the new filename will be filename).

"tab_size": int

The number of spaces a tab character expands to in the browser's textarea editor.
Defaults to 4.

"progress_regexs": [ string, string ]

Two regexs, the first one to match a red traffic light's test output, and the second one to match a green traffic light's test output. Used on the dashboard to show the test output line (which often contains the number of passing and failing tests) of each animal's most recent red/green traffic light. Useful when your practice session starts from a large number of pre-written tests and you wish to monitor the progress of each animal.
Defaults to an empty array.

"highlight_filenames": [ string, string, ... ]

Filenames whose appearance is highlighted in the browser. This can be useful if you have many "visible_filenames" and want to mark which files form the focus of the practice.
A strict subset of "visible_filenames".
For example
"highlight_filenames": [ "buffer.cpp", "buffer.hpp" ]
The appearance of "highlight_filenames" is controlled by the CSS in kata.css.scss
div[class~='filename'][class~='highlight'] { ... }
The highlight_filenames entry also interacts with lowlights_filenames, see StartPoint.lowlight_filenames() in start_point.rb and cd.notLowlightFilenames() in cyber-dojo_file_load.js
Again, its appearance in controlled from the same CSS file...
div[class~='filename'][class~='lowlight'] { ... }
If there is a "highlight_filenames" entry, then lowlight-filenames will be
[visible_filenames] - [highlight_filenames]
If there is no "highlight_filenames" entry, then lowlight-filenames will default to something like
[ 'cyber-dojo', 'makefile', 'Makefile' ]
Defaults to an empty array.

running your own cyber-dojo web server