CodeRunner Documentation (V2.4.2)

2.2 Installing CodeRunner from scratch

Note: if you're installing CodeRunner on an SELinux system and you wish to use the deprecated RunguardSandbox you will probably need to disable SELinux. This can be done with a command like

sed -i-dist -e 's|SELINUX=enforcing|SELINUX=permissive|' /etc/selinux/config
setenforce 0

There are three different ways to install CodeRunner, as follows:

  1. Download the latest version of CodeRunner and extract the files and Unzip these into the directories moodlehome/question/type and moodlehome/question/behaviour respectively. This installation method does not support the use of the RunGuard sandbox (see below). It can be used on any Linux, Windows or Mac.

  2. Clone the entire repository into any directory you like, say somewhere and then copy the type/coderunner and behaviour/adaptive_adapted_for_coderunner subtrees into the Moodle question/type and question/behaviour directories. The commands to achieve this under Linux are

    cd somewhere
    git clone
    cd CodeRunner
    sudo ./install
  3. Clone the entire repository into the moodlehome/local directory and then make symbolic links from Moodle's question/type and question/behaviour directories into the corresponding CodeRunner subtrees. The commands to achieve this on a Linux system are

    cd moodlehome/local
    git clone
    cd CodeRunner
    sudo ./devinstall

The first of these methods is the more traditional Moodle install, while the second is equivalent in effect but makes it possible to also install the RunGuard sandbox (provided you're running a Linux-based Moodle) and gives you the full CodeRunner source tree to experiment with. The third method, which also allows use of the RunGuard sandbox (on Linux systems only), is intended for developers. Because it symbolically links to the source code, any changes made to the source in the moodlehome/local/CodeRunner subtree will take immediate effect.

Having carried out one of the above methods, if you have local question prototypes to add to the built-in prototype set you should now copy them into the moodlehome/question/type/coderunner/db folder. They should be Moodle XML file(s) with names ending in _PROTOTYPES.xml (case-sensitive). [If you don't understand what this paragraph means, then it probably doesn't concern you ... move on.]

After carrying out one of the above install methods, you can complete the installation by logging onto the server through the web interface as an administrator and following the prompts to upgrade the database as appropriate. Do not interrupt that upgrade process. If you are upgrading from an earlier version of CodeRunner you will likely receive quite a few warning messages from the cachestore, relating to files that have been moved or renamed in the transition from version 2.3. These warnings can be safely ignored (I hope).

In its initial configuration, CodeRunner is set to use a University of Canterbury Jobe server to run jobs. You are welcome to use this during initial testing, but it is not intended for production use. Authentication and authorisation on that server is via an API-key and the default API-key given with CodeRunner imposes a limit of 100 per hour over all clients using that key. If you decide that CodeRunner is useful to you, please set up your own sandbox (Jobe or otherwise) as described in Sandbox configuration below. Alternatively, if you wish to continue to use our Jobe server, you can apply to the developer for your own API key, stating how long you will need to use the key and a reasonable upper bound on the number of jobs you will need to submit her hour. We will do our best to accommodate you if we have sufficient capacity.

If you want a few CodeRunner questions to get started with, try importing the files MoodleHome/question/type/coderunner/db/simpledemoquestions.xml and/or MoodleHome/question/type/coderunner/db/python3demoquestions.xml These contains all the questions from the two tutorial quizzes on the demo site. Note, though, that some of the questions from the python3demoquestions file make use of the University of Canterbury prototypes in uoc_prototypes.xml, so you'd need to import them, too.

WARNING: at least a couple of users have broken CodeRunner by duplicating the prototype questions in the System/CR_PROTOTYPES category. Do not touch those special questions until you have read this entire manual and are familiar with the inner workings of CodeRunner. Even then, you should proceed with caution. These prototypes are not for normal use - they are akin to base classes in a prototypal inheritance system like JavaScript's. If you duplicate a prototype question the question type will become unusable, as CodeRunner doesn't know which version of the prototype to use.