tutor-contrib-codejail 21.0.1__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 (29) hide show
  1. {tutor_contrib_codejail-21.0.1 → tutor_contrib_codejail-22.0.0}/PKG-INFO +40 -42
  2. {tutor_contrib_codejail-21.0.1 → tutor_contrib_codejail-22.0.0}/README.md +38 -40
  3. tutor_contrib_codejail-22.0.0/pyproject.toml +71 -0
  4. tutor_contrib_codejail-21.0.1/pyproject.toml → tutor_contrib_codejail-22.0.0/pyproject.toml.orig +4 -4
  5. {tutor_contrib_codejail-21.0.1 → tutor_contrib_codejail-22.0.0}/tutorcodejail/patches/cms-env +1 -1
  6. {tutor_contrib_codejail-21.0.1 → tutor_contrib_codejail-22.0.0}/tutorcodejail/patches/k8s-deployments +6 -46
  7. tutor_contrib_codejail-22.0.0/tutorcodejail/patches/k8s-services +15 -0
  8. tutor_contrib_codejail-22.0.0/tutorcodejail/patches/kustomization-configmapgenerator +12 -0
  9. {tutor_contrib_codejail-21.0.1 → tutor_contrib_codejail-22.0.0}/tutorcodejail/patches/lms-env +1 -1
  10. tutor_contrib_codejail-22.0.0/tutorcodejail/patches/local-docker-compose-services +26 -0
  11. {tutor_contrib_codejail-21.0.1 → tutor_contrib_codejail-22.0.0}/tutorcodejail/plugin.py +34 -53
  12. {tutor_contrib_codejail-21.0.1/tutorcodejail/templates/codejail/apps/codejail-service-v2 → tutor_contrib_codejail-22.0.0/tutorcodejail/templates/codejail/apps/codejail}/tutor.py +1 -1
  13. tutor_contrib_codejail-22.0.0/tutorcodejail/templates/codejail/build/.gitignore +0 -0
  14. {tutor_contrib_codejail-21.0.1/tutorcodejail/templates/codejail/build/codejail-service → tutor_contrib_codejail-22.0.0/tutorcodejail/templates/codejail/build/codejail}/Dockerfile +7 -7
  15. tutor_contrib_codejail-21.0.1/tutorcodejail/patches/k8s-services +0 -14
  16. tutor_contrib_codejail-21.0.1/tutorcodejail/patches/kustomization-configmapgenerator +0 -17
  17. tutor_contrib_codejail-21.0.1/tutorcodejail/patches/local-docker-compose-dev-services +0 -8
  18. tutor_contrib_codejail-21.0.1/tutorcodejail/patches/local-docker-compose-services +0 -45
  19. tutor_contrib_codejail-21.0.1/tutorcodejail/templates/codejail/apps/codejail/tutor.py +0 -18
  20. tutor_contrib_codejail-21.0.1/tutorcodejail/templates/codejail/build/codejail/Dockerfile +0 -100
  21. {tutor_contrib_codejail-21.0.1 → tutor_contrib_codejail-22.0.0}/LICENSE +0 -0
  22. {tutor_contrib_codejail-21.0.1 → tutor_contrib_codejail-22.0.0}/tutorcodejail/__about__.py +0 -0
  23. {tutor_contrib_codejail-21.0.1 → tutor_contrib_codejail-22.0.0}/tutorcodejail/__init__.py +0 -0
  24. {tutor_contrib_codejail-21.0.1 → tutor_contrib_codejail-22.0.0}/tutorcodejail/patches/.gitignore +0 -0
  25. /tutor_contrib_codejail-21.0.1/tutorcodejail/templates/codejail/apps/.gitignore → /tutor_contrib_codejail-22.0.0/tutorcodejail/patches/local-docker-compose-dev-services +0 -0
  26. {tutor_contrib_codejail-21.0.1/tutorcodejail/templates/codejail/build → tutor_contrib_codejail-22.0.0/tutorcodejail/templates/codejail/apps}/.gitignore +0 -0
  27. {tutor_contrib_codejail-21.0.1 → tutor_contrib_codejail-22.0.0}/tutorcodejail/templates/codejail/apps/profiles/docker-edx-sandbox.profile +0 -0
  28. {tutor_contrib_codejail-21.0.1 → tutor_contrib_codejail-22.0.0}/tutorcodejail/templates/codejail/apps/profiles/openedx-codejail-service.profile +0 -0
  29. {tutor_contrib_codejail-21.0.1 → tutor_contrib_codejail-22.0.0}/tutorcodejail/templates/codejail/build/codejail_apparmor/Dockerfile +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: tutor-contrib-codejail
