Skip to content

[WIP] Upgrade to Rails 6#6806

Closed
mrcasals wants to merge 10 commits intodevelopfrom
chore/rails-6
Closed

[WIP] Upgrade to Rails 6#6806
mrcasals wants to merge 10 commits intodevelopfrom
chore/rails-6

Conversation

@mrcasals
Copy link
Copy Markdown
Contributor

@mrcasals mrcasals commented Nov 5, 2020

🎩 What? Why?

This builds on the work in #6522. It's WIP, I'll try to work on it in slow work times.

📌 Related Issues

Testing

Describe the best way to test or validate your PR.

📋 Checklist

🚨 Please review the guidelines for contributing to this repository.

  • CONSIDER adding a unit test if your PR resolves an issue.
  • ✔️ DO check open PR's to avoid duplicates.
  • ✔️ DO keep pull requests small so they can be easily reviewed.
  • ✔️ DO build locally before pushing.
  • ✔️ DO make sure tests pass.
  • ✔️ DO make sure any new changes are documented in docs/.
  • ✔️ DO add and modify seeds if necessary.
  • ✔️ DO add CHANGELOG upgrade notes if required.
  • ✔️ DO add to GraphQL API if there are new public fields.
  • ✔️ DO add link to MetaDecidim if it's a new feature.
  • AVOID breaking the continuous integration build.
  • AVOID making significant changes to the overall architecture.

📷 Screenshots

Please add screenshots of the changes you're proposing
Description

♥️ Thank you!

@mrcasals
Copy link
Copy Markdown
Contributor Author

mrcasals commented Nov 5, 2020

We might need to upgrade to webpack first before upgrading to Rails6. Here are some instructions to use Rails6 without webpack, but they seem to include some manual steps:

https://stackoverflow.com/a/58518795/2110884

@mrcasals
Copy link
Copy Markdown
Contributor Author

mrcasals commented Nov 5, 2020

Here are some instructions on how to use webpacker with Rails engines:

https://github.com/rails/webpacker/blob/master/docs/engines.md

Affected modules seem to be those that hand JS files in their vendor folders:

  • decidim-core
  • decidim-admin
  • decidim-api
  • decidim-accountability

@mrcasals
Copy link
Copy Markdown
Contributor Author

mrcasals commented Nov 5, 2020

I managed to create the test app properly, but it's failing whenever it tries to load any class or module within Decidim::Messaging

@mrcasals
Copy link
Copy Markdown
Contributor Author

mrcasals commented Nov 5, 2020

I fixed some classnames/filenames thanks to bin/rails zeitwerk:check, but it's still failing whenever trying to load anything from Decidim::Messaging:: and I don't understand the cause of the issue.

@mrcasals
Copy link
Copy Markdown
Contributor Author

mrcasals commented Nov 5, 2020

Looks like I managed to solve the Decidim::Messaging:: classes issue, but now it's complaining due to assets. It might be a better approach if we just start moving the assets to webpacker, and then try to upgrade to Rails 6.

@alecslupu
Copy link
Copy Markdown
Contributor

@mrcasals , I have dug for the last few days in that rails 6 upgrade, and i think that Decidim is not ready yet for that ...

I have got into the same issue with the webpacker ( meaning that i have installed, but somehow the assets are getting messed up ) (Implementing the suggestion with webpacker in gem, i got into a strange situation when main/development app, tried to load assets from decidim. in my endeavors i have not been able properly load decidim packs in main app, nor provide a parameter that would specify the module / pack where the asset is located ) (edited)

from what i have seen, DHH stated that webpacker and sprockets can work together, after digging for about 2 days ... i could not find a way around that , so i have managed to look into other engines that are out there, and i have seen that they are using the assests pipeline ( sprockets )

From my investigations, in order to successfully upgrade to rails 6, we need to remove that sprockets-es6 compatibility (please read details here https://github.com/TannerRogalsky/sprockets-es6#asset-manifests-required-for-precompiling ) (edited)

Downgrading sprokets ... may work, however, new issues will be encountered with some other assets ( that can be added to the pipeline), but there is an issue with decidim/foundation ( and possible all other )

Some other issues willl be in the Graphql part

Query is invalid: Query must define at least 1 field. 0 defined.

and this is even more interesting ... Duplicate type definition found for name 'User' at 'User' (User, User) , and i see a resolution here ... rmosolgo/graphql-ruby#935 (edited)

@ahukkanen
Copy link
Copy Markdown
Contributor

@alecslupu For the GraphQL duplicate type defintions, see #4202.

Decidim is currently also using the legacy type definition format with graphql-ruby. It might help to update to the new class-based API.

@alecslupu
Copy link
Copy Markdown
Contributor

alecslupu commented Nov 16, 2020

@ahukkanen I am already working on the GraphQL upgrade ... I am currently trying to resolve the 152 failing tests i have on the Core module /...

@alecslupu
Copy link
Copy Markdown
Contributor

Additional work is done in #6871

@ahukkanen
Copy link
Copy Markdown
Contributor

@alecslupu Great, nice!

@mrcasals
Copy link
Copy Markdown
Contributor Author

Thanks @alecslupu for helping here! The GraphQL thing is a long-overdue refactor!

As I mentioned previously, I think the best way to upgrade to Rails 6 will be to first move all the assets to webpacker (thus gaining some benefits, like being able to use modules and dropping the vendor folders), and then trying to upgrade to Rails6

@mrcasals
Copy link
Copy Markdown
Contributor Author

Closing in favor of @alecslupu's work

@mrcasals mrcasals closed this Jan 11, 2021
@mrcasals mrcasals deleted the chore/rails-6 branch January 11, 2021 07:53
@alecslupu
Copy link
Copy Markdown
Contributor

Closed in favor of #7086

@alecslupu alecslupu mentioned this pull request Jan 11, 2021
12 tasks
This was referenced Feb 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants