Configuration

Code FREAK’s configuration is based on Spring Boot. This means you can also tweak all of the Spring configuration. For more details on how to apply configuration to Code FREAK and Spring check out the official Spring documentation.

All shown configuration in this documentation is meant to be placed in an application.yml file. If you use the official Docker image please mount the application.yml file inside the container at /app/resources/config/application.yml.

Authentication

Code FREAK provides multiple ways to authenticate users. You can choose one of the following methods to integrate the application with your existing infrastructure.

Simple Authentication

Simple authentication means that users are managed by Code FREAK internally.

User management has not been implemented yet! It only works in dev mode with some preconfigured users. See Issue #122 for progress. The current preconfigured users are admin, teacher and student. All users share the same password 123.
codefreak.authentication-method: simple # this is the default

LDAP

Code FREAK can connect to an LDAP server and use it for authentication. A minimal configuration requires the URL of the server and a mapping from LDAP groups to Code FREAK roles.

As an example, you can find an LDAP test server here. It can be used with the following configuration.

codefreak:
  authentication-method: ldap
  ldap:
    url: ldap://127.0.0.1:389
    root-dn: dc=planetexpress,dc=com
    group-search-base: ou=people
    role-mappings:
      admin_staff: admin
      ship_crew: student
    #active-directory: true (set this if you are using an Active Directory server)

role-mappings is a dictionary where each key is group from your LDAP server, and the value represents a role of Code FREAK. Valid roles are admin, teacher and student. See Roles for more information on the role system.

Git import

You can allow your students to import their source code from a remote Git repository. Currently, this is possible only via a shared SSH key that has access to all repositories on the Git server. Some Git servers allow this by using so-called "deployment keys". You can configure multiple hosts but only one SSH key per host. Students have to use the clone URL starting with ssh:// when importing from the remote repository. Import via HTTP is not possible currently.

codefreak:
    git-import:
      enabled: true
      remotes:
      - host: git.example.org
        ssh-key: /path/to/ssh/id_rsa
        ssh-key-pass: securepassword123
        ssh-base-url: ssh://git@git.example.org

Database

By default, Code FREAK uses an in-memory database. This means you will lose data between application restarts!

For production usage we recommend using PostgreSQL. Other DB engines are untested. Use the following to use Postgres for persistent data storage.

spring:
  datasource:
    driver-class-name: org.postgresql.Driver
    url: jdbc:postgresql://{host}:5432/{database}
    username: {username}
    password: {yourpassword}
  jpa:
    database-platform: org.hibernate.dialect.PostgreSQLDialect
    properties:
      hibernate:
        globally_quoted_identifiers: true

IDE Reverse Proxy

Code FREAK starts instances of IDEs (VSCode, etc.) in their own Docker container. The default configuration exposes the HTTP endpoint of each IDE via port publishing. Docker will choose a random free port from your machine and you can access it via http://localhost:{random-port}. This is useful for local development and testing but not for production usage.

Currently, we support Traefik (v1) as alternative reverse proxy. This will create path-based routes to IDE instances.

Traefik

To configure Traefik as your reverse proxy you have to start at least one instance of Traefik with a Docker backend. Current support is limited to Traefik 1.x. Traefik v2 is NOT supported, yet.

You should run Traefik on the dedicated Docker host using the following command:

docker run -p80:80 -d \
  -v /var/run/docker.sock:/var/run/docker.sock \
  traefik:1.7-alpine --docker --debug

Afterwards you can configure Code FREAK to use Traefik reverse proxy:

codefreak:
  reverse-proxy:
    type: traefik
    url: http://my-docker-host.domain.example

Running Code FREAK behind a reverse proxy

If you are using a reverse proxy (Traefik, Nginx, …) to pass traffic to Code FREAK you will need the following additional configuration so the application will understand all URLs correctly:

server:
  forward-headers-strategy: framework

Evaluation

Code FREAK has a queue-based system to limit the number of evaluation steps running in parallel. By default, the number of steps running in parallel is the number of CPU cores of the underlying host. You can adjust this value in the application.yml:

application.yml
codefreak:
  evaluation:
    max-concurrent-executions: 12

File Storage

All files for e.g. tasks or submissions can be stored either in the database or (by default) on directly on the native file system. The file storage can be configured as follows:

When choosing the file system, please make sure that the application has read+write access to the configured storage path!
application.yml
codefreak:
  files:
    adapter: file_system # or jpa
    # needed when using the file system:
    fileSystem:
      collectionStoragePath: "/var/lib/codefreak"