3
- Version: 21.0.1
3
+ Version: 22.0.0
4
4
  Summary: Codejail plugin for Tutor
5
5
  Author: eduNEXT
6
6
  License-File: LICENSE
@@ -12,7 +12,7 @@ Classifier: Programming Language :: Python :: 3.10
12
12
  Classifier: Programming Language :: Python :: 3.11
13
13
  Classifier: Programming Language :: Python :: 3.12
14
14
  Classifier: Programming Language :: Python :: 3.13
15
- Requires-Dist: tutor~=21.0
15
+ Requires-Dist: tutor~=22.0
16
16
  Requires-Python: >=3.10
17
17
  Project-URL: Code, https://github.com/edunext/tutor-contrib-codejail
18
18
  Project-URL: Issue tracker, https://github.com/edunext/tutor-contrib-codejail/issues
@@ -28,17 +28,6 @@ This plugin configures and runs a remote CodeJail Service instance that
28
28
  implements the safe-exec API used by the Open edX platform to offer more
29
29
  advanced capabilities to course authors.
30
30
 
31
- Starting from the Ulmo release, the codejail plugin is transitioning to an
32
- alternative implementation of the safe-exec API (
33
- [Codejail Service V2](https://github.com/openedx/codejail-service)). You can
34
- opt-in to use this new implementation on Ulmo before it finally becomes the
35
- default on the Verawood release.
36
-
37
- > [!NOTE]
38
- > The new CodeJail Service implementation is based on Django instead of Flask,
39
- > therefore settings changed with the `codejail-*-settings` patches must be
40
- > adjusted accordingly.
41
-
42
31
  ## Installation
43
32
 
44
33
  To install the latest version, run:
@@ -68,38 +57,35 @@ aa-enabled
68
57
  To customize the configuration, update the following settings in Tutor:
69
58
 
70
59
  - `CODEJAIL_APPARMOR_DOCKER_IMAGE`: (default: `docker.io/ednxops/codejail_apparmor_loader:latest`)
71
- - `CODEJAIL_DOCKER_IMAGE_V2` : (default: `{{ CODEJAIL_DOCKER_IMAGE }}-v2`)
72
60
  - `CODEJAIL_DOCKER_IMAGE`: (default: `docker.io/ednxops/codejailservice:{{__version__}}`)
73
61
  - `CODEJAIL_ENABLE_K8S_DAEMONSET` (default: `False`)
74
- - `CODEJAIL_ENFORCE_APPARMOR` (default: `True`)
75
62
  - `CODEJAIL_EXTRA_PIP_REQUIREMENTS` (default: `[]`)
76
- - `CODEJAIL_SANDBOX_PYTHON_VERSION` (default: `3.11.9`)
77
- - `CODEJAIL_SERVICE_REPOSITORY` (default: `https://github.com/edunext/codejailservice.git`\`)
63
+ - `CODEJAIL_SANDBOX_PYTHON_VERSION` (default: `3.12`)
64
+ - `CODEJAIL_SERVICE_REPOSITORY` (default: `https://github.com/openedx/codejail-service.git`)
78
65
  - `CODEJAIL_SERVICE_VERSION` (default: `{{ OPENEDX_COMMON_VERSION }}`),
79
- - `CODEJAIL_SERVICE_V2_REPOSITORY`: (default: `https://github.com/openedx/codejail-service.git`)
80
- - `CODEJAIL_SERVICE_V2_VERSION`: (default: `{{ OPENEDX_COMMON_VERSION }}`)
81
- - `CODEJAIL_USE_SERVICE_V2`: (default: `False`)
82
-
83
- The `CODEJAIL_*_SERVICE_V2` settings are meant to be used only during the Ulmo
84
- release and will be phased-out during the Verawood release.
85
-
86
- To opt-in to the new implementation of the code-exec API set
87
- `CODEJAIL_USE_SERVICE_V2` to `True` and re-deploy your environment. If you are
88
- using a a custom image for the codejail service you will need to rebuild
89
- it with `CODEJAIL_USE_SERVICE_V2` set to `True`.
90
66
 
91
67
  ### Custom Image
92
68
 
93
69
  In most cases, you can work with the provided Docker image for the
94
- release. You will need to build a custom image if you either:
95
-
96
- - Need additional packages installed in the sandbox environment. Use the setting
97
- `CODEJAIL_EXTRA_PIP_REQUIREMENTS` to define the list of additional packages.
98
- - Need to run the sandbox environment under a different Python version. The
99
- default Python version of the sandbox might get updated between releases,
100
- potentially breaking instructor generated code. You can set
101
- `CODEJAIL_SANDBOX_PYTHON_VERSION` to an older version to avoid disruption
102
- while figuring out a migration plan.
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`.
103
89
 
104
90
  ## Kubernetes Support
105
91
 
@@ -115,10 +101,6 @@ and has successfully loaded the profile.
115
101
  You can enable a helper Daemon Set that will load the profile onto all the nodes
116
102
  by setting `CODEJAIL_ENABLE_K8S_DAEMONSET` to true.
117
103
 
118
- If you choose to run the service without enforcing the AppArmor profile
119
- (absolutely discouraged, and not possible on the newer implementation of
120
- codejail-service), you can set `CODEJAIL_ENFORCE_APPARMOR` to `False`.
121
-
122
104
  More info about this discussion can be found on [this
123
105
  issue](https://github.com/eduNEXT/tutor-contrib-codejail/issues/24).
124
106
 
@@ -138,8 +120,24 @@ width="725px"}
138
120
  In this case, the section\'s content will render correctly and work as
139
121
  specified in the instructions of the problem.
140
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
+
141
140
  ## License
142
141
 
143
142
  This software is licensed under the terms of the AGPLv3. See the LICENSE
144
143
  file for details.
145
-
@@ -7,17 +7,6 @@ This plugin configures and runs a remote CodeJail Service instance that
7
7
  implements the safe-exec API used by the Open edX platform to offer more
8
8
  advanced capabilities to course authors.
9
9
 
10
- Starting from the Ulmo release, the codejail plugin is transitioning to an
11
- alternative implementation of the safe-exec API (
12
- [Codejail Service V2](https://github.com/openedx/codejail-service)). You can
13
- opt-in to use this new implementation on Ulmo before it finally becomes the
14
- default on the Verawood release.
15
-
16
- > [!NOTE]
17
- > The new CodeJail Service implementation is based on Django instead of Flask,
18
- > therefore settings changed with the `codejail-*-settings` patches must be
19
- > adjusted accordingly.
20
-
21
10
  ## Installation
22
11
 
23
12
  To install the latest version, run:
@@ -47,38 +36,35 @@ aa-enabled
47
36
  To customize the configuration, update the following settings in Tutor:
48
37
 
49
38
  - `CODEJAIL_APPARMOR_DOCKER_IMAGE`: (default: `docker.io/ednxops/codejail_apparmor_loader:latest`)
50
- - `CODEJAIL_DOCKER_IMAGE_V2` : (default: `{{ CODEJAIL_DOCKER_IMAGE }}-v2`)
51
39
  - `CODEJAIL_DOCKER_IMAGE`: (default: `docker.io/ednxops/codejailservice:{{__version__}}`)
52
40
  - `CODEJAIL_ENABLE_K8S_DAEMONSET` (default: `False`)
53
- - `CODEJAIL_ENFORCE_APPARMOR` (default: `True`)
54
41
  - `CODEJAIL_EXTRA_PIP_REQUIREMENTS` (default: `[]`)
55
- - `CODEJAIL_SANDBOX_PYTHON_VERSION` (default: `3.11.9`)
56
- - `CODEJAIL_SERVICE_REPOSITORY` (default: `https://github.com/edunext/codejailservice.git`\`)
42
+ - `CODEJAIL_SANDBOX_PYTHON_VERSION` (default: `3.12`)
43
+ - `CODEJAIL_SERVICE_REPOSITORY` (default: `https://github.com/openedx/codejail-service.git`)
57
44
  - `CODEJAIL_SERVICE_VERSION` (default: `{{ OPENEDX_COMMON_VERSION }}`),
58
- - `CODEJAIL_SERVICE_V2_REPOSITORY`: (default: `https://github.com/openedx/codejail-service.git`)
59
- - `CODEJAIL_SERVICE_V2_VERSION`: (default: `{{ OPENEDX_COMMON_VERSION }}`)
60
- - `CODEJAIL_USE_SERVICE_V2`: (default: `False`)
61
-
62
- The `CODEJAIL_*_SERVICE_V2` settings are meant to be used only during the Ulmo
63
- release and will be phased-out during the Verawood release.
64
-
65
- To opt-in to the new implementation of the code-exec API set
66
- `CODEJAIL_USE_SERVICE_V2` to `True` and re-deploy your environment. If you are
67
- using a a custom image for the codejail service you will need to rebuild
68
- it with `CODEJAIL_USE_SERVICE_V2` set to `True`.
69
45
 
70
46
  ### Custom Image
71
47
 
72
48
  In most cases, you can work with the provided Docker image for the
73
- release. You will need to build a custom image if you either:
74
-
75
- - Need additional packages installed in the sandbox environment. Use the setting
76
- `CODEJAIL_EXTRA_PIP_REQUIREMENTS` to define the list of additional packages.
77
- - Need to run the sandbox environment under a different Python version. The
78
- default Python version of the sandbox might get updated between releases,
79
- potentially breaking instructor generated code. You can set
80
- `CODEJAIL_SANDBOX_PYTHON_VERSION` to an older version to avoid disruption
81
- while figuring out a migration plan.
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`.
82
68
 
83
69
  ## Kubernetes Support
84
70
 
@@ -94,10 +80,6 @@ and has successfully loaded the profile.
94
80
  You can enable a helper Daemon Set that will load the profile onto all the nodes
95
81
  by setting `CODEJAIL_ENABLE_K8S_DAEMONSET` to true.
96
82
 
97
- If you choose to run the service without enforcing the AppArmor profile
98
- (absolutely discouraged, and not possible on the newer implementation of
99
- codejail-service), you can set `CODEJAIL_ENFORCE_APPARMOR` to `False`.
100
-
101
83
  More info about this discussion can be found on [this
102
84
  issue](https://github.com/eduNEXT/tutor-contrib-codejail/issues/24).
103
85
 
@@ -117,8 +99,24 @@ width="725px"}
117
99
  In this case, the section\'s content will render correctly and work as
118
100
  specified in the instructions of the problem.
119
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
+
120
119
  ## License
121
120
 
122
121
  This software is licensed under the terms of the AGPLv3. See the LICENSE
123
122
  file for details.
124
-
@@ -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
+ ]
@@ -1,15 +1,15 @@
1
1
  [project]
2
2
  name = "tutor-contrib-codejail"
3
- version = "21.0.1"
3
+ version = "22.0.0"
4
4
  description = "Codejail plugin for Tutor"
5
5
  readme = "README.md"
6
- license-files = ["LICENSE"]
6
+ license-files = ["LICENSE"]
7
7
  authors = [
8
8
  { name = "eduNEXT" }
9
9
  ]
10
10
  requires-python = ">=3.10"
11
11
  dependencies = [
12
- "tutor~=21.0"
12
+ "tutor~=22.0"
13
13
  ]
14
14
  classifiers = [
15
15
  "Development Status :: 3 - Alpha",
@@ -35,7 +35,7 @@ module-root = "."
35
35
  module-name = "tutorcodejail"
36
36
 
37
37
  [build-system]
38
- requires = ["uv_build>=0.9.5,<0.12.0"]
38
+ requires = ["uv_build>=0.9.5,<0.13.0"]
39
39
  build-backend = "uv_build"
40
40
 
41
41
  [dependency-groups]
@@ -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
@@ -8,7 +8,6 @@ from pathlib import Path
8
8
 
9
9
  import importlib_resources
10
10
  from tutor import hooks
11
- from tutor.types import Config
12
11
 
13
12
  from .__about__ import __version__
14
13
 
@@ -21,18 +20,13 @@ config = {
21
20
  "defaults": {
22
21
  "APPARMOR_DOCKER_IMAGE": "docker.io/ednxops/codejail_apparmor_loader:apparmor-4",
23
22
  "DOCKER_IMAGE": f"docker.io/ednxops/codejailservice:{__version__}",
24
- "DOCKER_IMAGE_V2": "{{ CODEJAIL_DOCKER_IMAGE }}-v2",
25
23
  "ENABLE_K8S_DAEMONSET": False,
26
24
  "ENFORCE_APPARMOR": True,
27
25
  "EXTRA_PIP_REQUIREMENTS": [],
28
- "HOST": "codejailservice",
29
- "SANDBOX_PYTHON_VERSION": "3.11.14",
30
- "SERVICE_REPOSITORY": "https://github.com/edunext/codejailservice.git",
31
- "SERVICE_V2_REPOSITORY": "https://github.com/openedx/codejail-service.git",
32
- "SERVICE_V2_VERSION": "{{ OPENEDX_COMMON_VERSION }}",
26
+ "SANDBOX_PYTHON_VERSION": "3.12",
27
+ "SERVICE_REPOSITORY": "https://github.com/openedx/codejail-service.git",
33
28
  "SERVICE_VERSION": "{{ OPENEDX_COMMON_VERSION }}",
34
29
  "SKIP_INIT": False,
35
- "USE_SERVICE_V2": False,
36
30
  "VERSION": __version__,
37
31
  },
38
32
  "overrides": {},
@@ -71,60 +65,47 @@ hooks.Filters.ENV_TEMPLATE_VARIABLES.add_items(
71
65
  ]
72
66
  )
73
67
 
68
+ hooks.Filters.IMAGES_BUILD.add_item(
69
+ (
70
+ "codejail",
71
+ ("plugins", "codejail", "build", "codejail"),
72
+ "{{ CODEJAIL_DOCKER_IMAGE }}",
73
+ (),
74
+ ),
75
+ )
76
+ hooks.Filters.IMAGES_PULL.add_item(
77
+ (
78
+ "codejail",
79
+ "{{ CODEJAIL_DOCKER_IMAGE }}",
80
+ )
81
+ )
82
+ hooks.Filters.IMAGES_PUSH.add_item(
83
+ (
84
+ "codejail",
85
+ "{{ CODEJAIL_DOCKER_IMAGE }}",
86
+ )
87
+ )
74
88
 
75
- @hooks.Filters.IMAGES_BUILD.add()
76
- def _build_codejail_images(
77
- images: list[tuple[str, str | tuple[str, ...], str, tuple[str, ...]]],
78
- tutor_config: Config,
79
- ):
80
- """Choose the appropiate build context when using CODEJAIL_USE_SERVICE_V2."""
81
- # TODO: Remove after the Verawood update
82
- if tutor_config.get("CODEJAIL_USE_SERVICE_V2"):
83
- codejail_img = (
84
- "codejail",
85
- "plugins/codejail/build/codejail-service",
86
- "{{ CODEJAIL_DOCKER_IMAGE_V2 }}",
87
- (),
88
- )
89
- else:
90
- codejail_img = (
91
- "codejail",
92
- "plugins/codejail/build/codejail",
93
- "{{ CODEJAIL_DOCKER_IMAGE }}",
94
- (),
95
- )
96
- apparmor_img = (
89
+ hooks.Filters.IMAGES_BUILD.add_item(
90
+ (
97
91
  "codejail_apparmor",
98
92
  ("plugins", "codejail", "build", "codejail_apparmor"),
99
93
  "{{CODEJAIL_APPARMOR_DOCKER_IMAGE}}",
100
94
  (),
95
+ ),
96
+ )
97
+ hooks.Filters.IMAGES_PULL.add_item(
98
+ (
99
+ "codejail_apparmor",
100
+ "{{CODEJAIL_APPARMOR_DOCKER_IMAGE}}",
101
101
  )
102
-
103
- return images + [codejail_img, apparmor_img]
104
-
105
-
106
- @hooks.Filters.IMAGES_PUSH.add()
107
- def _push_codejail_images(
108
- images: list[tuple[str, str]],
109
- tutor_config: Config,
110
- ):
111
- """Choose the appropiate image tag when using CODEJAIL_USE_SERVICE_V2."""
112
- # TODO: Remove after the Verawood update
113
- if tutor_config.get("CODEJAIL_USE_SERVICE_V2"):
114
- codejail_img = (
115
- "codejail",
116
- "{{ CODEJAIL_DOCKER_IMAGE_V2 }}",
117
- )
118
- else:
119
- codejail_img = (
120
- "codejail",
121
- "{{ CODEJAIL_DOCKER_IMAGE }}",
122
- )
123
- apparmor_img = (
102
+ )
103
+ hooks.Filters.IMAGES_PUSH.add_item(
104
+ (
124
105
  "codejail_apparmor",
125
106
  "{{CODEJAIL_APPARMOR_DOCKER_IMAGE}}",
126
107
  )
127
- return images + [codejail_img, apparmor_img]
108
+ )
128
109
 
129
110
 
130
111
  # Boilerplate code
@@ -1,7 +1,7 @@
1
1
  from codejail_service.settings.local import * # pylint: disable=wildcard-import
2
2
 
3
3
  ALLOWED_HOSTS = [
4
- 'codejailservice',
4
+ 'codejail',
5
5
  'localhost',
6
6
  ]
7
7
 
@@ -1,20 +1,20 @@
1
1
  FROM scratch AS codejail-service-code
2
- ARG CODEJAIL_SERVICE_REPO={{ CODEJAIL_SERVICE_V2_REPOSITORY }}
3
- ARG CODEJAIL_SERVICE_VERSION={{ CODEJAIL_SERVICE_V2_VERSION }}
2
+ ARG CODEJAIL_SERVICE_REPO={{ CODEJAIL_SERVICE_REPOSITORY }}
3
+ ARG CODEJAIL_SERVICE_VERSION={{ CODEJAIL_SERVICE_VERSION }}
4
4
  ADD ${CODEJAIL_SERVICE_REPO}#${CODEJAIL_SERVICE_VERSION} /
5
5
 
6
6
  FROM scratch AS sandbox-dependencies
7
7
  # Where to get the Python dependencies lockfile for installing
8
8
  # packages into the sandbox environment. Defaults to the codejail
9
9
  # dependencies in edx-platform.
10
- ARG SANDBOX_DEPS_REPO={{ EDX_PLATFORM_REPOSITORY }}
11
- ARG SANDBOX_DEPS_VERSION={{ CODEJAIL_SERVICE_V2_VERSION }}
10
+ ARG SANDBOX_DEPS_REPO={{ CODEJAIL_SERVICE_REPOSITORY }}
11
+ ARG SANDBOX_DEPS_VERSION={{ CODEJAIL_SERVICE_VERSION }}
12
12
  # Path to the lockfile in the deps repo, as dir + filename.
13
13
  #
14
14
  # The path base.txt will get the latest dependencies, but this needs
15
15
  # to be coordinated with SANDBOX_PY_VER as each release has a
16
16
  # different Python support window.
17
- ARG SANDBOX_DEPS_SRC_DIR=requirements/edx-sandbox
17
+ ARG SANDBOX_DEPS_SRC_DIR=requirements/sandbox
18
18
  ADD ${SANDBOX_DEPS_REPO}#${SANDBOX_DEPS_VERSION}:${SANDBOX_DEPS_SRC_DIR} /
19
19
 
20
20
  FROM docker.io/ubuntu:24.04 AS app
@@ -31,7 +31,7 @@ ARG SANDBOX_DEPS_SRC_FILE=base.txt
31
31
 
32
32
  # Python version for sandboxed executions. This must be coordinated with
33
33
  # `SANDBOX_DEPS_SRC_*` to ensure compatibility.
34
- ARG SANDBOX_PY_VER={{ '.'.join(CODEJAIL_SANDBOX_PYTHON_VERSION.split('.')[:2]) }}
34
+ ARG SANDBOX_PY_VER={{ CODEJAIL_SANDBOX_PYTHON_VERSION }}
35
35
 
36
36
 
37
37
  ##### Base app installation #####
@@ -167,7 +167,7 @@ USER ${APP_USER}
167
167
  CMD [ "gunicorn", \
168
168
  "--config=/app/codejail_service/docker_gunicorn_configuration.py", \
169
169
  "--name=codejail-service", \
170
- "--bind=0.0.0.0:8550", \
170
+ "--bind=0.0.0.0:8000", \
171
171
  "--max-requests=1000", \
172
172
  "--log-file=-", \
173
173
  "codejail_service.wsgi:application" ]
@@ -1,14 +0,0 @@
1
- ---
2
- apiVersion: v1
3
- kind: Service
4
- metadata:
5
- name: codejailservice
6
- labels:
7
- app.kubernetes.io/name: codejailservice
8
- spec:
9
- type: ClusterIP
10
- ports:
11
- - port: 8550
12
- protocol: TCP
13
- selector:
14
- app.kubernetes.io/name: codejailservice
@@ -1,17 +0,0 @@
1
- - name: codejail-profile
2
- files:
3
- - plugins/codejail/apps/profiles/docker-edx-sandbox.profile
4
- - plugins/codejail/apps/profiles/openedx-codejail-service.profile
5
- options:
6
- labels:
7
- app.kubernetes.io/name: codejail-aa-loader
8
- - name: settings-codejail
9
- files:
10
- {% if CODEJAIL_USE_SERVICE_V2 %}
11
- - plugins/codejail/apps/codejail-service-v2/tutor.py
12
- {% else %}
13
- - plugins/codejail/apps/codejail/tutor.py
14
- {% endif %}
15
- options:
16
- labels:
17
- app.kubernetes.io/name: codejailservice
@@ -1,8 +0,0 @@
1
- codejailservice:
2
- command: flask run --host 0.0.0.0 --port 8550
3
- environment:
4
- FLASK_ENV: development
5
- FLASK_APP_SETTINGS: codejailservice.tutor.DevelopmentConfig
6
- ports:
7
- - "8550:8550"
8
- restart: unless-stopped
@@ -1,45 +0,0 @@
1
- #############Codejail service
2
- {% if CODEJAIL_USE_SERVICE_V2 %}
3
- codejailservice:
4
- image: {{ CODEJAIL_DOCKER_IMAGE_V2 }}
5
- ports:
6
- - 8550:8550
7
- environment:
8
- DJANGO_SETTINGS_MODULE: codejail_service.settings.tutor
9
- security_opt:
10
- - apparmor:openedx_codejail_service
11
- volumes:
12
- - ../plugins/codejail/apps/codejail-service-v2/tutor.py:/app/codejail_service/settings/tutor.py:ro
13
- restart: unless-stopped
14
- depends_on:
15
- codejail-apparmor-loader:
16
- condition: service_completed_successfully
17
- {% else %}
18
- codejailservice:
19
- image: {{ CODEJAIL_DOCKER_IMAGE }}
20
- environment:
21
- FLASK_APP_SETTINGS: codejailservice.tutor.ProductionConfig
22
- {% if CODEJAIL_ENFORCE_APPARMOR %}
23
- security_opt:
24
- - apparmor:docker-edx-sandbox
25
- {% endif %}
26
- volumes:
27
- - ../plugins/codejail/apps/codejail/tutor.py:/openedx/codejailservice/codejailservice/tutor.py:ro
28
- restart: unless-stopped
29
- depends_on:
30
- codejail-apparmor-loader:
31
- condition: service_completed_successfully
32
- {% endif %}
33
-
34
- codejail-apparmor-loader:
35
- image: {{ CODEJAIL_APPARMOR_DOCKER_IMAGE }}
36
- privileged: true
37
- command:
38
- - /usr/bin/loader
39
- - -logtostderr
40
- - -v=2
41
- - /profiles
42
- volumes:
43
- - ../plugins/codejail/apps/profiles/:/profiles/:ro
44
- - /sys:/sys
45
- - /etc/apparmor.d:/etc/apparmor.d
@@ -1,18 +0,0 @@
1
- """Module with the configuration of config classes."""
2
- from codejailservice.config import DevelopmentConfig, ProductionConfig
3
-
4
-
5
- class DevelopmentConfig(DevelopmentConfig):
6
- """Class to use for development context that inherits from DevelopmentConfig."""
7
-
8
- CODE_JAIL = DevelopmentConfig.CODE_JAIL
9
- {{patch("codejail-common-settings") | indent(4)}}
10
- {{patch("codejail-development-settings") | indent(4)}}
11
-
12
-
13
- class ProductionConfig(ProductionConfig):
14
- """Class to use for production context that inherits from ProductionConfig."""
15
-
16
- CODE_JAIL = ProductionConfig.CODE_JAIL
17
- {{patch("codejail-common-settings") | indent(4)}}
18
- {{patch("codejail-production-settings") | indent(4)}}
@@ -1,100 +0,0 @@
1
- FROM docker.io/ubuntu:22.04 AS minimal
2
- LABEL mantainer="edunext.co <contact@edunext.co>"
3
-
4
- ENV DEBIAN_FRONTEND=noninteractive
5
- RUN apt update && \
6
- apt install -y build-essential curl git language-pack-en llvm
7
- ENV LC_ALL=en_US.UTF-8
8
-
9
- ###### Install python with pyenv in /opt/pyenv and create virtualenv in /openedx/venv
10
- FROM minimal AS python
11
- # https://github.com/pyenv/pyenv/wiki/Common-build-problems#prerequisites
12
- RUN apt update && \
13
- apt install -y libssl-dev zlib1g-dev libbz2-dev \
14
- libreadline-dev libsqlite3-dev wget curl llvm libncurses5-dev libncursesw5-dev \
15
- xz-utils tk-dev libffi-dev liblzma-dev python3-openssl git subversion
16
- ENV PYENV_ROOT=/opt/pyenv
17
- RUN git clone https://github.com/pyenv/pyenv $PYENV_ROOT --branch v2.6.12 --depth 1
18
-
19
- ARG CODEJAILSERVICE_PYTHON_VERSION=3.11.14
20
- RUN $PYENV_ROOT/bin/pyenv install $CODEJAILSERVICE_PYTHON_VERSION
21
-
22
- ARG SANDBOX_PYTHON_VERSION="{{ CODEJAIL_SANDBOX_PYTHON_VERSION }}"
23
- RUN git clone https://github.com/esinker/pyenv-version-alias $PYENV_ROOT/plugins/pyenv-alias
24
- RUN VERSION_ALIAS="{{ CODEJAIL_SANDBOX_PYTHON_VERSION }}_sandbox" \
25
- $PYENV_ROOT/bin/pyenv install -f $SANDBOX_PYTHON_VERSION
26
-
27
- RUN "$PYENV_ROOT/versions/$CODEJAILSERVICE_PYTHON_VERSION/bin/python" -m venv /openedx/venv
28
- RUN "$PYENV_ROOT/versions/"$SANDBOX_PYTHON_VERSION"_sandbox/bin/python" -m venv --copies /sandbox/venv
29
-
30
- ###### Codejail service code
31
- FROM minimal AS code
32
- RUN git clone {{ CODEJAIL_SERVICE_REPOSITORY }} --branch {{ CODEJAIL_SERVICE_VERSION }} --depth 1 /openedx/codejailservice
33
- WORKDIR /openedx/codejailservice
34
-
35
- ###### Install python requirements in virtualenv
36
- FROM python AS codejailservice-python-requirements
37
-
38
- ENV PATH=/openedx/venv/bin:${PATH}
39
- ENV VIRTUAL_ENV=/openedx/venv/
40
-
41
- COPY --from=code /openedx/codejailservice /openedx/codejailservice
42
- WORKDIR /openedx/codejailservice
43
- RUN pip3 install -r requirements/base.txt
44
- RUN pip3 install uwsgi==2.0.21
45
-
46
- ###### Install python requirements in virtualenv
47
- FROM python AS sandbox-python-requirements
48
-
49
- ARG EDX_PLATFORM_REPOSITORY={{ EDX_PLATFORM_REPOSITORY }}
50
- ARG EDX_PLATFORM_VERSION={{ EDX_PLATFORM_VERSION }}
51
-
52
- ENV PATH=/sandbox/venv/bin:${PATH}
53
- ENV VIRTUAL_ENV=/sandbox/venv/
54
-
55
- WORKDIR /var/tmp
56
- RUN mkdir -p common/lib/
57
-
58
- ADD $EDX_PLATFORM_REPOSITORY#$EDX_PLATFORM_VERSION:requirements/edx-sandbox/ .
59
- RUN pip3 install -r base.txt
60
-
61
- {% if CODEJAIL_EXTRA_PIP_REQUIREMENTS %}
62
- # Allows you to add extra pip requirements to your codejail sandbox.
63
- RUN --mount=type=cache,target=/openedx/.cache/pip,sharing=shared pip install \
64
- {%- for extra_requirements in CODEJAIL_EXTRA_PIP_REQUIREMENTS %}
65
- '{{ extra_requirements }}' \
66
- {%- endfor %}
67
- ;
68
- {% endif %}
69
-
70
- ##### Prod image
71
- FROM minimal AS production
72
-
73
- # Install system requirements
74
- RUN apt update && \
75
- apt install -y sudo
76
-
77
- COPY --from=code /openedx/codejailservice /openedx/codejailservice
78
- COPY --from=python /opt/pyenv /opt/pyenv
79
- COPY --from=codejailservice-python-requirements /openedx/venv /openedx/venv
80
- COPY --from=sandbox-python-requirements /sandbox/venv /sandbox/venv
81
-
82
- # Setup sandbox
83
- ENV SANDBOX_ENV=/sandbox/venv
84
- RUN groupadd -r sandbox && useradd -m -r -g sandbox sandbox && chown -R sandbox:sandbox /sandbox
85
-
86
- ENV PATH=/openedx/venv/bin:${PATH}
87
- ENV VIRTUAL_ENV=/openedx/venv/
88
- ENV UWSGI_WORKERS=2
89
- WORKDIR /openedx/codejailservice
90
-
91
- EXPOSE 8550
92
-
93
- CMD [ "uwsgi", \
94
- "--http=0.0.0.0:8550", \
95
- "--thunder-lock", \
96
- "--single-interpreter", \
97
- "--enable-threads", \
98
- "--buffer-size=8192", \
99
- "--max-requests=1000", \
100
- "--wsgi-file=/openedx/codejailservice/wsgi.py" ]