Skip to content

Conversation

@wesleyboar
Copy link
Member

@wesleyboar wesleyboar commented Apr 9, 2025

Overview

Document the workaround for when CMS migration fails on a new Core-CMS.

Warning

Unnecessary if using new CMS after TACC/Core-CMS#932 is merged.

Related

Changes

  • adds documentation hint

Testing

Documentation

https://github.com/TACC/Core-Portal/blob/docs/core-cms-931-workaround-cms-migrate-fail/README.md#initialize-the-cms-in-the-core_portal_cms-container

Workaround

  1. Delete all Docker containers, volumes, builds relevant to Core-CMS.
  2. Follow README to create new Portal isntance.
  3. When instructed, in the CMS container, run python3 manage.py migrate.
  4. Then, in the CMS container, run:
    • python3 manage.py createsuperuser
    • python3 manage.py migrate

UI

Documentation

core-portal-1096-readme

Workaround
docker exec -it core_portal_cms /bin/bash
root@b8ef2d5d194f:/code# python3 manage.py migrate
Operations to perform:
  Apply all migrations: admin, auth, bootstrap4_alerts, bootstrap4_badge, bootstrap4_card, bootstrap4_carousel, bootstrap4_collapse, bootstrap4_content, bootstrap4_grid, bootstrap4_jumbotron, bootstrap4_link, bootstrap4_listgroup, bootstrap4_media, bootstrap4_picture, bootstrap4_tabs, bootstrap4_utilities, cms, contenttypes, djangocms_column, djangocms_file, djangocms_forms, djangocms_googlemap, djangocms_icon, djangocms_link, djangocms_page_meta, djangocms_picture, djangocms_snippet, djangocms_style, djangocms_text_ckeditor, djangocms_video, easy_thumbnails, filer, menus, sessions, sites, taccsite_blockquote, taccsite_callout, taccsite_cms, taccsite_data_list, taccsite_offset, taccsite_sample, taccsite_system_monitor, taccsite_system_specs
Running migrations:
  Applying contenttypes.0001_initial... OK
  Applying auth.0001_initial... OK
  […]
  Applying taccsite_callout.0002_auto_20210928_1717... OK
  Applying taccsite_callout.0003_remove_taccsitecallout_resize_figure_to_fit... OK
  Applying taccsite_cms.0001_add_groups...Traceback (most recent call last):
  File "/code/manage.py", line 22, in <module>
    execute_from_command_line(sys.argv)
  File "/usr/local/lib/python3.11/site-packages/django/core/management/__init__.py", line 442, in execute_from_command_line
    utility.execute()
  File "/usr/local/lib/python3.11/site-packages/django/core/management/__init__.py", line 436, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/usr/local/lib/python3.11/site-packages/django/core/management/base.py", line 412, in run_from_argv
    self.execute(*args, **cmd_options)
  […]
  File "/usr/local/lib/python3.11/site-packages/django/db/models/manager.py", line 87, in manager_method
    return getattr(self.get_queryset(), name)(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/django/db/models/query.py", line 637, in get
    raise self.model.DoesNotExist(
django.contrib.auth.models.Permission.DoesNotExist: Permission matching query does not exist.
root@b8ef2d5d194f:/code# ./manage.py migrate taccsite_cms zero
Operations to perform:
  Unapply all migrations: taccsite_cms
Running migrations:
  No migrations to apply.
  Your models in app(s): 'bootstrap4_alerts', 'bootstrap4_badge', 'bootstrap4_card', 'bootstrap4_carousel', 'bootstrap4_collapse', 'bootstrap4_content', 'bootstrap4_grid', 'bootstrap4_jumbotron', 'bootstrap4_link', 'bootstrap4_listgroup', 'bootstrap4_media', 'bootstrap4_picture', 'bootstrap4_tabs', 'bootstrap4_utilities', 'djangocms_column', 'djangocms_file', 'djangocms_forms', 'djangocms_googlemap', 'djangocms_icon', 'djangocms_picture', 'djangocms_snippet', 'djangocms_style', 'djangocms_video', 'taccsite_blockquote', 'taccsite_callout', 'taccsite_data_list', 'taccsite_offset', 'taccsite_sample', 'taccsite_system_monitor', 'taccsite_system_specs' have changes that are not yet reflected in a migration, and so won't be applied.
  Run 'manage.py makemigrations' to make new migrations, and then re-run 'manage.py migrate' to apply them.
root@b8ef2d5d194f:/code# python3 manage.py createsuperuser^C
root@b8ef2d5d194f:/code# python3 manage.py migrate
Operations to perform:
  Apply all migrations: admin, auth, bootstrap4_alerts, bootstrap4_badge, bootstrap4_card, bootstrap4_carousel, bootstrap4_collapse, bootstrap4_content, bootstrap4_grid, bootstrap4_jumbotron, bootstrap4_link, bootstrap4_listgroup, bootstrap4_media, bootstrap4_picture, bootstrap4_tabs, bootstrap4_utilities, cms, contenttypes, djangocms_column, djangocms_file, djangocms_forms, djangocms_googlemap, djangocms_icon, djangocms_link, djangocms_page_meta, djangocms_picture, djangocms_snippet, djangocms_style, djangocms_text_ckeditor, djangocms_video, easy_thumbnails, filer, menus, sessions, sites, taccsite_blockquote, taccsite_callout, taccsite_cms, taccsite_data_list, taccsite_offset, taccsite_sample, taccsite_system_monitor, taccsite_system_specs
Running migrations:
  Applying taccsite_cms.0001_add_groups... OK
  Applying taccsite_data_list.0001_initial... OK
  Applying taccsite_data_list.0002_auto_20210824_0803... OK
  Applying taccsite_offset.0001_initial... OK
  Applying taccsite_sample.0001_initial... OK
  Applying taccsite_system_monitor.0001_initial... OK
  Applying taccsite_system_specs.0001_initial... OK
  Applying taccsite_system_specs.0002_limit_desc_length... OK
root@b8ef2d5d194f:/code# 

@wesleyboar wesleyboar marked this pull request as ready for review April 9, 2025 22:25
@codecov
Copy link

codecov bot commented Apr 9, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 70.36%. Comparing base (c8fa6ac) to head (553869c).

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main    #1096   +/-   ##
=======================================
  Coverage   70.36%   70.36%           
=======================================
  Files         538      538           
  Lines       33334    33334           
  Branches     2960     2960           
=======================================
  Hits        23455    23455           
  Misses       9680     9680           
  Partials      199      199           
Flag Coverage Δ
javascript 72.54% <ø> (ø)
unittests 61.05% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@wesleyboar
Copy link
Member Author

I make progress toward solution in:

@wesleyboar
Copy link
Member Author

This PR is not needed, because TACC/Core-CMS#932 is merged.

@wesleyboar wesleyboar closed this Apr 25, 2025
@wesleyboar wesleyboar deleted the docs/core-cms-931-workaround-cms-migrate-fail branch April 25, 2025 17:24
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

Successfully merging this pull request may close these issues.

2 participants