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

Upgrade Node 14 to Node 20 #1439

Merged
merged 5 commits into from
Jan 2, 2024
Merged

Conversation

chris-bateman
Copy link
Contributor

@chris-bateman chris-bateman commented Nov 19, 2023

Now upgraded to node 20 and webpack 5

Upgrade Node from 14 to 16 and associated packages and WebPack config.

The proposed change is because Node 14 is EOL and some packages are no longer supported.
https://endoflife.date/nodejs
Node 16 is still EOL but I wanted to introduce these changes gradually.

Node is now installed in the Dockerfile using the modern install method. The old script method is deprecated.
image

Replace ExtractTextPlugin with MiniCssExtractPlugin due to it being deprecated -
image

I upgraded WebPack slightly to ensure MiniCssExtractPlugin works.

Dockerfile compiled correctly on local system.
Tests completed successfully on local system.
image

ASDC Disclaimer - These changes will benefit the ASDC fork for supporting some custom frontend packages.

Upgrade Node from 14 to 16 and associated packages and WebPack config
@chris-bateman
Copy link
Contributor Author

A few CSS issues are appearing, so will work on that.

@pierotofy
Copy link
Member

If we're making the effort to upgrade node/webpack & friends, maybe this should be updated to the latest stable release of node, not 16, unless there's something that's being blocked with staying on 14 (are these the custom frontend packages?)

@chris-bateman
Copy link
Contributor Author

The logic behind moving to 16 was to reduce the blast radius of such a large jump between 14 to 18. However, 16 is still EOL so best practice would be to move to 18. I will give it a try and see what the impact is. It should hopefully be easier* (famous last words) since I have done the move to 16 essentially.

Later versions of Uppy and webpack 5 aren't happy with Node 14 hence the upgrade.

Upgraded to node 18 and Webpack 5.
Package cleanup for webpack 5
@chris-bateman chris-bateman changed the title Upgrade Node 14 to Node 16 Upgrade Node 14 to Node 18 Nov 20, 2023
@chris-bateman
Copy link
Contributor Author

@pierotofy in theory Node 18 and webpack 5.
Tests pass locally and in the GH action.
Basic build, login and check various pages and actions appear to work.

Please have a review and let me know if you have any questions or comments.

@smathermather
Copy link
Contributor

@chris-bateman -- any reason why 21.04 instead of LTS 22.04? No comments otherwise and a happy to test. Thanks for this!

@chris-bateman
Copy link
Contributor Author

@chris-bateman -- any reason why 21.04 instead of LTS 22.04? No comments otherwise and a happy to test. Thanks for this!

Didn't touch the docker file Ubuntu version as I didn't want to change too many things. I was going to consider changing that in another PR. But overall I do agree a bump there would be good.

@smathermather
Copy link
Contributor

smathermather commented Nov 21, 2023

Ah, I forgot that was 21 already! Yeah, a bump if possible is always good, but not changing everything at once is useful.

Edit:
Now running as my daily. No issue yet, but no deeper testing. Anything other than "hey, this loads and I don't see issues!" do you want to see for testing? So far so good on my end.

@chris-bateman
Copy link
Contributor Author

@smathermather quick note about a bump to the Ubuntu version. I just gave it a try and it's more than a 1 line fix. A few packages need to be adjusted. So yeah that will be a to do item for another time.

Let me know if anything else is needed for this to be merged and released.

@smathermather
Copy link
Contributor

If there's no objection, I'll merge today.

Copy link
Member

@pierotofy pierotofy left a comment

Choose a reason for hiding this comment

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

This breaks the map view for me:

image

Probably due to:

    fallback: {
      "buffer": false
    }

package.json Outdated Show resolved Hide resolved
Dockerfile Outdated Show resolved Hide resolved
@pierotofy
Copy link
Member

Now running as my daily.

Is the version number showing as 3.0.0 in the about section?

@smathermather
Copy link
Contributor

Hmm. Nope. Looks like somehow I built wrong.

@chris-bateman
Copy link
Contributor Author

This breaks the map view for me:

image

Probably due to:

    fallback: {
      "buffer": false
    }

I will take a look.

@chris-bateman
Copy link
Contributor Author

This breaks the map view for me:

image

Probably due to:

    fallback: {
      "buffer": false
    }

Issue resolved. Just working on node 20 and seeing what happens there.

Added buffer as webpack 5 does not use it anymore.
Version change in package.json
bump to node 20
@chris-bateman chris-bateman changed the title Upgrade Node 14 to Node 18 Upgrade Node 14 to Node 20 Nov 23, 2023
@chris-bateman
Copy link
Contributor Author

Latest run failed but just due to a network timeout connecting to Ubuntu. Happens every now and then.
Built locally just fine on my local system with Node 20. So just trigger a rebuild and it should be fine.

