README.md 2.53 KB
Newer Older
Vayhinger's avatar
Vayhinger committed
1
# Moodle Dockerized Code Testing (MoDoCoT) - Backend
Dominik Vayhinger's avatar
Dominik Vayhinger committed
2
3

## Usage
Vayhinger's avatar
Vayhinger committed
4
5
6
7
An available Jenkins needs to run on the server where the backend container runs.
The Jenkins has to listen on port 8080.
If need to use another port for Jenkins have a look at Server application configuration / Local application configuration

Dominik Vayhinger's avatar
Dominik Vayhinger committed
8
9
10
11
12
13
14
### Conventions
- The JUnit test classes cannot be organized in packages. Tasks and helper classes can use packages.

## Development Hints
### Build
This is a maven project. It can be build with `mvn package`.

Vayhinger's avatar
Vayhinger committed
15
There is also a ready-to-go docker image available. It can be found [on Docker Hub](https://hub.docker.com/r/hftstuttgart/modocot-backend/)
Dominik Vayhinger's avatar
Dominik Vayhinger committed
16

Vayhinger's avatar
Vayhinger committed
17
18
19
### Server application configuration
We're using the **application-server.properties** file to configure the application.
The file can be found under _/src/main/resources/_
Dominik Vayhinger's avatar
Dominik Vayhinger committed
20

Vayhinger's avatar
Vayhinger committed
21
22
23
You need to configure following entries:  
docker.hostIp= "Your docker host ip"
jenkins.api.token= "Your jenkins api token" [See Jenkins Doc](https://www.jenkins.io/doc/book/using/remote-access-api/)
Vayhinger's avatar
Vayhinger committed
24
(jenkins.url=http://${docker.hostIp}:"Your Jenkins Port"/) Use this property if your Jenkins listens on a port other than 8080
Dominik Vayhinger's avatar
Dominik Vayhinger committed
25

Vayhinger's avatar
Vayhinger committed
26
27
28
### Local application configuration
We're using the **application.properties** file to configure the application.
The file can be found under _/src/main/resources/_
Dominik Vayhinger's avatar
Dominik Vayhinger committed
29

Vayhinger's avatar
Vayhinger committed
30
31
32
You need to configure following entries:  
docker.hostIp= "Your docker host ip"
jenkins.api.token= "Your jenkins api token" [See Jenkins Doc](https://www.jenkins.io/doc/book/using/remote-access-api/)
Vayhinger's avatar
Vayhinger committed
33
(jenkins.url=http://${docker.hostIp}:"Your Jenkins Port"/) Use this property if your Jenkins listens on a port other than 8080
Dominik Vayhinger's avatar
Dominik Vayhinger committed
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48

## Interfaces
##### POST /v1/unittest
Used for uploading / creating of assignments. The body needs to contain two fields as form data:<br/>
*assignmentId*: The ID of the created assignment. This is created by moodle.<br/>
*unitTestFile*: The zip file containing the unit tests for this assignment.

##### DELETE /v1/unittest?assignmentId=<111>
Delete the created assignment. The assignment ID of the unit tests which need to be deleted is passed as a query parameter

##### POST /v1/task
The upload of the Java files to be tested. The body needs to contain two form fields:<br/>
*taskFile*: The zip file containing the java files<br/>
*assignmentId*: The id of the assignment. Provided by moodle

Vayhinger's avatar
Vayhinger committed
49
## Further development
Vayhinger's avatar
Vayhinger committed
50
51
52
For pushing the backend to Dockerhub you need to provide the Dockerhub-Credentials inside your Jenkins with the naming "Dockerhub"
You also need to create a Jenkins-pipline which is builds and deploys this repository.