tutor-contrib-codejail 21.0.0__tar.gz → 22.0.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. tutor_contrib_codejail-22.0.0/PKG-INFO +143 -0
  2. tutor_contrib_codejail-22.0.0/README.md +122 -0
  3. tutor_contrib_codejail-22.0.0/pyproject.toml +71 -0
  4. tutor_contrib_codejail-22.0.0/pyproject.toml.orig +73 -0
  5. tutor_contrib_codejail-22.0.0/tutorcodejail/__about__.py +3 -0
  6. {tutor_contrib_codejail-21.0.0 → tutor_contrib_codejail-22.0.0}/tutorcodejail/patches/cms-env +1 -1
  7. {tutor_contrib_codejail-21.0.0 → tutor_contrib_codejail-22.0.0}/tutorcodejail/patches/k8s-deployments +6 -46
  8. tutor_contrib_codejail-22.0.0/tutorcodejail/patches/k8s-services +15 -0
  9. tutor_contrib_codejail-22.0.0/tutorcodejail/patches/kustomization-configmapgenerator +12 -0
  10. {tutor_contrib_codejail-21.0.0 → tutor_contrib_codejail-22.0.0}/tutorcodejail/patches/lms-env +1 -1
  11. tutor_contrib_codejail-22.0.0/tutorcodejail/patches/local-docker-compose-services +26 -0
  12. {tutor_contrib_codejail-21.0.0 → tutor_contrib_codejail-22.0.0}/tutorcodejail/plugin.py +36 -60
  13. {tutor_contrib_codejail-21.0.0/tutorcodejail/templates/codejail/apps/codejail-service-v2 → tutor_contrib_codejail-22.0.0/tutorcodejail/templates/codejail/apps/codejail}/tutor.py +1 -1
  14. tutor_contrib_codejail-22.0.0/tutorcodejail/templates/codejail/build/.gitignore +0 -0
  15. {tutor_contrib_codejail-21.0.0/tutorcodejail/templates/codejail/build/codejail-service → tutor_contrib_codejail-22.0.0/tutorcodejail/templates/codejail/build/codejail}/Dockerfile +7 -7
  16. tutor_contrib_codejail-21.0.0/MANIFEST.in +0 -2
  17. tutor_contrib_codejail-21.0.0/PKG-INFO +0 -222
  18. tutor_contrib_codejail-21.0.0/README.rst +0 -191
  19. tutor_contrib_codejail-21.0.0/setup.cfg +0 -28
  20. tutor_contrib_codejail-21.0.0/setup.py +0 -59
  21. tutor_contrib_codejail-21.0.0/tutor_contrib_codejail.egg-info/PKG-INFO +0 -222
  22. tutor_contrib_codejail-21.0.0/tutor_contrib_codejail.egg-info/SOURCES.txt +0 -32
  23. tutor_contrib_codejail-21.0.0/tutor_contrib_codejail.egg-info/dependency_links.txt +0 -1
  24. tutor_contrib_codejail-21.0.0/tutor_contrib_codejail.egg-info/entry_points.txt +0 -2
  25. tutor_contrib_codejail-21.0.0/tutor_contrib_codejail.egg-info/requires.txt +0 -1
  26. tutor_contrib_codejail-21.0.0/tutor_contrib_codejail.egg-info/top_level.txt +0 -1
  27. tutor_contrib_codejail-21.0.0/tutorcodejail/__about__.py +0 -2
  28. tutor_contrib_codejail-21.0.0/tutorcodejail/patches/k8s-services +0 -14
  29. tutor_contrib_codejail-21.0.0/tutorcodejail/patches/kustomization-configmapgenerator +0 -17
  30. tutor_contrib_codejail-21.0.0/tutorcodejail/patches/local-docker-compose-dev-services +0 -8
  31. tutor_contrib_codejail-21.0.0/tutorcodejail/patches/local-docker-compose-jobs-services +0 -9
  32. tutor_contrib_codejail-21.0.0/tutorcodejail/patches/local-docker-compose-services +0 -43
  33. tutor_contrib_codejail-21.0.0/tutorcodejail/templates/codejail/apps/codejail/tutor.py +0 -18
  34. tutor_contrib_codejail-21.0.0/tutorcodejail/templates/codejail/build/codejail/Dockerfile +0 -100
  35. {tutor_contrib_codejail-21.0.0 → tutor_contrib_codejail-22.0.0}/LICENSE +0 -0
  36. {tutor_contrib_codejail-21.0.0 → tutor_contrib_codejail-22.0.0}/tutorcodejail/__init__.py +0 -0
  37. {tutor_contrib_codejail-21.0.0 → tutor_contrib_codejail-22.0.0}/tutorcodejail/patches/.gitignore +0 -0
  38. /tutor_contrib_codejail-21.0.0/tutorcodejail/templates/codejail/apps/.gitignore → /tutor_contrib_codejail-22.0.0/tutorcodejail/patches/local-docker-compose-dev-services +0 -0
  39. {tutor_contrib_codejail-21.0.0/tutorcodejail/templates/codejail/build → tutor_contrib_codejail-22.0.0/tutorcodejail/templates/codejail/apps}/.gitignore +0 -0
  40. {tutor_contrib_codejail-21.0.0 → tutor_contrib_codejail-22.0.0}/tutorcodejail/templates/codejail/apps/profiles/docker-edx-sandbox.profile +0 -0
  41. {tutor_contrib_codejail-21.0.0 → tutor_contrib_codejail-22.0.0}/tutorcodejail/templates/codejail/apps/profiles/openedx-codejail-service.profile +0 -0
  42. {tutor_contrib_codejail-21.0.0 → tutor_contrib_codejail-22.0.0}/tutorcodejail/templates/codejail/build/codejail_apparmor/Dockerfile +0 -0
@@ -0,0 +1,143 @@
1
+ Metadata-Version: 2.4
2
+ Name: tutor-contrib-codejail
3
+ Version: 22.0.0
4
+ Summary: Codejail plugin for Tutor
5
+ Author: eduNEXT
6
+ License-File: LICENSE
7
+ Classifier: Development Status :: 3 - Alpha
8
+ Classifier: Intended Audience :: Developers
9
+ Classifier: Operating System :: OS Independent
10
+ Classifier: Programming Language :: Python
11
+ Classifier: Programming Language :: Python :: 3.10
12
+ Classifier: Programming Language :: Python :: 3.11
13
+ Classifier: Programming Language :: Python :: 3.12
14
+ Classifier: Programming Language :: Python :: 3.13
15
+ Requires-Dist: tutor~=22.0
16
+ Requires-Python: >=3.10
17
+ Project-URL: Code, https://github.com/edunext/tutor-contrib-codejail
18
+ Project-URL: Issue tracker, https://github.com/edunext/tutor-contrib-codejail/issues
19
+ Project-URL: Homepage, https://github.com/github/tutor-contrib-codejail
20
+ Description-Content-Type: text/markdown
21
+
22
+ # Codejail plugin for [Tutor](https://docs.tutor.overhang.io)
23
+
24
+ [Codejail](https://github.com/openedx/codejail) is a Python library used to
25
+ manage the execution of Python code in a sandboxed environment.
26
+
27
+ This plugin configures and runs a remote CodeJail Service instance that
28
+ implements the safe-exec API used by the Open edX platform to offer more
29
+ advanced capabilities to course authors.
30
+
31
+ ## Installation
32
+
33
+ To install the latest version, run:
34
+
35
+ ``` bash
36
+ pip install tutor-contrib-codejail
37
+ # or install from the source
38
+ pip install git+https://github.com/edunext/tutor-contrib-codejail
39
+ ```
40
+
41
+ ## Requisites
42
+
43
+ By it's very nature of allowing arbitrary code execution, the CodeJail service
44
+ must be run under a hardened environment. The security guarantees are enforced
45
+ through AppArmor security profiles and thus necessitates the use of a Linux host
46
+ with support for AppArmor security module (usually Debian derived
47
+ distributions).
48
+
49
+ You can validate if your Linux host has AppArmor enabled by running:
50
+
51
+ ```bash
52
+ aa-enabled
53
+ ```
54
+
55
+ ## Configuration
56
+
57
+ To customize the configuration, update the following settings in Tutor:
58
+
59
+ - `CODEJAIL_APPARMOR_DOCKER_IMAGE`: (default: `docker.io/ednxops/codejail_apparmor_loader:latest`)
60
+ - `CODEJAIL_DOCKER_IMAGE`: (default: `docker.io/ednxops/codejailservice:{{__version__}}`)
61
+ - `CODEJAIL_ENABLE_K8S_DAEMONSET` (default: `False`)
62
+ - `CODEJAIL_EXTRA_PIP_REQUIREMENTS` (default: `[]`)
63
+ - `CODEJAIL_SANDBOX_PYTHON_VERSION` (default: `3.12`)
64
+ - `CODEJAIL_SERVICE_REPOSITORY` (default: `https://github.com/openedx/codejail-service.git`)
65
+ - `CODEJAIL_SERVICE_VERSION` (default: `{{ OPENEDX_COMMON_VERSION }}`),
66
+
67
+ ### Custom Image
68
+
69
+ In most cases, you can work with the provided Docker image for the
70
+ release. However, there might be cases when a custom image will be necessary:
71
+
72
+ - If you need additional packages installed in the sandbox environment. Use the
73
+ setting `CODEJAIL_EXTRA_PIP_REQUIREMENTS` to define the list of additional
74
+ packages.
75
+ - If you need to run the sandbox environment under a different Python version
76
+ you can use `CODEJAIL_SANDBOX_PYTHON_VERSION`. This is particularly useful
77
+ when the sandbox version is upgraded between releases but you need to figure
78
+ out a migration plan for instructor code.
79
+ - If you need a completely different set of packages in the sandbox virtual
80
+ environment. In this case you will need to point to a requirements file using
81
+ the following docker build arguments: `SANDBOX_DEPS_REPO`,
82
+ `SANDBOX_DEPS_VERSION`, `SANDBOX_DEPS_SRC_DIR` and `SANDBOX_DEPS_SRC_FILE`.
83
+ Their current default values are
84
+ `https://github.com/openedx/codejail-service.git`, `{{ OPENEDX_COMMON_VERSION
85
+ }}`, `requirements/sandbox` and `base.txt`. This will point to
86
+ https://github.com/openedx/codejail-service/blob/release/verawood.1/requirements/base.txt
87
+ for the Verawood release. You can provide the arguments to Tutor as follows
88
+ `tutor images build codejail -a SANDBOX_DEPS_VERSION=ulmo2`.
89
+
90
+ ## Kubernetes Support
91
+
92
+ The CodeJail service provides a sandbox to run arbitrary code. Security
93
+ enforcement in the sandbox is done through *AppArmor*, this means that
94
+ AppArmor must be installed in the host machine, and the [provided
95
+ profile](tutorcodejail/templates/codejail/apps/profiles/docker-edx-sandbox)
96
+ must be loaded.
97
+
98
+ For Kubernetes environments, you must ensure each node has AppArmor installed
99
+ and has successfully loaded the profile.
100
+
101
+ You can enable a helper Daemon Set that will load the profile onto all the nodes
102
+ by setting `CODEJAIL_ENABLE_K8S_DAEMONSET` to true.
103
+
104
+ More info about this discussion can be found on [this
105
+ issue](https://github.com/eduNEXT/tutor-contrib-codejail/issues/24).
106
+
107
+ ## Testing Functionality
108
+
109
+ To verify if Codejail is working, use a course with loncapa problems in `Studio`
110
+ and check for correct execution. You can import the provided
111
+ [example course](https://github.com/eduNEXT/tutor-contrib-codejail/blob/main/docs/resources/course_codejail_example.tar.gz).
112
+
113
+ Once the course is imported, go to any section and select an exercise
114
+ ([section example](http://studio.local.overhang.io:8001/container/block-v1:edX+DemoX+Demo_Course+type@vertical+block@v-integral1)),
115
+ the proper result is:
116
+
117
+ ![Example when codejail is working](./docs/resources/Codejailworking.png){.align-center
118
+ width="725px"}
119
+
120
+ In this case, the section\'s content will render correctly and work as
121
+ specified in the instructions of the problem.
122
+
123
+ ## New CodeJail Service implementation
124
+
125
+ The Ulmo release introduced support for deploying a new
126
+ implementation of the remote CodeJail service (openedx/codejail-service). The
127
+ Verawood release completely removes support for deploying the old version of the
128
+ service (edunext/codejailservice). Users should be mindful of the following
129
+ points when upgrading:
130
+
131
+ 1. The new CodeJail service **requires** AppArmor 4 on the host machine.
132
+ AppArmor 4 is available on relatively new Debian based distributions (ubuntu
133
+ 24.04, Debian Trixie, etc).
134
+ 2. AppArmor enforcement is no longer optional. The new CodeJail service performs
135
+ startup checks to ensure the sandbox is properly isolated and will not start
136
+ if the AppArmor profile is not loaded and configured.
137
+ 3. The new CodeJail service implementation is based on Django instead of Flask.
138
+ Any usage of the `codejail-*-settings` must be adjusted accordingly.
139
+
140
+ ## License
141
+
142
+ This software is licensed under the terms of the AGPLv3. See the LICENSE
143
+ file for details.
@@ -0,0 +1,122 @@
1
+ # Codejail plugin for [Tutor](https://docs.tutor.overhang.io)
2
+
3
+ [Codejail](https://github.com/openedx/codejail) is a Python library used to
4
+ manage the execution of Python code in a sandboxed environment.
5
+
6
+ This plugin configures and runs a remote CodeJail Service instance that
7
+ implements the safe-exec API used by the Open edX platform to offer more
8
+ advanced capabilities to course authors.
9
+
10
+ ## Installation
11
+
12
+ To install the latest version, run:
13
+
14
+ ``` bash
15
+ pip install tutor-contrib-codejail
16
+ # or install from the source
17
+ pip install git+https://github.com/edunext/tutor-contrib-codejail
18
+ ```
19
+
20
+ ## Requisites
21
+
22
+ By it's very nature of allowing arbitrary code execution, the CodeJail service
23
+ must be run under a hardened environment. The security guarantees are enforced
24
+ through AppArmor security profiles and thus necessitates the use of a Linux host
25
+ with support for AppArmor security module (usually Debian derived
26
+ distributions).
27
+
28
+ You can validate if your Linux host has AppArmor enabled by running:
29
+
30
+ ```bash
31
+ aa-enabled
32
+ ```
33
+
34
+ ## Configuration
35
+
36
+ To customize the configuration, update the following settings in Tutor:
37
+
38
+ - `CODEJAIL_APPARMOR_DOCKER_IMAGE`: (default: `docker.io/ednxops/codejail_apparmor_loader:latest`)
39
+ - `CODEJAIL_DOCKER_IMAGE`: (default: `docker.io/ednxops/codejailservice:{{__version__}}`)
40
+ - `CODEJAIL_ENABLE_K8S_DAEMONSET` (default: `False`)
41
+ - `CODEJAIL_EXTRA_PIP_REQUIREMENTS` (default: `[]`)
42
+ - `CODEJAIL_SANDBOX_PYTHON_VERSION` (default: `3.12`)
43
+ - `CODEJAIL_SERVICE_REPOSITORY` (default: `https://github.com/openedx/codejail-service.git`)
44
+ - `CODEJAIL_SERVICE_VERSION` (default: `{{ OPENEDX_COMMON_VERSION }}`),
45
+
46
+ ### Custom Image
47
+
48
+ In most cases, you can work with the provided Docker image for the
49
+ release. However, there might be cases when a custom image will be necessary:
50
+
51
+ - If you need additional packages installed in the sandbox environment. Use the
52
+ setting `CODEJAIL_EXTRA_PIP_REQUIREMENTS` to define the list of additional
53
+ packages.
54
+ - If you need to run the sandbox environment under a different Python version
55
+ you can use `CODEJAIL_SANDBOX_PYTHON_VERSION`. This is particularly useful
56
+ when the sandbox version is upgraded between releases but you need to figure
57
+ out a migration plan for instructor code.
58
+ - If you need a completely different set of packages in the sandbox virtual
59
+ environment. In this case you will need to point to a requirements file using
60
+ the following docker build arguments: `SANDBOX_DEPS_REPO`,
61
+ `SANDBOX_DEPS_VERSION`, `SANDBOX_DEPS_SRC_DIR` and `SANDBOX_DEPS_SRC_FILE`.
62
+ Their current default values are
63
+ `https://github.com/openedx/codejail-service.git`, `{{ OPENEDX_COMMON_VERSION
64
+ }}`, `requirements/sandbox` and `base.txt`. This will point to
65
+ https://github.com/openedx/codejail-service/blob/release/verawood.1/requirements/base.txt
66
+ for the Verawood release. You can provide the arguments to Tutor as follows
67
+ `tutor images build codejail -a SANDBOX_DEPS_VERSION=ulmo2`.
68
+
69
+ ## Kubernetes Support
70
+
71
+ The CodeJail service provides a sandbox to run arbitrary code. Security
72
+ enforcement in the sandbox is done through *AppArmor*, this means that
73
+ AppArmor must be installed in the host machine, and the [provided
74
+ profile](tutorcodejail/templates/codejail/apps/profiles/docker-edx-sandbox)
75
+ must be loaded.
76
+
77
+ For Kubernetes environments, you must ensure each node has AppArmor installed
78
+ and has successfully loaded the profile.
79
+
80
+ You can enable a helper Daemon Set that will load the profile onto all the nodes
81
+ by setting `CODEJAIL_ENABLE_K8S_DAEMONSET` to true.
82
+
83
+ More info about this discussion can be found on [this
84
+ issue](https://github.com/eduNEXT/tutor-contrib-codejail/issues/24).
85
+
86
+ ## Testing Functionality
87
+
88
+ To verify if Codejail is working, use a course with loncapa problems in `Studio`
89
+ and check for correct execution. You can import the provided
90
+ [example course](https://github.com/eduNEXT/tutor-contrib-codejail/blob/main/docs/resources/course_codejail_example.tar.gz).
91
+
92
+ Once the course is imported, go to any section and select an exercise
93
+ ([section example](http://studio.local.overhang.io:8001/container/block-v1:edX+DemoX+Demo_Course+type@vertical+block@v-integral1)),
94
+ the proper result is:
95
+
96
+ ![Example when codejail is working](./docs/resources/Codejailworking.png){.align-center
97
+ width="725px"}
98
+
99
+ In this case, the section\'s content will render correctly and work as
100
+ specified in the instructions of the problem.
101
+
102
+ ## New CodeJail Service implementation
103
+
104
+ The Ulmo release introduced support for deploying a new
105
+ implementation of the remote CodeJail service (openedx/codejail-service). The
106
+ Verawood release completely removes support for deploying the old version of the
107
+ service (edunext/codejailservice). Users should be mindful of the following
108
+ points when upgrading:
109
+
110
+ 1. The new CodeJail service **requires** AppArmor 4 on the host machine.
111
+ AppArmor 4 is available on relatively new Debian based distributions (ubuntu
112
+ 24.04, Debian Trixie, etc).
113
+ 2. AppArmor enforcement is no longer optional. The new CodeJail service performs
114
+ startup checks to ensure the sandbox is properly isolated and will not start
115
+ if the AppArmor profile is not loaded and configured.
116
+ 3. The new CodeJail service implementation is based on Django instead of Flask.
117
+ Any usage of the `codejail-*-settings` must be adjusted accordingly.
118
+
119
+ ## License
120
+
121
+ This software is licensed under the terms of the AGPLv3. See the LICENSE
122
+ file for details.
@@ -0,0 +1,71 @@
1
+ [project]
2
+ name = "tutor-contrib-codejail"
3
+ version = "22.0.0"
4
+ description = "Codejail plugin for Tutor"
5
+ readme = "README.md"
6
+ license-files = ["LICENSE"]
7
+ requires-python = ">=3.10"
8
+ dependencies = ["tutor~=22.0"]
9
+ classifiers = [
10
+ "Development Status :: 3 - Alpha",
11
+ "Intended Audience :: Developers",
12
+ "Operating System :: OS Independent",
13
+ "Programming Language :: Python",
14
+ "Programming Language :: Python :: 3.10",
15
+ "Programming Language :: Python :: 3.11",
16
+ "Programming Language :: Python :: 3.12",
17
+ "Programming Language :: Python :: 3.13",
18
+ ]
19
+
20
+ [[project.authors]]
21
+ name = "eduNEXT"
22
+
23
+ [project.urls]
24
+ Code = "https://github.com/edunext/tutor-contrib-codejail"
25
+ "Issue tracker" = "https://github.com/edunext/tutor-contrib-codejail/issues"
26
+ Homepage = "https://github.com/github/tutor-contrib-codejail"
27
+
28
+ [project.entry-points."tutor.plugin.v1"]
29
+ codejail = "tutorcodejail.plugin"
30
+
31
+ [tool.uv.build-backend]
32
+ module-root = "."
33
+ module-name = "tutorcodejail"
34
+
35
+ [tool.ruff]
36
+ line-length = 120
37
+ indent-width = 4
38
+ extend-exclude = ["tutorcodejail/templates/**"]
39
+
40
+ [tool.ruff.lint]
41
+ select = [
42
+ "E4",
43
+ "E7",
44
+ "E9",
45
+ "F",
46
+ "I",
47
+ "UP",
48
+ ]
49
+
50
+ [tool.scriv]
51
+ version = "literal: pyproject.toml: project.version"
52
+ categories = "Added, Changed, Fixed, Removed"
53
+ format = "md"
54
+ md_header_level = 2
55
+ new_fragment_template = "file: changelog.d/scriv/new_fragment.md.j2"
56
+ entry_title_template = "file: changelog.d/scriv/entry_title.md.j2"
57
+
58
+ [tool.ty.src]
59
+ exclude = ["tutorcodejail/templates"]
60
+
61
+ [build-system]
62
+ requires = ["uv_build>=0.9.5,<0.13.0"]
63
+ build-backend = "uv_build"
64
+
65
+ [dependency-groups]
66
+ dev = [
67
+ "pytest>=9.0.3",
68
+ "ruff",
69
+ "scriv>=1.8.0",
70
+ "ty>=0.0.34",
71
+ ]
@@ -0,0 +1,73 @@
1
+ [project]
2
+ name = "tutor-contrib-codejail"
3
+ version = "22.0.0"
4
+ description = "Codejail plugin for Tutor"
5
+ readme = "README.md"
6
+ license-files = ["LICENSE"]
7
+ authors = [
8
+ { name = "eduNEXT" }
9
+ ]
10
+ requires-python = ">=3.10"
11
+ dependencies = [
12
+ "tutor~=22.0"
13
+ ]
14
+ classifiers = [
15
+ "Development Status :: 3 - Alpha",
16
+ "Intended Audience :: Developers",
17
+ "Operating System :: OS Independent",
18
+ "Programming Language :: Python",
19
+ "Programming Language :: Python :: 3.10",
20
+ "Programming Language :: Python :: 3.11",
21
+ "Programming Language :: Python :: 3.12",
22
+ "Programming Language :: Python :: 3.13",
23
+ ]
24
+
25
+ [project.urls]
26
+ "Code" = "https://github.com/edunext/tutor-contrib-codejail"
27
+ "Issue tracker" = "https://github.com/edunext/tutor-contrib-codejail/issues"
28
+ "Homepage" = "https://github.com/github/tutor-contrib-codejail"
29
+
30
+ [project.entry-points."tutor.plugin.v1"]
31
+ codejail = "tutorcodejail.plugin"
32
+
33
+ [tool.uv.build-backend]
34
+ module-root = "."
35
+ module-name = "tutorcodejail"
36
+
37
+ [build-system]
38
+ requires = ["uv_build>=0.9.5,<0.13.0"]
39
+ build-backend = "uv_build"
40
+
41
+ [dependency-groups]
42
+ dev = [
43
+ "pytest>=9.0.3",
44
+ "ruff",
45
+ "scriv>=1.8.0",
46
+ "ty>=0.0.34",
47
+ ]
48
+
49
+ [tool.ruff]
50
+ line-length = 120
51
+ indent-width = 4
52
+ lint.select = [
53
+ "E4",
54
+ "E7",
55
+ "E9",
56
+ "F",
57
+ "I",
58
+ "UP",
59
+ ]
60
+ extend-exclude = [
61
+ "tutorcodejail/templates/**"
62
+ ]
63
+
64
+ [tool.scriv]
65
+ version = "literal: pyproject.toml: project.version"
66
+ categories = "Added, Changed, Fixed, Removed"
67
+ format = "md"
68
+ md_header_level = 2
69
+ new_fragment_template = "file: changelog.d/scriv/new_fragment.md.j2"
70
+ entry_title_template = "file: changelog.d/scriv/entry_title.md.j2"
71
+
72
+ [tool.ty.src]
73
+ exclude = ["tutorcodejail/templates"]
@@ -0,0 +1,3 @@
1
+ from importlib import metadata
2
+
3
+ __version__ = metadata.version("tutor-contrib-codejail")
@@ -1,4 +1,4 @@
1
1
  ENABLE_CODEJAIL_REST_SERVICE: true
2
- CODE_JAIL_REST_SERVICE_HOST: "http://{{ CODEJAIL_HOST }}:8550"
2
+ CODE_JAIL_REST_SERVICE_HOST: "http://codejail:8000"
3
3
  CODE_JAIL_REST_SERVICE_CONNECT_TIMEOUT: 0.5
4
4
  CODE_JAIL_REST_SERVICE_READ_TIMEOUT: 3.5
@@ -1,27 +1,26 @@
1
1
  ---
2
- {% if CODEJAIL_USE_SERVICE_V2 %}
3
2
  apiVersion: apps/v1
4
3
  kind: Deployment
5
4
  metadata:
6
- name: codejailservice
5
+ name: codejail
7
6
  labels:
8
- app.kubernetes.io/name: codejailservice
7
+ app.kubernetes.io/name: codejail
9
8
  spec:
10
9
  selector:
11
10
  matchLabels:
12
- app.kubernetes.io/name: codejailservice
11
+ app.kubernetes.io/name: codejail
13
12
  template:
14
13
  metadata:
15
14
  labels:
16
- app.kubernetes.io/name: codejailservice
15
+ app.kubernetes.io/name: codejail
17
16
  spec:
18
17
  securityContext:
19
18
  appArmorProfile:
20
19
  type: Localhost
21
20
  localhostProfile: openedx_codejail_service
22
21
  containers:
23
- - name: codejailservice
24
- image: {{ CODEJAIL_DOCKER_IMAGE_V2 }}
22
+ - name: codejail
23
+ image: {{ CODEJAIL_DOCKER_IMAGE }}
25
24
  ports:
26
25
  - containerPort: 8550
27
26
  env:
@@ -35,45 +34,6 @@ spec:
35
34
  - name: settings-codejail
36
35
  configMap:
37
36
  name: settings-codejail
38
- {% else %}
39
- apiVersion: apps/v1
40
- kind: Deployment
41
- metadata:
42
- name: codejailservice
43
- labels:
44
- app.kubernetes.io/name: codejailservice
45
- spec:
46
- selector:
47
- matchLabels:
48
- app.kubernetes.io/name: codejailservice
49
- template:
50
- metadata:
51
- labels:
52
- app.kubernetes.io/name: codejailservice
53
- spec:
54
- {% if CODEJAIL_ENFORCE_APPARMOR %}
55
- securityContext:
56
- appArmorProfile:
57
- type: Localhost
58
- localhostProfile: docker-edx-sandbox
59
- {% endif %}
60
- containers:
61
- - name: codejailservice
62
- image: {{ CODEJAIL_DOCKER_IMAGE }}
63
- ports:
64
- - containerPort: 8550
65
- env:
66
- - name: FLASK_APP_SETTINGS
67
- value: codejailservice.tutor.ProductionConfig
68
- volumeMounts:
69
- - mountPath: /openedx/codejailservice/codejailservice/tutor.py
70
- name: settings-codejail
71
- subPath: tutor.py
72
- volumes:
73
- - name: settings-codejail
74
- configMap:
75
- name: settings-codejail
76
- {% endif %}
77
37
  {% if CODEJAIL_ENABLE_K8S_DAEMONSET %}
78
38
  ---
79
39
  apiVersion: apps/v1
@@ -0,0 +1,15 @@
1
+ ---
2
+ apiVersion: v1
3
+ kind: Service
4
+ metadata:
5
+ name: codejail
6
+ labels:
7
+ app.kubernetes.io/name: codejail
8
+ spec:
9
+ type: ClusterIP
10
+ ports:
11
+ - port: 8000
12
+ protocol: TCP
13
+ name: http
14
+ selector:
15
+ app.kubernetes.io/name: codejail
@@ -0,0 +1,12 @@
1
+ - name: codejail-profile
2
+ files:
3
+ - plugins/codejail/apps/profiles/openedx-codejail-service.profile
4
+ options:
5
+ labels:
6
+ app.kubernetes.io/name: codejail-aa-loader
7
+ - name: codejail-settings
8
+ files:
9
+ - plugins/codejail/apps/codejail/tutor.py
10
+ options:
11
+ labels:
12
+ app.kubernetes.io/name: codejail
@@ -1,4 +1,4 @@
1
1
  ENABLE_CODEJAIL_REST_SERVICE: true
2
- CODE_JAIL_REST_SERVICE_HOST: "http://{{ CODEJAIL_HOST }}:8550"
2
+ CODE_JAIL_REST_SERVICE_HOST: "http://codejail:8000"
3
3
  CODE_JAIL_REST_SERVICE_CONNECT_TIMEOUT: 0.5
4
4
  CODE_JAIL_REST_SERVICE_READ_TIMEOUT: 3.5
@@ -0,0 +1,26 @@
1
+ #############Codejail service
2
+ codejail:
3
+ image: {{ CODEJAIL_DOCKER_IMAGE }}
4
+ environment:
5
+ DJANGO_SETTINGS_MODULE: codejail_service.settings.tutor
6
+ security_opt:
7
+ - apparmor:openedx_codejail_service
8
+ volumes:
9
+ - ../plugins/codejail/apps/codejail/tutor.py:/app/codejail_service/settings/tutor.py:ro
10
+ restart: unless-stopped
11
+ depends_on:
12
+ codejail-apparmor-loader:
13
+ condition: service_completed_successfully
14
+
15
+ codejail-apparmor-loader:
16
+ image: {{ CODEJAIL_APPARMOR_DOCKER_IMAGE }}
17
+ privileged: true
18
+ command:
19
+ - /usr/bin/loader
20
+ - -logtostderr
21
+ - -v=2
22
+ - /profiles
23
+ volumes:
24
+ - ../plugins/codejail/apps/profiles/:/profiles/:ro
25
+ - /sys:/sys
26
+ - /etc/apparmor.d:/etc/apparmor.d