Skip to content

Commit ee01145

Browse files
committed
.
1 parent de43984 commit ee01145

File tree

17 files changed

+3798
-81
lines changed

17 files changed

+3798
-81
lines changed

docs/config.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,5 @@ theme = "infomark.org"
66
pygmentsCodeFences = true
77
pygmentsStyle = "friendly"
88
pygmentsCodefencesGuessSyntax = true
9-
pygmentsuseclasses = true
9+
pygmentsuseclasses = true
10+

docs/content/guides/administrator.md

Lines changed: 27 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ layout: subpage
77

88
# General Information
99

10+
This page gives a brief overview of the underlying system and capabilities. It is meant to be read by people who would like to install the system. If you are provided such an instance please refer to the [Instructor's Guide](/guides/instructor)
11+
1012
The Infomark System can serve multiple courses within a single server instance. The linked background workers will then be shared amongst these courses.
1113

1214
## Configuration
@@ -18,7 +20,7 @@ The configuration is done within a YAML config file and has the following struct
1820
# ------------------------------------------------------------------------------
1921

2022
rabbitmq_connection: amqp://user:password@localhost:5672/
21-
rabbitmq_exchange: test-exchange
23+
rabbitmq_key: test-key
2224
...
2325

2426
# backend
@@ -34,8 +36,9 @@ worker_workdir: /tmp
3436
...
3537
```
3638

37-
Only the keys `rabbitmq_*` need to be shared between the server. In general, the defaults might do the job. For all secrets like passwords, tokens or keys we suggest to use `openssl rand -base64 32` to generate random high-quality secrets.
39+
For an example configuration please refer to the `.infomark.example.yml` your downloaded release archive or inspect the file [on GitHub](https://github.com/cgtuebingen/infomark-backend/blob/master/.infomark.example.yml).
3840

41+
Only the keys `rabbitmq_*` need to be shared between the server. In general, the defaults might do the job. For all secrets like passwords, tokens or keys you should use `openssl rand -base64 32` to generate random high-quality secrets.
3942

4043
We discuss some important settings:
4144

@@ -52,38 +55,40 @@ The sessions are handled on the server-side using cookies. Any session will stay
5255

5356
### Email
5457

55-
For technical reasons, our infrastructure only supports sendmail to deliver emails. If you remove the `sendmail_binary` key from the config, outgoing emails will be instead displayed in the terminal. Additionally, each outgoing email will have a footnote
58+
For technical reasons, our infrastructure only supports the binary `sendmail` to deliver emails. If you remove the `sendmail_binary` key from the config, all emails from the system will be displayed in the terminal. Additionally, each outgoing email will have a footnote
5659

5760
```
5861
Sent by: FirstName LastName
5962
sent via Infomark
6063
```
6164

62-
when these are composed by any identity.
65+
when these are composed by any user.
6366

64-
We hard-coded the domain `uni-tuebingen.de` in the front-end such that any registration attempt outside this domain will get a warning. You might want to see the developer guide to change this value.
67+
We hard-coded the domain `uni-tuebingen.de` in the front-end such that any registration attempt with an email not mathcing this domain will get a warning. You might want to see the [Developer's Guide](/guides/developer) on how to change this value.
6568

6669
### Directories
6770

6871
We use several directories to store uploads, generated files or common files like a privacy statement. The default values will work if the paths exist. We made these paths configurable as these files require different backup strategies. We suggest estimating beforehand the required space. From our experience 1000 submissions are equal to 20MB. You can limit the size of each submission file in the server settings using the key `max_request_submission_bytes`.
6972

7073
### Server-Settings
7174

72-
To balance the tradeoff between too many request and responsiveness, we added several strategies to avoid blocking actions. While each request is handled in a light-weight Go-routine we cannot stop these routines Go only has a fork-join thread-model. Instead we limit the number of bytes which are read from the client. The default of 1MB is enough for common JSON requests. The following keys can limit the request sizes:
75+
To balance the tradeoff between too many request and responsiveness, we added several strategies to avoid blocking actions. We limit the number of bytes which are read from the client during a request. The default of 1MB is enough for common JSON requests. You can configure these limits for each kind of request using the following keys:
76+
77+
- `max_request_json_bytes` to limit any JSON request
78+
- `max_request_avatar_bytes` to limit the image size for the avatar in the profil
79+
- `max_request_submission_bytes` to limit the size for homework solutions
7380

74-
- `max_request_json_bytes`
75-
- `max_request_avatar_bytes`
76-
- `max_request_submission_bytes`
81+
There is no limit when uploading slides or extra course material.
7782

7883
### Background-Worker
7984

80-
Background-Workers will ignore any queued submissions when `worker_void` is set to `true`. These workers can be turned off by `use_backend_worker: false`.
85+
Background-Workers can be turned off when using the config `use_backend_worker: false`.
8186

8287
## Roles and Permissions
8388

84-
InfoMark has a relatively simple permission system. The permissions are linked to a request identity (the user). Each user can be either a normal user or `global admin`, which gives the user all permissions across all hosted courses.
89+
InfoMark has a relatively simple permission system. The permissions are linked to a request identity (the user). Each user can be either a normal user or `global admin`. Any global admin will bypass all permission checks and gives the user all permissions across all hosted courses.
8590

86-
To upgrade/downgrade a user to `global admin` just use the console like
91+
To upgrade/downgrade a user to `global admin` use the console like
8792

8893
```bash
8994
# upgrade account
@@ -94,13 +99,13 @@ To upgrade/downgrade a user to `global admin` just use the console like
9499

95100
Only, a global admin can create new courses.
96101

102+
To get granularity in the permission system each user enrolled into a course will be assigned to one the following roles:
97103

98-
Further, every time a user enrolls into a course, there are three roles:
99-
- admin: Admin for a course -- not a global admin
100-
- tutor: Teaching assistants who will grade homework and lead exercise groups
101-
- students: This is the default role.
104+
- *admin*: Admin for a course -- not a global admin
105+
- *tutor*: Teaching assistants who will grade homework and lead exercise groups
106+
- *students*: This is the default role.
102107

103-
These permissions control which resources a user has access to, e.g. students cannot see other students personal information. Slides and material can be targeted to a specific group, e.g., distribute sample solution to TAs. These roles are subsets, i.e., an admin has all permissions a tutor and a student has. Tutors have additional permissions compared to students.
108+
These permissions control which resources a user has access to, e.g. students cannot see other students personal information. Slides and material can be targeted to a specific role, e.g., distribute sample solution to TAs. These roles are subsets, i.e., an admin has all permissions, which a tutor and a student has. Tutors have additional permissions compared to students.
104109

105110
To upgrade a user to a course-tutor or course-admin use the console
106111

@@ -117,10 +122,12 @@ Note, this enrolls the user to a course if the user is not enrolled. Otherwise,
117122

118123
## Auto-Tests
119124

125+
Please refer to the [Tutor's Guide](/guides/tutor) for more details about writing and using auto-tests.
126+
120127
Each task of a programming assignment can be linked to a docker-image and a zip file containing the test code.
121-
Technically, the server process handling acting as a Restful JSON web server will communicate with separate processes, which are called `workers`. These workers can be started at different machines.
128+
Technically, the server process acting as a Restful JSON web server will communicate using AMQP with separate processes, which are called `workers`. These workers can be started at different machines.
122129

123-
>Please note, in the current version these workers have global admin privileges. This will change in the future. Hence, only start these workers on machines you trust!
130+
>Please note, in the current version these workers have global admin privileges. This will change in the future. Hence, only start these workers on machines you trust (which is anyway a good idea).
124131
125132
### Conventions
126133

@@ -160,34 +167,7 @@ If the docker child returns an exit code != 0 a default message will be sent ins
160167

161168
The workers, will download the student submission over HTTP and run these tests locally. Make sure, the used docker file exists or is already pulled from e.g. docker-hub.
162169

163-
### Example
164-
165-
A basic dockerfile for testing a submission might be
166-
167-
```docker
168-
# Dockerfile
169-
FROM ubuntu:18.04
170-
ADD scripts/run.sh /app/run.sh
171-
ENTRYPOINT ["/app/run.sh"]
172-
```
173-
174-
and script
175-
176-
```bash
177-
# run.sh
178-
DATA_DIR="/data"
179-
SUBMISSION_FILE="$DATA_DIR/submission.zip"
180-
TEST_FILE="$DATA_DIR/unittest.zip"
181-
182-
echo "this line will be ignored"
183-
echo "--- BEGIN --- INFOMARK -- WORKER"
184-
echo ${SUBMISSION_FILE}
185-
echo ${TEST_FILE}
186-
echo "--- END --- INFOMARK -- WORKER"
187-
echo "this line will be ignored"
188-
```
189-
190-
The testing-framework, e.g., JUnit has to ensure to suppress any potential output from the uploaded user code.
170+
We provide [examples](/guides/tutor) for testing Java, Python and C++ programming assignment solutions.
191171

192172
## Exercise Groups
193173

docs/content/guides/console.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,6 @@ layout: subpagewithout
99

1010
The backend includes a console for common tasks like doing/restoring a backup, manually confirm user accounts or set permissions.
1111

12-
See the [docs](/guides/console/commands/infomark/) for more details about each command.
12+
> Currently, the console can only be accessed directly on the server. We plan to add a CLI for remote handling of most operations.
1313
14+
<a class="btn btn-secondary" href="/guides/console/commands/infomark/"><i class="fas fa-cloud-download-alt"></i> Documentation InfoMark Console</a>

docs/content/guides/overview.md

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -11,31 +11,27 @@ course management system supporting auto-testing of programming assignments scal
1111

1212
Uploaded solutions to programming assignments are tested automatically. TAs can grade these solutions online. The platform supports multiple courses each with multiple exercise groups, slides and course material.
1313

14+
For more information about writing such tests see our [Tutor's Guide](/guides/tutor/). On how to use the system please refer to the [Administrator's Guide](/guides/administrator/)
15+
1416
# Quick-Start
1517

1618
To locally test the system we suggest to run the following commands:
1719

1820
```bash
19-
cd /tmp
20-
# get latest version
21-
export VERSION=`curl -s https://api.github.com/repos/cgtuebingen/infomark/releases/latest | grep -oP '"tag_name": "\K(.*)(?=")'`
22-
wget https://github.com/cgtuebingen/infomark/releases/download/${VERSION}/infomark.tar.gz
23-
tar -xzvf infomark.tar.gz
21+
cd /tmp && export VERSION=`curl -s https://api.github.com/repos/cgtuebingen/infomark/releases/latest | grep -oP '"tag_name": "\K(.*)(?=")'`
22+
wget -qO- https://github.com/cgtuebingen/infomark/releases/download/${VERSION}/infomark.tar.gz | tar -xzv
2423

2524
cd infomark
26-
# use default settings
2725
cp .infomark.example.yml .infomark.yml
2826
cp docker-compose.example.yml docker-compose.yml
2927

3028
# configure paths for backend
3129
sed -i 's/\/var\/www\/infomark-staging\/app/\/tmp\/infomark/g' /tmp/infomark/.infomark.yml
3230

33-
34-
# run these commands in separate terminals
35-
# start dependencies
31+
# start dependencies (redis, postgresql)
3632
sudo docker-compose up -d
3733

38-
# create database
34+
# create initial database
3935
cd database
4036
PGPASSWORD=pass psql -h 127.0.0.1 -U user -p 5433 -d db -f schema.sql
4137
PGPASSWORD=pass psql -h 127.0.0.1 -U user -p 5433 -d db -f migrations/0.0.1alpha14.sql
@@ -44,7 +40,7 @@ cd ..
4440

4541
# start a single background worker
4642
# sudo is required for talking to docker
47-
sudo ./infomark work
43+
sudo ./infomark work -n 1
4844
# start Restful JSON web server
4945
./infomark serve
5046
```
@@ -73,8 +69,8 @@ on your own servers to be compliant with any data privacy issues providing data
7369

7470
It is based on several design choices:
7571

76-
- Every part must be open-source and robust.
77-
- The backend must be easy to deploy, maintain and scalable.
72+
- Every part must be open-source, scalable and robust.
73+
- The backend must be easy to deploy and to maintain.
7874
- The frontend must be light-weight, fast and responsive.
7975
- Auto-Testing of programming assignments must be language-agnostic, isolated and safe.
8076
- All intense operations must be asynchronously scheduled.

docs/content/guides/tutor.md

Lines changed: 63 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
---
22
title: "Tutor's Guide"
33
date: 2019-04-21
4-
lastmod: 2019-04-24
4+
lastmod: 2019-05-13
55
layout: subpage
66
---
77

8-
# Unit - Tests
8+
# Auto - Tests
99

10-
Unit-tests consists of
10+
Auto-tests (unit-tests) consists of
1111

1212
* a submission `<STUDENT_UPLOAD.ZIP>` made by a student
1313
* a testing framework `<TASK_SEPCIFIC_TEST.ZIP>` written by one of the tutors/instructors
@@ -23,13 +23,46 @@ docker run --rm -it --net="none" \
2323
```
2424

2525
and capture the output which is store in the database and displayed the student resp. the tutor who grades the solution.
26+
The most minimal and simple Dockerfile which handles uploaded solutions is
27+
28+
```docker
29+
# Dockerfile
30+
FROM ubuntu:18.04
31+
ADD scripts/run.sh /app/run.sh
32+
ENTRYPOINT ["/app/run.sh"]
33+
```
34+
35+
which uses the script
36+
37+
```bash
38+
# run.sh
39+
DATA_DIR="/data"
40+
SUBMISSION_FILE="$DATA_DIR/submission.zip"
41+
TEST_FILE="$DATA_DIR/unittest.zip"
42+
43+
echo "this line will be ignored"
44+
echo "--- BEGIN --- INFOMARK -- WORKER"
45+
echo ${SUBMISSION_FILE}
46+
echo ${TEST_FILE}
47+
echo "--- END --- INFOMARK -- WORKER"
48+
echo "this line will be ignored"
49+
```
50+
51+
as an entry point. Please either use [one of our pre-defined test-examples](https://github.com/cgtuebingen/infomark/tree/master/unittests) or create your own.
52+
By design we assume, that
53+
54+
* The testing-framework, e.g., JUnit, ensures that all stdout from the uploaded user code is suppressed.
55+
* A timeout is handled in the tests (InfoMark does not kill any running test)
56+
57+
> We currently investigate if we want to add such a timeout-feature.
2658
2759
## Overview
2860

2961
There are some ways to ease the task of writing unit-tests.
3062
A clear directory structure and a Makefile to automatically pack all necessary archives or/and run the unit-test locally can dramatically speed up the entire process and avoid debugging steps on the server.
63+
3164
The *makefile* should be able to clean temporary files, zip files and simulate the test result locally using the correct docker-image.
32-
Further, specifying the docker-image in the *makefile* helps to set up the task in InfoMark as you will need to specify it there while creating a new exercise task.
65+
Further, specifying the docker-image in the *makefile* helps to set up the task in InfoMark as you will need to specify it there while creating a new exercise task. An [example-Makefile](https://github.com/cgtuebingen/infomark/blob/master/unittests/python/makefile) is given in our repository.
3366

3467
InfoMark is language-agnostic. The system only records the docker-output. All post-processing of runs (processing JUNIT outputs) must be done *within* the docker container.
3568

@@ -38,37 +71,37 @@ We provide several testing-templates and examples
3871
| language | dockerimage (hub.docker.com) | test example | dockerfile |
3972
|----------|:-------------|:-------:|:------:|
4073
| Java 11 | [patwie/test_java_submission:latest](https://hub.docker.com/r/patwie/test_java_submission) | [yes](https://github.com/cgtuebingen/infomark/tree/master/unittests/java) | [yes](https://github.com/cgtuebingen/infomark/tree/master/dockerimages/unittests/java) |
41-
| Python3 | [patwie/test_python3_submission:latest](https://hub.docker.com/r/patwie/test_python3_submission) | [yes](https://github.com/cgtuebingen/infomark/tree/master/unittests/python) | [yes](https://github.com/cgtuebingen/infomark/tree/master/dockerimages/unittests/python) |
74+
| Python3 | [patwie/test_python3_submission:latest](https://hub.docker.com/r/patwie/test_python3_submission) | [yes](https://github.com/cgtuebingen/infomark/tree/master/unittests/python) | [yes](https://github.com/cgtuebingen/infomark/tree/master/dockerimages/unittests/python) |
4275
| C++ | [patwie/test_cpp_submission:latest](https://hub.docker.com/r/patwie/test_cpp_submission) | [yes](https://github.com/cgtuebingen/infomark/tree/master/unittests/cpp) | [yes](https://github.com/cgtuebingen/infomark/tree/master/dockerimages/unittests/cpp) |
4376

4477

4578
## Java 11
4679

4780
We suggest using our [docker-image](https://github.com/cgtuebingen/infomark/tree/master/dockerimages/unittests) to run follow the guide below.
4881

49-
We suggest keeping the following directory structure
82+
We use the following directory structure to reduce the workload of writing re-usable unit-tests.
5083

51-
```
84+
```bash
5285
exercises
5386
exercise<a>
5487
makefile
55-
tasks
88+
tasks # any LaTeX related content describing the exercise
5689
sheet.tex
57-
solution
90+
solution # sample solution
5891
main
5992
FileA.java
6093
FileB.java
61-
student_template_[<a>.<b>]
94+
student_template_[<a>.<b>] # student-template for each task
6295
main
6396
FileA.java
6497
FileB.java
65-
unittest_public_[<a>.<b>]
98+
unittest_public_[<a>.<b>] # all tests without output visible to students
6699
src
67100
__unittest
68101
FileAtest.java
69102
FileBtest.java
70103
build.xml
71-
unittest_private[<a>.<b>]
104+
unittest_private[<a>.<b>] # all tests without output visible only to tutors/TAs
72105
src
73106
__unittest
74107
FileAtest.java
@@ -366,6 +399,23 @@ int divide(int a, int b);
366399
#endif // LIB_DIVIDE_H_
367400
```
368401

402+
403+
A simple way of testing C++ implementations uses the header-only library catch
404+
405+
```cpp
406+
#include "lib/divide.h"
407+
408+
#define CATCH_CONFIG_MAIN // This tells Catch to provide a main() - only do
409+
// this in one cpp file
410+
#include "catch.hpp"
411+
412+
TEST_CASE("Divide should be correct", "[divide]") {
413+
REQUIRE(divide(6, 3) == 2);
414+
}
415+
```
416+
417+
> Reminder: InfoMark does not has any timeout when running the tests. We highly recommend to use any mechanism to avoid infinite loops. A potential solution is **timeout** from the **coreutils**.
418+
369419
As the implementation of `divide` is not correct the output will be:
370420
371421
Alpine clang version 5.0.1 (tags/RELEASE_501/final) (based on LLVM 5.0.1)
@@ -424,3 +474,4 @@ The output would also contain all linking issues (wrongly named function) like
424474
> Currently, there is no way to skip non-existing methods. If a method does not exists or has the wrong signature
425475
> the output will containg the linking error without any test-results from the run itself. This is caused by the nature
426476
> of C++.
477+

docs/static/images/autotest.png

37.6 KB
Loading

docs/static/images/grafana.png

76 KB
Loading
167 KB
Loading
27.7 KB
Loading

docs/static/images/uploads.png

24.2 KB
Loading

0 commit comments

Comments
 (0)