eduNEXT codejail install error

I’ve tried to install codejail from eduNEXT but failed. The main branch tutor-contrib-codejail is void (just README.rst). Manually downloading and installing from eric/mvp branch didn’t worked. Python installation seems to be ok but the plugin is not listed using tutor plugins list.

Hi @j3parera, I’ve been working on the tutor codejail plugin so I am happy that you are trying it and I can help you to set it up. That plugin is still a WIP, so you might find some issues that I would be happy to solve. Could you please let me know which steps did you follow to install the plugin ? I posted in an edx PR a set of instructions that can help you to setup a Tutor installation with codejail. You can find them here Optionally run Codejail in a external service using REST API. by ericfab179 · Pull Request #27795 · edx/edx-platform · GitHub
Please let me know if that set of instructions work for you or if you find any bug.

Hi Eric,
Thank for your your answer and for your invaluable work. I’ve been using openedx since 2010 in my own server and never was so easy to install and maintain.
But recently I discovered that the Python edX problems didn’t work so I’ve search for a solution in discuss. In the topic [[Errno 2] No such file or directory: ‘TMPDIR=tmp] the issue is explained and the last Regis’s answer before closing it points to https://github.com/eduNEXT/codejailservice/pull/2. As it is a pull request I’ve navigated to the top of the project but it is empty. I’ve search in eduNEXT for another related project and found https://github.com/eduNEXT/tutor-contrib-codejail in which there are installation instructions: pip install git+https://github.com/edunext/tutor-contrib-codejail then tutor plugins enable codejail but again the project is empty. I’ve tried to download and install the eric\mvp branch in the repository and doing a local pip install but it didn’t work.
I’m a bit in a hurry because I’m using Tutor in several internal courses al the Polythecnic University of Madrid and I have a lot of problems written in Python. So I’ve not looked for other posts and just ask the community.
With the info you provide in the post is not quite clear for me if it is suitable for a “production” site assuming, of couse, that is WIP. If the answer is yes, the install procedure will be from writing the settings: tutor config save ... up to tutor local init .... Isn’t it? Beside that I’m not sure if all the settings are needed.
Thank you in advance.

I would say that it is not “production ready” yet but I hope it will be soon. First we would need to merge this PR https://github.com/edx/edx-platform/pull/27795#issuecomment-904795672 , so the edx-platform version that you run would be compatible with the external codejail service and the tutor codejail plugin. In the meantime your help testing it, in dev or staging environments (using the instructions that I provided in the PR) would be useful since you can give us feedback so we can fix issues before moving forward.

Hi Eric,
I’ve followed the instructions but it didn’t work. I had a tutor server running version 11.2.1 so I’ve upgraded it to the last 12.1.3. Then I’ve followed step by step your procedure. When trying to start tutor at step tutor local quickstart -I I get the following error:
ERROR: for codejailservice Cannot start service codejailservice: OCI runtime create failed: container_linux.go:380: starting container process caused: process_linux.go:545: container init caused: apply apparmor profile: apparmor failed to apply profile: write /proc/self/attr/apparmor/exec: no such file or directory: unknown ERROR: Encountered errors while bringing up the project. Error: Command failed with status 1: docker-compose -f /home/administrador/.local/share/tutor/env/local/docker-compose.yml -f /home/administrador/.local/share/tutor/env/local/docker-compose.prod.yml --project-name tutor_local up --remove-orphans -d

Beside this the old tutor complain of a version mismatch. So I’ve removed all and start over. This time there was no conflict but it didn’t work either. I will try to see why.

Hi Eric,
I’ve removed all stuff including docker containers and images and IT WORKS. At least using dev. I’m going to try in a production environment and I’ll tell you.
Thanks

Eric,
Ok. So I’ve installed the plugin in a fresh tutor 12.1.2 environment. Everything seems ok. When started the server says:

...
Starting tutor_local_smtp_1            ... done
Starting tutor_local_codejailservice_1 ... done
Starting tutor_local_elasticsearch_1   ... done
...

so I interpret that the codejailservice is started and running. But when I try to create a custom Python problem:

Error formatting HTML for problem:

cannot create LoncapaProblem ...: Error while executing script code: Codejail API Service is unavailable. Please try again in a few minutes.

I’ll keep this server available. Please ask me if you need some more details.
Thanks again

@j3parera Sorry for the late reply. I addressed some comments and fixed some issues that I found with the plugin and with the integration with edx-platform. Could you please give it a try again but using these variables instead:

