Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error while Migrating the data #630

Closed
Harshgaur14 opened this issue Apr 8, 2022 · 1 comment
Closed

Error while Migrating the data #630

Harshgaur14 opened this issue Apr 8, 2022 · 1 comment

Comments

@Harshgaur14
Copy link

After taking the backup of tutor from one server to another server(both servers Ubuntu 20.04 and same Tutor version 13.1.8) using the cut copy method of the folder it is showing this error while running the tutor local quickstart
moved the backup to $(tutor config printroot) includes /data,/volumes,config.xml files.
Error:1 occurs output as
Error: Command failed with status 1: docker-compose -f /root/.local/share/tutor/env/local/docker-compose.yml -f /root/.local/share/tutor/env/local/docker-compose.prod.yml --project-name tutor_local -f /root/.local/share/tutor/env/local/docker-compose.jobs.yml run --rm lms-job sh -e -c dockerize -wait tcp://mysql:3306 -timeout 20s
i have paste the error code please help me to get out of this error on migrating data(restoring backup)


==================================================
        Interactive platform configuration
==================================================
Are you configuring a production platform? Type 'n' if you are just testing Tutor on your local computer [y/N] As you are not running this platform in production, we automatically set the following configuration values:
    LMS_HOST = local.overhang.io
    CMS_HOST = studio.local.overhang.io
    ENABLE_HTTPS = False
Your platform name/title [CDAC CyberGYAN] Your public contact email address [contact@local.overhang.io] The default language code for the platform [en] Configuration saved to /root/.local/share/tutor/config.yml
Environment generated in /root/.local/share/tutor/env
==============================================
        Stopping any existing platform
==============================================
docker-compose -f /root/.local/share/tutor/env/local/docker-compose.yml -f /root/.local/share/tutor/env/local/docker-compose.prod.yml --project-name tutor_local stop
====================================
        Docker image updates
====================================
docker-compose -f /root/.local/share/tutor/env/local/docker-compose.yml -f /root/.local/share/tutor/env/local/docker-compose.prod.yml --project-name tutor_local pull
======================================================
        Starting the platform in detached mode
======================================================
docker-compose -f /root/.local/share/tutor/env/local/docker-compose.yml -f /root/.local/share/tutor/env/local/docker-compose.prod.yml --project-name tutor_local up --remove-orphans --build -d
================================================
        Database creation and migrations
================================================
Initialising all services...
Initialising mysql...
docker-compose -f /root/.local/share/tutor/env/local/docker-compose.yml -f /root/.local/share/tutor/env/local/docker-compose.prod.yml --project-name tutor_local -f /root/.local/share/tutor/env/local/docker-compose.jobs.yml run --rm mysql-job sh -e -c echo "Initialising MySQL..."
mysql_connection_max_attempts=10
mysql_connection_attempt=0
until mysql -u root --password="Bsu9Tqb9" --host "mysql" --port 3306 -e 'exit'
do
    mysql_connection_attempt=$(expr $mysql_connection_attempt + 1)
    echo "    [$mysql_connection_attempt/$mysql_connection_max_attempts] Waiting for MySQL service (this may take a while)..."
    if [ $mysql_connection_attempt -eq $mysql_connection_max_attempts ]
    then
      echo "MySQL initialisation error" 1>&2
      exit 1
    fi
    sleep 10
done
echo "MySQL is up and running"

# edx-platform database
mysql -u root --password="Bsu9Tqb9" --host "mysql" --port 3306 -e 'CREATE DATABASE IF NOT EXISTS openedx;'
mysql -u root --password="Bsu9Tqb9" --host "mysql" --port 3306 -e 'GRANT ALL ON openedx.* TO "openedx"@"%" IDENTIFIED BY "ScnNLgiI";'
Initialising MySQL...
mysql: [Warning] Using a password on the command line interface can be insecure.
MySQL is up and running
mysql: [Warning] Using a password on the command line interface can be insecure.
mysql: [Warning] Using a password on the command line interface can be insecure.
Initialising lms...
docker-compose -f /root/.local/share/tutor/env/local/docker-compose.yml -f /root/.local/share/tutor/env/local/docker-compose.prod.yml --project-name tutor_local -f /root/.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

# 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 "http://studio.local.overhang.io/complete/edx-oauth2/" \
  --client-id cms-sso \
  --client-secret 0n5ApGMbQXVCs2LsdD8UnT0W \
  --scopes user_id \
  --skip-authorization \
  --update cms-sso cms
./manage.py lms create_dot_application \
  --grant-type authorization-code \
  --redirect-uris "http://studio.local.overhang.io:8001/complete/edx-oauth2/" \
  --client-id cms-sso-dev \
  --client-secret 0n5ApGMbQXVCs2LsdD8UnT0W \
  --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
2022/04/08 12:38:34 Ready: tcp://mysql:3306.
Loading settings lms.envs.tutor.production
2022-04-08 12:38:39,588 WARNING 13 [py.warnings] [user None] [ip None] warnings.py:109 - /openedx/venv/lib/python3.8/site-packages/boto/plugin.py:40: DeprecationWarning: the imp module is deprecated in favour of importlib; see the module's documentation for alternative uses
  import imp

2022-04-08 12:38:39,690 WARNING 13 [py.warnings] [user None] [ip None] warnings.py:109 - /openedx/venv/lib/python3.8/site-packages/botocore/vendored/requests/packages/urllib3/_collections.py:1: DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated since Python 3.3, and in 3.10 it will stop working
  from collections import Mapping, MutableMapping

