music-encoding.github.io
music-encoding.github.io copied to clipboard
Issues with building website locally
Currently, I can't test the site locally on my machine or within a Docker container. Theoretically, this commit should not create a problem. How is the current website situation? Is it safe to merge?
Originally posted by @annplaksin in https://github.com/music-encoding/music-encoding.github.io/pull/752#issue-2850430544
Locally I'd need to upgrade my Ruby version, I haven't checked yet if this would work and went to run it via Docker with the command in Contributing.md (slightly modified for Windows š) It initially runs all the installs, then I get
ruby 3.1.1p18 (2022-02-18 revision 53f5fc4236) [x86_64-linux-musl]
/usr/gem/gems/sass-embedded-1.83.4/ext/sass/embedded_sass_pb.rb:11: [BUG] Segmentation fault at 0x0000000000004410
ruby 3.1.1p18 (2022-02-18 revision 53f5fc4236) [x86_64-linux-musl]
... followed by very detailed runtime information, backtraces and the container stops running... Here's the backtrace:
-- Ruby level backtrace information ----------------------------------------
/usr/local/bundle/bin/jekyll:27:in `<main>'
/usr/local/bundle/bin/jekyll:27:in `load'
/usr/gem/gems/jekyll-4.4.1/exe/jekyll:8:in `<top (required)>'
/usr/gem/gems/jekyll-4.4.1/exe/jekyll:8:in `require'
/usr/gem/gems/jekyll-4.4.1/lib/jekyll.rb:195:in `<top (required)>'
/usr/gem/gems/jekyll-4.4.1/lib/jekyll.rb:195:in `require'
/usr/gem/gems/jekyll-sass-converter-3.1.0/lib/jekyll-sass-converter.rb:4:in `<top (required)>'
/usr/gem/gems/jekyll-sass-converter-3.1.0/lib/jekyll-sass-converter.rb:4:in `require'
/usr/gem/gems/jekyll-sass-converter-3.1.0/lib/jekyll/converters/scss.rb:8:in `<top (required)>'
/usr/gem/gems/jekyll-sass-converter-3.1.0/lib/jekyll/converters/scss.rb:8:in `require'
/usr/gem/gems/sass-embedded-1.83.4/lib/sass-embedded.rb:4:in `<top (required)>'
/usr/gem/gems/sass-embedded-1.83.4/lib/sass-embedded.rb:4:in `require_relative'
/usr/gem/gems/sass-embedded-1.83.4/lib/sass/embedded.rb:3:in `<top (required)>'
/usr/gem/gems/sass-embedded-1.83.4/lib/sass/embedded.rb:3:in `require_relative'
/usr/gem/gems/sass-embedded-1.83.4/lib/sass/compiler.rb:11:in `<top (required)>'
/usr/gem/gems/sass-embedded-1.83.4/lib/sass/compiler.rb:11:in `require_relative'
/usr/gem/gems/sass-embedded-1.83.4/lib/sass/embedded_protocol.rb:3:in `<top (required)>'
/usr/gem/gems/sass-embedded-1.83.4/lib/sass/embedded_protocol.rb:5:in `<module:Sass>'
/usr/gem/gems/sass-embedded-1.83.4/lib/sass/embedded_protocol.rb:6:in `<module:EmbeddedProtocol>'
/usr/gem/gems/sass-embedded-1.83.4/lib/sass/embedded_protocol.rb:6:in `require_relative'
/usr/gem/gems/sass-embedded-1.83.4/ext/sass/embedded_sass_pb.rb:11:in `<top (required)>'
/usr/gem/gems/sass-embedded-1.83.4/ext/sass/embedded_sass_pb.rb:11:in `add_serialized_file'
Originally posted by @annplaksin in https://github.com/music-encoding/music-encoding.github.io/issues/752#issuecomment-2656004362
I don't think my local Ruby version causes the issues I have with running the Docker container. Locally. it's a very old 2.6.6p146 ... but it used to run very well with Jekyll because I didn't run into any compatibility issues which usually force a Ruby downgrade š
Originally posted by @annplaksin in https://github.com/music-encoding/music-encoding.github.io/issues/752#issuecomment-2656080265
With the latest Ruby+Devkit it should work locally (without Docker). Just upgraded the other day (also from a 2.x version on Win) and it worked very well (without any compatibility issues which I had before, too).
I'll look into the docker thing. Can you post the full command you are using?
docker run --rm -it --volume="${PWD}:/srv/jekyll:Z" --publish 4000:4000 jekyll/jekyll jekyll serve
I added curly brackets to make it run in PowerShell.
Hmm, there seems to be a bigger issue with the jekyll docker image:
- [ ] https://github.com/envygeeks/jekyll-docker/issues/364
Jekyll has had problems with the most recent versions of ruby (3.4.1).
I am using ruby 3.1.4p223 (2023-03-30 revision 957bb7cb81 x86_64-darwin22 on MacOS Sonoma 14.6.1 and Jekyll 4.3.4.
On another MacOS with Sequoia 15.1, I had particular problems running jekyll. In this case I am running Ruby 2.7.2 with jekyll 4.3.2 (I could not get ruby 3 to work).
Jekyll officially supports Ruby versions 2.7 to 3.2 (at least as of last year), but the exact versions depend on the specific Jekyll version you are using.
Jekyll 4.3.2 (latest version is 4.4.1, which I do not know the ruby dependency of):
- Requires Ruby 2.7 or newer.
- Officially supports Ruby 3.0, 3.1, and 3.2.
- Ruby 3.3 is not officially supported yet, but may work with some adjustments.
Jekyll 4.2.x and earlier:
- Supports Ruby 2.6 and 2.7.
- May work with Ruby 3.x, but certain plugins or dependencies might need updates.
Here are the dependencies for GitHub Pages:
https://pages.github.com/versions
which says they are using Jekyll 3.10.0...
All ruby 2.x versions reached end of life almost two years ago: https://endoflife.date/ruby, so probably should be upgraded to 3.x at some point.
Nonetheless, Jekyll installation guide still says that they support Ruby 2.7 (or higher ofc), and you are right, it is quite hard to figure out what ruby version exactly is supported by latest Jekyll, at least there seem to be no official indication apart from "2.7 or higher".
From personal experience, I just upgraded Ruby to version 3.4 the other day, and it works without issues with the jekyll 4.4 gem (and its depedencies) we have in the repo here.
I don't know about Ruby on MacOS, but did you try the installation guide here: https://jekyllrb.com/docs/installation/macos/? Issues maybe related to an outdated dependency like this one?
- https://github.com/rvm/rvm/issues/5511
On a side note, we do not use the GH pages jekyll gem, that you pointed to, anymore (because it was always on older gem versions). The website gets build with the Ruby version specified in the GH actions workflow (3.2: https://github.com/music-encoding/music-encoding.github.io/actions/runs/13311892642/workflow#L21) and the Jekyll version specified in the Gemfile.lock: (4.4.1: https://github.com/music-encoding/music-encoding.github.io/actions/runs/13311892642/job/37176279166#step:3:97)
@annplaksin OK, I think I am getting a clearer picture of what is happening with the Docker build.
There is a segmenation fault thrown by sass-embedded:
- https://github.com/sass-contrib/sass-embedded-host-ruby/issues/282
But internally it is probably caused by google-protobuf:
- https://github.com/protocolbuffers/protobuf/issues/16853#issuecomment-2583135716
So a workaround would be to include the following line in your Gemfile:
gem 'google-protobuf', force_ruby_platform: RUBY_PLATFORM.include?('linux-musl')
This makes the segmentation fault go away, indeed, and the installation of the deps in the Docker container runs fine.
However, when the website gets generated in the Docker container, it runs into another issue:
Conversion error: Jekyll::Converters::Scss encountered an error while converting 'css/main.scss':
Broken pipe
That seems to be related to the base image used in the Jekyll docker image:
- https://github.com/jekyll/jekyll-sass-converter/issues/156#issuecomment-1605872525
Above comment reads:
This is known issue on alpine-linux <=3.15. dart-sass requires alpine-linux >=3.16 (current latest is 3.18).
And, unfortunately, the Jekyll Docker image uses an alpine 3.15 base image https://github.com/envygeeks/jekyll-docker/blob/master/opts.yml
Which brings us back to the issue mentioned above (https://github.com/music-encoding/music-encoding.github.io/issues/753#issuecomment-2656757437) that the maintenance of the Docker image seems to be stale right now. With little chance to get it updated in the near future :( . (It remains to be seen whether Jekyll or Github will be able to officially adopt the Docker images in the future.)
So one option would be to drop the support for building the website with Docker.
Another one would be to create a custom Docker image that supports the necessary versions and deps. (e.g., https://dev.to/cuongnp/setting-up-a-local-development-environment-for-jekyll-with-docker-d8k)
What do you think @bwbohl ?
@craigsapp Here is another guide to install ruby on latest macos: https://www.moncefbelyamani.com/how-to-install-xcode-homebrew-git-rvm-ruby-on-mac/ (the page is advertising a proprietary tool: Ruby on Mac, but when you read further, there are very detailed instructions about the installation process and possible issues).
So one option would be to drop the support for building the website with Docker.
Another one would be to create a custom Docker image that supports the necessary versions and deps. (e.g., https://dev.to/cuongnp/setting-up-a-local-development-environment-for-jekyll-with-docker-d8k)
What do you think @bwbohl ?
As you might know Iām a fan of controlled environments, that would make a +1 for a docker image ;-)
Memo to future self: There is an option to declare the actual ruby version used for the setup.
This would require a .ruby-version file containing the version number, and a reference to that file from the Gemfile before all gem declarations.
ruby File.read(".ruby-version").strip
gem "xyz", "~> 1.2.3"
Cf. end of paragraph in https://www.moncefbelyamani.com/how-to-install-xcode-homebrew-git-rvm-ruby-on-mac/#recommended-way-to-automatically-switch-to-the-correct-version
However, this would probably break the build for anyone not having the exact same ruby version installed.