Skip to content

Commit 116f122

Browse files
committed
fix: Run codejail with app user; more docs
- Use `app` user by default; may need to switch back to `root` at some point for ease of development, but for now let's try to keep it as similar as possible to stage and prod so that we can find issues sooner. - Document the situation, and note how to enter as root (same as for any container, but may be helpful in this uncommon situation). - Correct comment for `FSIZE` - Copy `NPROC` and `PROXY` defaults into settings for reference This depends on edx/edx-arch-experiments#983, otherwise the service will start failing.
1 parent 00e5a8f commit 116f122

3 files changed

Lines changed: 8 additions & 1 deletion

File tree

docker-compose.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -731,6 +731,7 @@ services:
731731
DJANGO_SETTINGS_MODULE: codejail_service.settings.devstack
732732
ports:
733733
- "18030:8080"
734+
user: app
734735
security_opt:
735736
- apparmor=openedx_codejail_service
736737

docs/codejail.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,3 +42,5 @@ Debugging
4242
To check whether the profile has been applied, run ``sudo aa-status | grep codejail``. This won't tell you if the profile is out of date, but it will tell you if you have *some* version of it installed.
4343

4444
If you need to debug the confinement, either because it is restricting too much or too little, a good strategy is to run ``tail -F /var/log/kern.log | grep codejail`` and watch for ``DENIED`` lines. You should expect to see several appear during service startup, as the service is designed to probe the confinement as part of its initial healthcheck.
45+
46+
Unlike other devstack services, this one runs as the ``app`` user rather than as ``root``. In order to enter the container as root, you can use ``docker compose exec -it --user root codejail bash`` rather than ``make codejail-shell``.

py_configuration_files/codejail.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,11 @@
2626
# Need at least 300 MiB memory for matplotlib alone. 512 MiB should be
2727
# enough headroom in general.
2828
'VMEM': 512 * 1024 * 1024,
29-
# 1 MB file write limit
29+
# 1 MB file size limit
3030
'FSIZE': 1 * 1024 * 1024,
31+
# 15 processes and threads (codejail default)
32+
'NPROC': 15,
33+
# Match production configuration
34+
'PROXY': 0,
3135
},
3236
}

0 commit comments

Comments
 (0)