2022-04-08 12:38:40,766 WARNING 13 [py.warnings] [user None] [ip None] warnings.py:109 - /openedx/venv/lib/python3.8/site-packages/storages/backends/s3boto.py:41: DeprecationWarning: The S3BotoStorage backend is deprecated in favor of the S3Boto3Storage backend and will be removed in django-storages 1.8. This backend is mostly in bugfix only mode and has been for quite a while (in much the same way as its underlying library 'boto'). For performance, security and new feature reasons it is _strongly_ recommended that you update to the S3Boto3Storage backend. Please see the migration docs https://django-storages.readthedocs.io/en/latest/backends/amazon-S3.html#migrating-boto-to-boto3.
  warnings.warn(

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.12/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/lms/djangoapps/bulk_email/models.py", line 19, in <module>
    from openedx.core.djangoapps.course_groups.cohorts import get_cohort_by_name
  File "/openedx/edx-platform/openedx/core/djangoapps/course_groups/cohorts.py", line 21, in <module>
    from lms.djangoapps.courseware import courses
  File "/openedx/edx-platform/lms/djangoapps/courseware/courses.py", line 61, in <module>
    from openedx.features.course_experience.utils import is_block_structure_complete_for_assignments
  File "/openedx/edx-platform/openedx/features/course_experience/utils.py", line 8, in <module>
    from lms.djangoapps.course_api.blocks.api import get_blocks
  File "/openedx/edx-platform/lms/djangoapps/course_api/blocks/api.py", line 10, in <module>
    from openedx.features.effort_estimation.api import EffortEstimationTransformer
  File "/openedx/edx-platform/openedx/features/effort_estimation/api.py", line 7, in <module>
    from .block_transformers import EffortEstimationTransformer
  File "/openedx/edx-platform/openedx/features/effort_estimation/block_transformers.py", line 11, in <module>
    from edxval.api import get_videos_for_course
  File "/openedx/venv/lib/python3.8/site-packages/edxval/api.py", line 31, in <module>
    from edxval.models import (
  File "/openedx/venv/lib/python3.8/site-packages/edxval/models.py", line 300, in <module>
    class VideoImage(TimeStampedModel):
  File "/openedx/venv/lib/python3.8/site-packages/edxval/models.py", line 305, in VideoImage
    image = CustomizableImageField()
  File "/openedx/venv/lib/python3.8/site-packages/edxval/models.py", line 213, in __init__
    storage=get_video_image_storage(),
  File "/openedx/venv/lib/python3.8/site-packages/edxval/utils.py", line 158, in get_video_image_storage
    return get_storage_class(
  File "/openedx/venv/lib/python3.8/site-packages/storages/backends/s3boto.py", line 253, in __init__
    check_location(self)
  File "/openedx/venv/lib/python3.8/site-packages/storages/utils.py", line 84, in check_location
    raise ImproperlyConfigured(
django.core.exceptions.ImproperlyConfigured: S3BotoStorage.location cannot begin with a leading slash. Found '/openedx/media/'. Use 'openedx/media/' instead.
1. ERROR: 1

2. Error: Command failed with status 1: docker-compose -f /root/.local/share/tutor/env/local/docker-compose.yml -f /root/.local/share/tutor/env/local/docker-compose.prod.yml --project-name tutor_local -f /root/.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

* # Create oauth2 apps for CMS SSO

3. # https://github.com/openedx/edx-platform/blob/master/docs/guides/studio_oauth.rst

4. ./manage.py lms manage_user cms cms@openedx --unusable-password

5. ./manage.py lms create_dot_application \

6. --grant-type authorization-code \

7. --redirect-uris "http://studio.local.overhang.io/complete/edx-oauth2/" \

8. --client-id cms-sso \

9. --client-secret 0n5ApGMbQXVCs2LsdD8UnT0W \

10. --scopes user_id \

11. --skip-authorization \

12. --update cms-sso cms

13. ./manage.py lms create_dot_application \

14. --grant-type authorization-code \

15. --redirect-uris "http://studio.local.overhang.io:8001/complete/edx-oauth2/" \

16. --client-id cms-sso-dev \

17. --client-secret 0n5ApGMbQXVCs2LsdD8UnT0W \

18. --scopes user_id \

19. --skip-authorization \

20. --update cms-sso-dev cms

* # Fix incorrect uploaded file path

21. if [ -d /openedx/data/uploads/ ]; then

22. if [ -n "$(ls -A /openedx/data/uploads/)" ]; then

23. echo "Migrating LMS uploaded files to shared directory"

24. mv /openedx/data/uploads/* /openedx/media/

25. rm -rf /openedx/data/uploads/

26. fi

27. fi

* # Create waffle switches to enable some features, if they have not been explicitly defined before

28. # Completion tracking: add green ticks to every completed unit

29. (./manage.py lms waffle_switch --list | grep completion.enable_completion_tracking) || ./manage.py lms waffle_switch --create completion.enable_completion_tracking on

Ignores Line Numbers after Error: 1

@regisb
Copy link
Contributor

regisb commented Apr 12, 2022

Please don't use Github issues for feature requests or for support. Instead, you should create a new topic in the official Tutor forums: https://discuss.overhang.io.

The process for troubleshooting an existing installation and for contributing to the platform is described in the docs:
https://docs.tutor.overhang.io/troubleshooting.html
https://docs.tutor.overhang.io/tutor.html#contributing

@regisb regisb closed this as completed Apr 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants