betadots / hdm

The Hiera Data Manager (HDM) is a Web UI to visualize Hiera data and make it searchable!
GNU Affero General Public License v3.0
20 stars 4 forks source link

Update Ruby/Rails version #34

Closed rwaffen closed 2 years ago

rwaffen commented 2 years ago
oneiros commented 2 years ago

I wanted to suggest the same :slightly_smiling_face:

Rails 7 minimum version requirement for ruby is 2.7. This is currently the oldest version of ruby still receiving (security) updates from upstream. The current version is 3.1, with 3.2 expected to be released on christmas. So if we had no other dependencies to worry about I would suggest trying to go all the way to ruby 3.1.

But I remember that the original requirement was to use the ruby version that comes bundled with puppet, so hdm can be installed alongside a puppet server installation with as little hassle as possible.

AFAICT puppet 7 bundles ruby 2.7.

So which ruby version should it be?

With the release of rails 7, the webpacker gem has been deprecated. Also, we still use the sassc-rails gem that has not been supported for quite a while yet. So with the upgrade to rails 7 I would suggest to overhaul the asset handling as well.

Rails 7 allows to (more or less) easily integrate a multitude of JS-based preprocessors / bundlers. So one option would be to continue using webpack, albeit without the ruby integration. Since webpack can be a bit unwieldy (and slow), this is not my favorite option.

As an alternative, we could use a combination of esbuild (blazing fast JS bundler) and sass (the current, supported version from npm) for CSS. From a technical point of view this would be my favorite option. It is a modern, pleasantly fast and well-supported approach. Migrating to this should not take much effort.

But rails 7 offers an interesting third option: With the help of the importmaps-rails gem one can leverage modern browser support of ES6 modules and skip bundling of JS altogether. And the dartsass-rails gem offers the currently supported sass version via rubygems. Taken together this would mean we might be able to ditch node/npm/yarn. This could make hdm installation a lot simpler.

I have very limited experience with this approach, but I already know that migrating there might be a bit tricky. But the payoff in terms of approachability might be worth it.

rwaffen commented 2 years ago

we will try to go to ruby 3.x and rails 7.x

rwaffen commented 2 years ago

weppacker is deprecated sassc is depricated

rails 7 offers differen replacements for assed handling

there is a way to work without nodejs somehow. should be tested if @oneiros has time for this.

rwaffen commented 2 years ago