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

[sumac] feat: migrate from Ruby to forum v2 Python app #48

Merged
merged 1 commit into from
Nov 4, 2024

Conversation

regisb
Copy link
Contributor

@regisb regisb commented Oct 17, 2024

Obviously, this is a very important change. But it drastically simplifies this plugin, in the sense that we no longer have to run a separate Ruby container.

Note that this branch should actually be merged in the "sumac" branch, not nightly. This is pending on the creation of the "sumac" branch. EDIT: PR has ben rebased on top of the sumac branch.

@regisb regisb force-pushed the regisb/forumv2 branch 2 times, most recently from cd4e4f7 to 11d1ef1 Compare October 18, 2024 10:48
Comment on lines +47 to +48
(./manage.py lms waffle_flag --list | grep forum_v2.enable_forum_v2) || ./manage.py lms waffle_flag --create --everyone forum_v2.enable_forum_v2
(./manage.py lms waffle_flag --list | grep forum_v2.enable_mysql_backend) || ./manage.py lms waffle_flag --create --everyone forum_v2.enable_mysql_backend
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

where will the migration of content from mongo to MySQL take place?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good question :) For now I've left it as a manual step. Basically, people would have to run:

./manage.py lms forum_migrate_course_from_mongodb_to_mysql --no-toggle all
./manage.py lms waffle_flag --create --everyone forum_v2.enable_forum_v2
./manage.py lms forum_delete_course_from_mongodb all

Source: https://github.com/edly-io/forum/?tab=readme-ov-file#migration-from-mongodb-to-mysql

But ideally these steps should be performed automatically as part of tutor local upgrade --from=redwood. But the problem is that currently there exists no filter for that. We should probably create a UPGRADE_TASKS filter.

@ghassanmas
Copy link
Member

Happy to see this change, which it shall fruther simplify the maintance and of the platform.
I have few question regarding this change, but most importantly can you confirm if this from Summac there will be in no way to run the forum other than v2? Because looking at this openedx/cs_comments_service/issues/437 I assume for Summac opreator shall have the choice between both?

@Faraz32123
Copy link

Happy to see this change, which it shall fruther simplify the maintance and of the platform. I have few question regarding this change, but most importantly can you confirm if this from Summac there will be in no way to run the forum other than v2? Because looking at this openedx/cs_comments_service/issues/437 I assume for Summac opreator shall have the choice between both?

  • (Testing that operators can perform)Like we have 2 coursewaffle flags i.e. forum_v2.enable_forum_v2 and forum_v2.enable_mysql_backend. And both of these flags will be enabled by default. But yes user can just disable these flags(from lms django admin panel) to use forum_V1 and just play around with these flags and shift to forumV2 course wise.
    • Enable forum_v2.enable_forum_v2 for one course and keep forum_v2.enable_mysql_backend disabled. Check forum_v2 working with mongodb(data that forum_V1 created/added in mongodb), everything's fine. Then enable forum_v2.enable_mysql_backend, run migration command for that course. Again check the behaviour. But these are just the testing steps i have written course wise.

I hope this answers most of the part.

@ghassanmas
Copy link
Member

@Faraz32123 yes I got this part to my understanding once opreator choose to run forum_v2.enable_mysql_backend there is no way back?

Also my inquriy is whether I need to test cs_comments_service or not, and also I assume we can't merge this PR as it's, or is it planned to be merged later after the release of summac?

@Faraz32123
Copy link

@Faraz32123 yes I got this part to my understanding once opreator choose to run forum_v2.enable_mysql_backend there is no way back?

yes, there's a way back as long as user don't run this command forum_delete_course_from_mongodb as it will delete the previous data in mongodb but still user can shift to V1 and use it with empty data. But after testing it with mysql, we expect that users with stick to mysql because Forum_v1 will be totally removed/deprecated in future.

Also my inquriy is whether I need to test cs_comments_service or not, and also I assume we can't merge this PR as it's, or is it planned to be merged later after the release of summac?

According to the description that regis added in this PR, we should merge this change in sumac branch.

  • create a sumac branch from nightly.
  • change the base branch in this PR to sumac, it will be merged in sumac(we have tested it at our end, you can also do some testing). So that it can be tested before actual sumac release(i.e. merging sumac branch into master).

@ghassanmas
Copy link
Member

ghassanmas commented Oct 24, 2024

But then if we merge as it's to Summa opreator will not be able to to run forum_v1, (the ruby service), or am I missing something?

@ghassanmas
Copy link
Member

And also consider this scenario:

  1. An opreator choose to try check v2, they enable and did the mysql migration as well
  2. The platform is running for a week, (learners made comments/ repond to threads..etc)
  3. For somereason they decided to switch back v1 and mongodb

