Skip to content

Commit

Permalink
Merge pull request #42 from ooemperor/dev
Browse files Browse the repository at this point in the history
Adding new documentation and chaning privilege type of lxc containers
  • Loading branch information
ooemperor authored Feb 21, 2024
2 parents dfc5150 + 57b8f35 commit 35dedd6
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 3 deletions.
1 change: 1 addition & 0 deletions codeGrader/backend/config/Config.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ def __init__(self):
self.executionPort = self.config["ExecutionService"]["Port"]
self.executionFilePath = self.config["ExecutionService"]["PathToExecutionFiles"]
self.executionIpWhiteList = self.config["ExecutionService"]["IP_Address_Whitelist"]
self.execution_LXC_Install_Command = self.config["ExecutionService"]["LXC_Install_Command"]

def getInstallationCommand(self, codeLanguage: str):
"""
Expand Down
1 change: 1 addition & 0 deletions codeGrader/backend/config/config.conf
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ Host = 10.101.10.80
Port = 8003
PathToExecutionFiles = /opt
IP_Address_Whitelist = [127.0.0.1]
LXC_Install_Command = -t download -- -r bullseye -a amd64 -d debian


[EvaluationService]
Expand Down
3 changes: 2 additions & 1 deletion codeGrader/backend/execution/LXC.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@

import os
import subprocess
from codeGrader.backend.config import config


class LXC:
Expand Down Expand Up @@ -109,7 +110,7 @@ def _lxc_setup(self):
@rtype: None
"""
assert self._invariant_os()
command = f"lxc-create -n {self.name} -t debian -- -r bullseye"
command = f"lxc-create -n {self.name} {config.execution_LXC_Install_Command}"
self._run_cmd(command)

def lxc_destroy(self):
Expand Down
11 changes: 9 additions & 2 deletions doc/Installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,17 @@ Following from here you can find all the needed steps for a full installation on

Install all apt packages including postgres:
```
apt-get install -y libpq-dev lxc libvirt0 libpam-cgfs bridge-utils uidmap pip git
apt-get install -y libpython3-dev libpq-dev lxc libvirt0 libpam-cgfs bridge-utils uidmap pip git
```
Verify the installation of the lxc with the lxc-ls command. It should return no output and no error.

After that we need to append some changes in order to run unpriviliged LXC Containers for the Execution Service
```
echo "root:100000:65536" >>/etc/subuid
echo "root:100000:65536" >>/etc/subgid
echo "lxc.idmap = u 0 100000 65536" >>/etc/lxc/default.conf
echo "lxc.idmap = g 0 100000 65536" >>/etc/lxc/default.conf
```
Then continue with
```
apt update && apt upgrade -y
sh -c 'echo "deb https://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list'
Expand Down
1 change: 1 addition & 0 deletions doc/backend/Evaluation_Service_Sequence_Diagram.drawio
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<mxfile host="drawio-plugin" modified="2024-02-21T18:13:46.019Z" agent="5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/111.0.0.0 Safari/537.36" etag="bc61HGNQ45JPhMO4cl23" version="20.5.3" type="embed"><diagram name="Page-1" id="2YBvvXClWsGukQMizWep"><mxGraphModel dx="1629" dy="573" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="850" pageHeight="1100" math="0" shadow="0"><root><mxCell id="0"/><mxCell id="1" parent="0"/><mxCell id="kRblCLMAtVxusdvtMGun-1" value="Evaluation RPC" style="shape=umlLifeline;perimeter=lifelinePerimeter;whiteSpace=wrap;html=1;container=1;dropTarget=0;collapsible=0;recursiveResize=0;outlineConnect=0;portConstraint=eastwest;newEdgeStyle={&quot;edgeStyle&quot;:&quot;elbowEdgeStyle&quot;,&quot;elbow&quot;:&quot;vertical&quot;,&quot;curved&quot;:0,&quot;rounded&quot;:0};sketch=0;" parent="1" vertex="1"><mxGeometry y="80" width="100" height="410" as="geometry"/></mxCell><mxCell id="kRblCLMAtVxusdvtMGun-13" value="" style="html=1;points=[[0,0,0,0,5],[0,1,0,0,-5],[1,0,0,0,5],[1,1,0,0,-5]];perimeter=orthogonalPerimeter;outlineConnect=0;targetShapes=umlLifeline;portConstraint=eastwest;newEdgeStyle={&quot;curved&quot;:0,&quot;rounded&quot;:0};sketch=0;" parent="kRblCLMAtVxusdvtMGun-1" vertex="1"><mxGeometry x="45" y="70" width="10" height="320" as="geometry"/></mxCell><mxCell id="kRblCLMAtVxusdvtMGun-2" value="Database" style="shape=umlLifeline;perimeter=lifelinePerimeter;whiteSpace=wrap;html=1;container=1;dropTarget=0;collapsible=0;recursiveResize=0;outlineConnect=0;portConstraint=eastwest;newEdgeStyle={&quot;edgeStyle&quot;:&quot;elbowEdgeStyle&quot;,&quot;elbow&quot;:&quot;vertical&quot;,&quot;curved&quot;:0,&quot;rounded&quot;:0};sketch=0;" parent="1" vertex="1"><mxGeometry x="320" y="80" width="100" height="410" as="geometry"/></mxCell><mxCell id="kRblCLMAtVxusdvtMGun-5" value="RPyC Call with submission_id" style="html=1;verticalAlign=bottom;startArrow=circle;startFill=1;endArrow=open;startSize=6;endSize=8;curved=0;rounded=0;sketch=0;" parent="1" target="kRblCLMAtVxusdvtMGun-1" edge="1"><mxGeometry width="80" relative="1" as="geometry"><mxPoint x="-130" y="170" as="sourcePoint"/><mxPoint x="-20" y="170" as="targetPoint"/></mxGeometry></mxCell><mxCell id="kRblCLMAtVxusdvtMGun-6" value="EvaluationController" style="shape=umlLifeline;perimeter=lifelinePerimeter;whiteSpace=wrap;html=1;container=1;dropTarget=0;collapsible=0;recursiveResize=0;outlineConnect=0;portConstraint=eastwest;newEdgeStyle={&quot;curved&quot;:0,&quot;rounded&quot;:0};sketch=0;" parent="1" vertex="1"><mxGeometry x="160" y="80" width="130" height="410" as="geometry"/></mxCell><mxCell id="kRblCLMAtVxusdvtMGun-15" value="" style="html=1;points=[[0,0,0,0,5],[0,1,0,0,-5],[1,0,0,0,5],[1,1,0,0,-5]];perimeter=orthogonalPerimeter;outlineConnect=0;targetShapes=umlLifeline;portConstraint=eastwest;newEdgeStyle={&quot;curved&quot;:0,&quot;rounded&quot;:0};sketch=0;" parent="kRblCLMAtVxusdvtMGun-6" vertex="1"><mxGeometry x="60" y="90" width="10" height="300" as="geometry"/></mxCell><mxCell id="kRblCLMAtVxusdvtMGun-7" value="__init__(submission_id)" style="html=1;verticalAlign=bottom;endArrow=block;curved=0;rounded=0;sketch=0;" parent="1" source="kRblCLMAtVxusdvtMGun-1" target="kRblCLMAtVxusdvtMGun-15" edge="1"><mxGeometry x="0.0769" width="80" relative="1" as="geometry"><mxPoint x="70" y="180" as="sourcePoint"/><mxPoint x="190" y="180" as="targetPoint"/><Array as="points"><mxPoint x="145" y="180"/></Array><mxPoint as="offset"/></mxGeometry></mxCell><mxCell id="kRblCLMAtVxusdvtMGun-11" value="Evaluation" style="shape=umlLifeline;perimeter=lifelinePerimeter;whiteSpace=wrap;html=1;container=1;dropTarget=0;collapsible=0;recursiveResize=0;outlineConnect=0;portConstraint=eastwest;newEdgeStyle={&quot;curved&quot;:0,&quot;rounded&quot;:0};sketch=0;" parent="1" vertex="1"><mxGeometry x="480" y="80" width="100" height="410" as="geometry"/></mxCell><mxCell id="kRblCLMAtVxusdvtMGun-21" value="" style="html=1;points=[[0,0,0,0,5],[0,1,0,0,-5],[1,0,0,0,5],[1,1,0,0,-5]];perimeter=orthogonalPerimeter;outlineConnect=0;targetShapes=umlLifeline;portConstraint=eastwest;newEdgeStyle={&quot;curved&quot;:0,&quot;rounded&quot;:0};sketch=0;" parent="kRblCLMAtVxusdvtMGun-11" vertex="1"><mxGeometry x="45" y="160" width="10" height="170" as="geometry"/></mxCell><mxCell id="kRblCLMAtVxusdvtMGun-29" value="signal evaluation service" style="html=1;verticalAlign=bottom;endArrow=open;dashed=1;endSize=8;curved=0;rounded=0;sketch=0;" parent="1" source="kRblCLMAtVxusdvtMGun-1" edge="1"><mxGeometry relative="1" as="geometry"><mxPoint x="50" y="440" as="sourcePoint"/><mxPoint x="-120" y="460" as="targetPoint"/><Array as="points"><mxPoint x="-30" y="460"/></Array></mxGeometry></mxCell><mxCell id="5" value="" style="html=1;points=[];perimeter=orthogonalPerimeter;sketch=0;" parent="1" vertex="1"><mxGeometry x="365" y="180" width="10" height="60" as="geometry"/></mxCell><mxCell id="8" value="Load Data for Submission,&amp;nbsp;&lt;br&gt;Task, Files and Results" style="html=1;verticalAlign=bottom;endArrow=block;rounded=0;sketch=0;" parent="1" source="kRblCLMAtVxusdvtMGun-6" target="kRblCLMAtVxusdvtMGun-2" edge="1"><mxGeometry x="0.003" width="80" relative="1" as="geometry"><mxPoint x="260" y="220" as="sourcePoint"/><mxPoint x="340" y="220" as="targetPoint"/><Array as="points"><mxPoint x="270" y="200"/></Array><mxPoint as="offset"/></mxGeometry></mxCell><mxCell id="10" value="Data" style="html=1;verticalAlign=bottom;endArrow=open;dashed=1;endSize=8;rounded=0;sketch=0;" parent="1" source="kRblCLMAtVxusdvtMGun-2" target="kRblCLMAtVxusdvtMGun-6" edge="1"><mxGeometry relative="1" as="geometry"><mxPoint x="340" y="260" as="sourcePoint"/><mxPoint x="260" y="260" as="targetPoint"/><Array as="points"><mxPoint x="310" y="220"/></Array></mxGeometry></mxCell><mxCell id="12" value="Constructed Object" style="html=1;verticalAlign=bottom;endArrow=open;dashed=1;endSize=8;rounded=0;labelBackgroundColor=default;sketch=0;" parent="1" source="kRblCLMAtVxusdvtMGun-6" target="kRblCLMAtVxusdvtMGun-1" edge="1"><mxGeometry relative="1" as="geometry"><mxPoint x="200" y="250" as="sourcePoint"/><mxPoint x="120" y="250" as="targetPoint"/><Array as="points"><mxPoint x="160" y="240"/></Array></mxGeometry></mxCell><mxCell id="13" value="execute()" style="html=1;verticalAlign=bottom;endArrow=block;rounded=0;labelBackgroundColor=default;sketch=0;" parent="1" source="kRblCLMAtVxusdvtMGun-1" target="kRblCLMAtVxusdvtMGun-6" edge="1"><mxGeometry width="80" relative="1" as="geometry"><mxPoint x="120" y="250" as="sourcePoint"/><mxPoint x="200" y="250" as="targetPoint"/><Array as="points"><mxPoint x="180" y="260"/></Array></mxGeometry></mxCell><mxCell id="14" value="start Evaluation" style="html=1;verticalAlign=bottom;endArrow=block;rounded=0;labelBackgroundColor=default;sketch=0;" parent="1" source="kRblCLMAtVxusdvtMGun-6" target="kRblCLMAtVxusdvtMGun-11" edge="1"><mxGeometry width="80" relative="1" as="geometry"><mxPoint x="220" y="240" as="sourcePoint"/><mxPoint x="300" y="240" as="targetPoint"/><Array as="points"><mxPoint x="460" y="310"/></Array></mxGeometry></mxCell><mxCell id="34" value="for each Testcase" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];" vertex="1" connectable="0" parent="14"><mxGeometry x="-0.7295" y="-1" relative="1" as="geometry"><mxPoint x="14" y="-11" as="offset"/></mxGeometry></mxCell><mxCell id="15" value="result of the evaluation" style="html=1;verticalAlign=bottom;endArrow=open;dashed=1;endSize=8;rounded=0;labelBackgroundColor=default;sketch=0;" parent="1" source="kRblCLMAtVxusdvtMGun-11" target="kRblCLMAtVxusdvtMGun-6" edge="1"><mxGeometry relative="1" as="geometry"><mxPoint x="300" y="240" as="sourcePoint"/><mxPoint x="220" y="240" as="targetPoint"/><Array as="points"><mxPoint x="390" y="330"/></Array></mxGeometry></mxCell><mxCell id="25" value="" style="html=1;points=[];perimeter=orthogonalPerimeter;" parent="1" vertex="1"><mxGeometry x="365" y="410" width="10" height="40" as="geometry"/></mxCell><mxCell id="28" value="write evaluation result" style="verticalAlign=bottom;endArrow=block;rounded=0;labelBackgroundColor=default;sketch=0;strokeColor=default;html=1;" parent="1" source="kRblCLMAtVxusdvtMGun-6" target="kRblCLMAtVxusdvtMGun-2" edge="1"><mxGeometry width="80" relative="1" as="geometry"><mxPoint x="200" y="320" as="sourcePoint"/><mxPoint x="280" y="320" as="targetPoint"/><Array as="points"><mxPoint x="280" y="420"/></Array></mxGeometry></mxCell><mxCell id="29" value="success" style="html=1;verticalAlign=bottom;endArrow=open;dashed=1;endSize=8;rounded=0;labelBackgroundColor=default;sketch=0;strokeColor=default;" parent="1" source="kRblCLMAtVxusdvtMGun-2" target="kRblCLMAtVxusdvtMGun-6" edge="1"><mxGeometry relative="1" as="geometry"><mxPoint x="280" y="320" as="sourcePoint"/><mxPoint x="200" y="320" as="targetPoint"/><Array as="points"><mxPoint x="270" y="440"/></Array></mxGeometry></mxCell><mxCell id="30" value="success" style="html=1;verticalAlign=bottom;endArrow=open;dashed=1;endSize=8;rounded=0;labelBackgroundColor=default;sketch=0;strokeColor=default;" parent="1" source="kRblCLMAtVxusdvtMGun-6" target="kRblCLMAtVxusdvtMGun-1" edge="1"><mxGeometry relative="1" as="geometry"><mxPoint x="190" y="340" as="sourcePoint"/><mxPoint x="110" y="340" as="targetPoint"/><Array as="points"><mxPoint x="190" y="450"/></Array></mxGeometry></mxCell></root></mxGraphModel></diagram></mxfile>
Loading

0 comments on commit 35dedd6

Please sign in to comment.