Upgrading tutor to Palm

Just doing this as-is didn’t work, as it seemed to still be trying to go to mongodb 4.4. However, when I reverted the VM and started again, I did see it transition through 4.2, and it did complete the upgrade. (Don’t forget when you’re writing up upgrade instructions that you’re going to have to tell people to manually upgrade their Docker to versions not necessarily supported by their OS package manager.)

Now there’s a new error on launch:

  File "/openedx/edx-platform/common/djangoapps/course_modes/models.py", line 186, in CourseMode
    settings.COURSE_MODE_DEFAULTS['android_sku'],
KeyError: 'android_sku'

Full error:

[+] Running 1/1
 ✔ Container tutor_local-permissions-1  Started                                                                                                                                                                                                        0.3s 
[+] Building 0.0s (0/0)                                                                                                                                                                                                                                     
2023/06/07 17:14:27 Ready: tcp://mysql:3306.
2023/06/07 17:14:27 Ready: tcp://mongodb:27017.
Loading settings lms.envs.tutor.production
Traceback (most recent call last):
  File "./manage.py", line 103, in <module>
    startup.run()
  File "/openedx/edx-platform/lms/startup.py", line 20, in run
    django.setup()
  File "/openedx/venv/lib/python3.8/site-packages/django/__init__.py", line 24, in setup
    apps.populate(settings.INSTALLED_APPS)
  File "/openedx/venv/lib/python3.8/site-packages/django/apps/registry.py", line 114, in populate
    app_config.import_models()
  File "/openedx/venv/lib/python3.8/site-packages/django/apps/config.py", line 301, in import_models
    self.models_module = import_module(models_module_name)
  File "/opt/pyenv/versions/3.8.15/lib/python3.8/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 843, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/openedx/edx-platform/common/djangoapps/student/models/__init__.py", line 4, in <module>
    from .course_enrollment import *
  File "/openedx/edx-platform/common/djangoapps/student/models/course_enrollment.py", line 36, in <module>
    from common.djangoapps.course_modes.models import CourseMode, get_cosmetic_verified_display_price
  File "/openedx/edx-platform/common/djangoapps/course_modes/models.py", line 44, in <module>
    class CourseMode(models.Model):
  File "/openedx/edx-platform/common/djangoapps/course_modes/models.py", line 186, in CourseMode
    settings.COURSE_MODE_DEFAULTS['android_sku'],
KeyError: 'android_sku'
Error: Command failed with status 1: docker compose -f /home/ubuntu/.local/share/tutor/env/local/docker-compose.yml -f /home/ubuntu/.local/share/tutor/env/local/docker-compose.prod.yml --project-name tutor_local -f /home/ubuntu/.local/share/tutor/env/local/docker-compose.jobs.yml run --rm lms-job sh -e -c dockerize -wait tcp://mysql:3306 -timeout 20s
dockerize -wait tcp://mongodb:27017 -timeout 20s

echo "Loading settings $DJANGO_SETTINGS_MODULE"

./manage.py lms migrate

# Create oauth2 apps for CMS SSO
# https://github.com/openedx/edx-platform/blob/master/docs/guides/studio_oauth.rst
./manage.py lms manage_user cms cms@openedx --unusable-password
./manage.py lms create_dot_application \
  --grant-type authorization-code \
  --redirect-uris "https://studio.test.mysite.com/complete/edx-oauth2/" \
  --client-id cms-sso \
  --client-secret zcJcEOetznLHyjT2nBxIifPU \
  --scopes user_id \
  --skip-authorization \
  --update cms-sso cms
./manage.py lms create_dot_application \
  --grant-type authorization-code \
  --redirect-uris "http://studio.test.mysite.com:8001/complete/edx-oauth2/" \
  --client-id cms-sso-dev \
  --client-secret zcJcEOetznLHyjT2nBxIifPU \
  --scopes user_id \
  --skip-authorization \
  --update cms-sso-dev cms


# 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 don’t have the android plugin enabled FWIW.)


Speaking of plugins, tutor plugins update still doesn’t get me v16 versions of plugins, they’re all at 15

ubuntu@ip-172-31-18-14:~$ tutor plugins update
Error applying action: func=<function discover_package.<locals>.load at 0x7fd52011ab90> contexts=['plugins']'
⚠️  Failed to enable plugin 'forum': (tutor 16.0.0 (/home/ubuntu/.local/lib/python3.10/site-packages), Requirement.parse('tutor<16.0.0,>=15.0.0'))
Error applying action: func=<function discover_package.<locals>.load at 0x7fd52011b760> contexts=['plugins']'
⚠️  Failed to enable plugin 'indigo_mine': (tutor 16.0.0 (/home/ubuntu/.local/lib/python3.10/site-packages), Requirement.parse('tutor<16.0.0,>=15.0.0'))
Error applying action: func=<function discover_package.<locals>.load at 0x7fd52011ad40> contexts=['plugins']'
⚠️  Failed to enable plugin 'license': (tutor 16.0.0 (/home/ubuntu/.local/lib/python3.10/site-packages), Requirement.parse('tutor<16.0.0,>=15.0.0'))
Error applying action: func=<function discover_package.<locals>.load at 0x7fd52011aef0> contexts=['plugins']'
⚠️  Failed to enable plugin 'mfe': (tutor 16.0.0 (/home/ubuntu/.local/lib/python3.10/site-packages), Requirement.parse('tutor<16.0.0,>=15.0.0'))
Fetching index https://overhang.io/tutor/main/palm/plugins.yml...
  Failed to update index. Request error: HTTP Error 404: Not Found
Plugin index local cache: /home/ubuntu/.local/share/tutor/env/plugins/index/cache.yml
1 Like