They didn't delete mongodb data, so they shall be able to switch back but data/changes in step 2 will not be reflected back in mongodb I suppose.

This is of course an edge case, but I think we need to mention all of these cases and scenarios in the release notes.

@Faraz32123
Copy link

And also consider this scenario:

  1. An opreator choose to try check v2, they enable and did the mysql migration as well
  2. The platform is running for a week, (learners made comments/ repond to threads..etc)
  3. For somereason they decided to switch back v1 and mongodb

They didn't delete mongodb data, so they shall be able to switch back but data/changes in step 2 will not be reflected back in mongodb I suppose.

This is of course an edge case, but I think we need to mention all of these cases and scenarios in the release notes.

Yeah, that's totally fine! We don't expect users to switch back to V1 again and there's no way to migrate data from mysql to mongo.

But then if we merge as it's to Summa opreator will not be able to to run forum_v1, (the ruby service), or am I missing something?

I think to answer this, let's hear it from @regisb, because I was answering it you according to our initial requirements(there might be a twist in it now) and local testing of forum with edx-platform. Although I think Forum_V1 settings should remain there for a while so that it can be tested by the community. Regis can tell better :)

Comment on lines +29 to +32
RUN git remote add edly https://github.com/edly-io/edx-platform \
&& git fetch edly edly/forumv2 \
&& git merge edly/edly/forumv2""",
),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Applying/merging that path caused an error on tutor sumac branch: 255.9 fatal: refusing to merge unrelated histories

May be edx/forumv2 brnach needs to be rebased on top of open-release/sumac.master?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alright I think the above error is because tutor makes a shalllow clone, so I tried 1) git merge edly/edly/forumv2 --allow-unrelated-histories, but then there is a huge a merge conflcit. So then I noticed edly branch is quite update to with master/sumac, so I tried git checkout edly/edly/forumv2 but then there I got pypi dependency conflict

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll let you know after updating(resolving dependency conflict) the edly/forum branch with upstream.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dependency Issues were resolved, forgot to add it here as well. You can test it...

@Faraz32123
Copy link

But then if we merge as it's to Summa opreator will not be able to to run forum_v1, (the ruby service), or am I missing something?

@ghassanmas regarding your question, I had a chat with regis. So, right now we are not going to support forum_V1 in the tutor-forum plugin. And if users want to run forum V1, they may have to create a separate plugin and this tutor-forum plugin will remain as it is now :)

@regisb regisb changed the base branch from nightly to sumac October 29, 2024 06:42
Obviously, this is a very important change. But it drastically
simplifies this plugin, in the sense that we no longer have to run a
separate Ruby container.
Comment on lines +47 to +48
(./manage.py lms waffle_flag --list | grep forum_v2.enable_forum_v2) || ./manage.py lms waffle_flag --create --everyone forum_v2.enable_forum_v2
(./manage.py lms waffle_flag --list | grep forum_v2.enable_mysql_backend) || ./manage.py lms waffle_flag --create --everyone forum_v2.enable_mysql_backend

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we add below to the init task of forum... although migrations will run during launch, just a suggestion.
(./manage.py lms showmigrations forum | grep '\[ \]') && ./manage.py lms migrate forum

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no need for this condition ./manage.py lms showmigrations forum | grep '\[ \]', it'll throw an error in init jobs if there are no new migrations to apply. The idea was to add ./manage.py lms migrate forum for forum app.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But those migrations will be automatically taken care of during lms init, right? I don't see the need to migrate the forum app individually.

@DawoudSheraz
Copy link
Contributor

I am going to merge this PR. Since ES was removed as part of Meilisearch migration (overhangio/tutor#1141), tutor-forum is failing on sandbox deploy (https://github.com/overhangio/openedx-release-demo/actions/runs/11657227578/job/32454473726). Any nits can be addressed via a followup PR.

@DawoudSheraz DawoudSheraz merged commit 132507d into sumac Nov 4, 2024
@regisb regisb deleted the regisb/forumv2 branch November 4, 2024 07:50
regisb added a commit that referenced this pull request Nov 14, 2024
Obviously, this is a very important change. But it drastically
simplifies this plugin, in the sense that we no longer have to run a
separate Ruby container.
regisb added a commit that referenced this pull request Nov 14, 2024
Obviously, this is a very important change. But it drastically
simplifies this plugin, in the sense that we no longer have to run a
separate Ruby container.
regisb added a commit that referenced this pull request Nov 15, 2024
Obviously, this is a very important change. But it drastically
simplifies this plugin, in the sense that we no longer have to run a
separate Ruby container.
DawoudSheraz pushed a commit that referenced this pull request Nov 29, 2024
Obviously, this is a very important change. But it drastically
simplifies this plugin, in the sense that we no longer have to run a
separate Ruby container.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Development

Successfully merging this pull request may close these issues.

4 participants