tutor config save \
--set DOCKER_IMAGE_OPENEDX=docker.io/ednxops/edxapp:tutor.lilac.2ade0549badbd264497cb144041a0a56e1d32170\
--set DOCKER_IMAGE_OPENEDX_DEV=docker.io/ednxops/edxapp:tutor.lilac.dev.2ade0549badbd264497cb144041a0a56e1d32170 \
--set EDX_PLATFORM_REPOSITORY=https://github.com/eduNEXT/edx-platform.git \
--set EDX_PLATFORM_VERSION=ednx/lilac-codejailservice \
--set SANDBOX_PYTHON_VERSION=3.5.10

I used Tutor v12.1.3 and you can follow same instructions as given here #27795 (comment)
Please also let me know if you find more issues. Thanks.

Hi Eric,
I’ve tried the new settings after upgrading tutor to v12.1.3 and get the following error while doing the database migration:

  File "./manage.py", line 123, in <module>
    execute_from_command_line([sys.argv[0]] + django_args)
  File "/openedx/venv/lib/python3.8/site-packages/django/core/management/__init__.py", line 381, in execute_from_command_line
    utility.execute()
  File "/openedx/venv/lib/python3.8/site-packages/django/core/management/__init__.py", line 375, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/openedx/venv/lib/python3.8/site-packages/django/core/management/base.py", line 323, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/openedx/venv/lib/python3.8/site-packages/django/core/management/base.py", line 364, in execute
    output = self.handle(*args, **options)
  File "/openedx/venv/lib/python3.8/site-packages/django/core/management/base.py", line 83, in wrapped
    res = handle_func(*args, **kwargs)
  File "/openedx/venv/lib/python3.8/site-packages/django/core/management/commands/migrate.py", line 190, in handle
    pre_migrate_state = executor._create_project_state(with_applied_migrations=True)
  File "/openedx/venv/lib/python3.8/site-packages/django/db/migrations/executor.py", line 79, in _create_project_state
    migration.mutate_state(state, preserve=False)
  File "/openedx/venv/lib/python3.8/site-packages/django/db/migrations/migration.py", line 87, in mutate_state
    operation.state_forwards(self.app_label, new_state)
  File "/openedx/venv/lib/python3.8/site-packages/django/db/migrations/operations/fields.py", line 98, in state_forwards
    state.models[app_label, self.model_name_lower].fields.append((self.name, field))
KeyError: ('enterprise', 'enterprisecustomer')
ERROR: 1
Error: Command failed with status 1: docker-compose -f /home/administrador/.local/share/tutor/env/local/docker-compose.yml -f /home/administrador/.local/share/tutor/env/local/docker-compose.prod.yml --project-name tutor_local -f /home/administrador/.local/share/tutor/env/local/docker-compose.jobs.yml run --rm lms-job sh -e -c dockerize -wait tcp://mysql:3306 -timeout 20s

echo "Loading settings $DJANGO_SETTINGS_MODULE"

./manage.py lms migrate

# Fix incorrect uploaded file path
if [ -d /openedx/data/uploads/ ]; then
  if [ -n "$(ls -A /openedx/data/uploads/)" ]; then
    echo "Migrating LMS uploaded files to shared directory"
    mv /openedx/data/uploads/* /openedx/media/
    rm -rf /openedx/data/uploads/
  fi
fi

# Create waffle switches to enable some features, if they have not been explicitly defined before
# Completion tracking: add green ticks to every completed unit
(./manage.py lms waffle_switch --list | grep completion.enable_completion_tracking) || ./manage.py lms waffle_switch --create completion.enable_completion_tracking on

I’m not sure if this is related to codejail but I don’t know how to handle it. In my test envirnoment I could delete all and start all over, but in my production server I will need to upgrade. Any suggestions? Thanks.

@j3parera which Tutor version are you using in production ? If you are using a version lower than 12 then you might need to upgrade your platform Install Tutor — Tutor documentation. However you can try the plugin with the current version of Tutor that you are using and see if that give you any errors.

The production server runs v12.0.2. I’ve tried to install codejail in the test environment with same version but it doesn’t recognize the codejail plugin. It not appears when using tutor plugins list. Do you know what’s the minimum version for the plugin to be recognized? To be honest, I’m a bit afraid about upgrading the production server. I’m using it for my classes.