Skip to content
Learn to code for secondary and higher education
Ruby JavaScript HTML CSS TypeScript
Branch: develop
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.github
app
bin
config
db
lib
log
public
test
tmp
vendor/assets
.browserslistrc
.eslintignore
.eslintrc
.gitignore
.rubocop.yml
.ruby-version
Capfile
Gemfile
Gemfile.lock
LICENSE
Procfile.dev
README.md
Rakefile
babel.config.js
browserlist
config.ru
jest.config.js
package.json
postcss.config.js
tsconfig.json
yarn.lock

README.md

Dodona

The Dodona project aims to provide a solution for the automatic testing of solutions for programming exercises.

On https://dodona.ugent.be, students can sign in with the credentials of the Smartschool, Office 365, or G Suite account of their school. After signing in, you can subscribe to one of the many courses. Dodona courses consist of several exercise series. Each exercise has a detailed exercise description and an extensive test suite. After submitting a solution to an exercise, a sandboxed background job is started to test the solution, and the result and feedback is displayed within seconds.

The documentation of this project can be found at https://dodona-edu.github.io.

Development Setup

  1. Install and start mysql or mariadb.
  2. If using mysql, add sql-mode='STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION' to the /etc/mysql/mysql.conf.d/mysqld.cnf file.
  3. Create dodona user (with password 'dodona') with create database permissions.
  4. Create and seed the database with rails db:setup. (If something goes wrong with the database, you can use rails db:reset to drop, rebuild and reseed the database.)
  5. Start the server. The simplest way is with rails s.
  6. Because CAS authentication does not work in development, you can log in by going to these pages (only works with the seed database form step 4)
    • http://localhost:3000/nl/users/1/token/zeus
    • http://localhost:3000/nl/users/2/token/staff
    • http://localhost:3000/nl/users/3/token/student

Evaluating exercises locally

These steps are not required to run the server, but you need docker to actually evaluate exercises.

  1. Install and start docker.
  2. Clone the docker-images repository.
  3. Build a docker image. The build.sh scripts builds all images. But with the initial data, only dodona-anaconda3 is needed. You can build this image with docker build --pull --force-rm -t "dodona-anaconda3" -f "dodona-anaconda3.dockerfile" ..

Starting the server

The simplest way to start the server is with the rails s command. But this will not process the submission queue, and javascript will be compiled by webpack in the background (without output when something goes wrong).

  • To process the submission queue, delayed job needs to be started with the bin/delayed_job start command.
  • With bin/webpack-dev-server your javascript is reloaded live and you can see development output.

To run all these processes at the same time, the foreman gem is used. To start the rails server, delayed job and the webpack dev server, simply run bin/server.

This has one letdown: debugging with byebug is broken. You can run bin/server norails to only start webpack and delayed_job in foreman and then run rails s in a different terminal to be able to use byebug again.

Tutor Docker network

Your docker network (for the python tutor) should be in 192.168.0.0/16. If this is not the case, you should edit Rails.config.tutor_docker_network_prefix in config/application.rb. Be aware that you should run this application behind a proxy, otherwise users could spoof their IP address via the X-Forwarder-For header. (If they spoof their ip addres to one within the docker network, they will be able to access media files of private exercises that they would otherwise not have access to.)

Running on Windows

Some gems (such as therubyracer) are not supported on Windows. However it is possible to run Dodona using WSL. Note: using WSL2, these steps are probably not necessary.

  • Dodona itself must be run in WSL. The Ubuntu WSL distribution is known to work.
  • The database can be run in either Windows or WSL. If you run the database in Windows, you must change host from localhost to 127.0.0.1 (in config/database.yml). Otherwise Ruby will attempt to connect using sockets, which won't work.

Docker

Docker runs in Windows, and requires some tweaks to communicate with WSL.

  • Enable the TCP daemon in the Docker settings.
  • Set the environment variable DOCKER_URL to the url of the Docker daemon. Otherwise Ruby will again attempt to connect using sockets.
  • Dodona uses bind mounts to share a folder with the container. As Dodona runs in WSL and Docker in Windows, this does not work out of the box.
    • By default, WSL uses paths of the form /mnt/c/users/blabla. However, Docker uses /c/users/blabla. You need to change the mount location in WSL. (See also in this blog post and the reference documentation.)

    • Open or create the config file by running sudo nano /etc/wsl.conf in WSL and insert this:

      [automount]
      root = /
      options = "metadata,umask=22,fmask=11"
      

      This will also give Windows folders proper permissions in WSL.

    • There is another problem: Dodona creates a temporary folder in /tmp (inside WSL), which is not accessible to Docker. A solution is setting the TMPDIR environment variable (in WSL when running Dodona). Set TMPDIR to a folder on your Windows drive, like /c/ubuntu-tmp. As Dodona will then pass /c/ubuntu-tmp to Docker, it will be able to access the folder.

  • This is not specific to Dodona, but when you build Docker images in Windows, you need special care to ensure files have the proper permissions (executable) and have the correct line endings.
You can’t perform that action at this time.