@pierotofy
Copy link
Member

pierotofy commented Nov 25, 2023

Thanks for the additional changes, but this is now breaking shapefile import in the map view. You should be able to drag & drop zipped shapefiles into a project (test files and link to a working instance of WebODM included).

image

test.zip

https://cloud1.webodm.net/public/task/329b1d24-826e-4cbf-a220-2e19be0349e1/map/

If you've upgraded webpack, test whether you've accidentally broken anything Javascript related. If you add a polyfill for Buffer, search for anything related to Buffer (in this case, shapefile import, perhaps other stuff) 🙏

@smathermather
Copy link
Contributor

@pierotofy -- do we maintain a list of things to test (recognising this might have been caught without such a list). If not, I can at least go through pull requests and make a list of things that have broken as a starting place and we can build from there.

@chris-bateman
Copy link
Contributor Author

Thanks for the additional changes, but this is now breaking shapefile import in the map view. You should be able to drag & drop zipped shapefiles into a project (test files and link to a working instance of WebODM included).

image

test.zip

https://cloud1.webodm.net/public/task/329b1d24-826e-4cbf-a220-2e19be0349e1/map/

If you've upgraded webpack, test whether you've accidentally broken anything Javascript related. If you add a polyfill for Buffer, search for anything related to Buffer (in this case, shapefile import, perhaps other stuff) 🙏

Thanks for testing. Comments noted and appreciated. As @smathermather mentions above, a test list would be appreciated. This could then be expanded into a test suite like Playwright in the future, for example.

I will review the impact of upgrading to WebPack 5 in more detail on a code level.

@pierotofy
Copy link
Member

  • Webpack upgrade: touches every single Javascript output. So everything in the UI/frontend needs to be tested.
  • Buffer: any reference (code + libs in node_modules) should be identified and tested.

We have a minimal test suite for the frontend, but it's nowhere near exhaustive (see all .test.jsx files). Manual testing is still required.

@chris-bateman
Copy link
Contributor Author

Thanks for the additional changes, but this is now breaking shapefile import in the map view. You should be able to drag & drop zipped shapefiles into a project (test files and link to a working instance of WebODM included).

image

test.zip

https://cloud1.webodm.net/public/task/329b1d24-826e-4cbf-a220-2e19be0349e1/map/

If you've upgraded webpack, test whether you've accidentally broken anything Javascript related. If you add a polyfill for Buffer, search for anything related to Buffer (in this case, shapefile import, perhaps other stuff) 🙏

This particular issue is now fixed. I will push the commit shortly.
image

Please feel free to test further. I will continue checking a few things in other sections of the frontend as well.

@smathermather
Copy link
Contributor

smathermather commented Dec 5, 2023

Do we need more testing on this? Happy to run some tests if so.

@chris-bateman
Copy link
Contributor Author

Do we need more testing on this? Happy to run some tests if so.

I am using it for the day to day ASDC workloads without issue but they are probably vastly different from day to day "vanilla" usage. Maybe release a beta to common power users?

@smathermather
Copy link
Contributor

Is there something other than throwing the --dev flag that I should do to test it?

@pierotofy
Copy link
Member

Yes.

docker build -t opendronemap/webodm_webapp .

Then ./webodm.sh start --dev

@smathermather
Copy link
Contributor

smathermather commented Dec 8, 2023

Yes.

docker build -t opendronemap/webodm_webapp .

Then ./webodm.sh start --dev

Cool. In that case currently running this as a daily and have been for a few days. Though version still shows as 2.4.0, which is a bit confusing. Perhaps I'm not running it?

Sorry for the confusion: I never touch WebODM, always ODM or NodeODM for testing, so I'm a very old n00b.

@chris-bateman
Copy link
Contributor Author

chris-bateman commented Dec 8, 2023 via email

@smathermather
Copy link
Contributor

Still running in production over here without issue, but I've asked @Saijin-Naib to kick the tires a bit too as I haven't had time to do any deeper testing yet.

@Saijin-Naib
Copy link
Contributor

Oh, you want me to break stuff? That I can do 🤣

@smathermather
Copy link
Contributor

Still running as my daily, so far without incident.

@Saijin-Naib -- any chance to kick the tires?

@Saijin-Naib
Copy link
Contributor

Not yet!

@smathermather
Copy link
Contributor

Still not seeing any issues running this on the daily. Do we have any remaining reservations about this pull request?

@pierotofy
Copy link
Member

I think it's good.

Thank you @chris-bateman 🙏

@pierotofy pierotofy merged commit be8bd6e into OpenDroneMap:master Jan 2, 2024
1 check passed
@chris-bateman
Copy link
Contributor Author

Happy new year everyone thanks for taking the time to test this.

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.

4 participants