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

Issues with building website locally #753

Open
musicEnfanthen opened this issue Feb 13, 2025 · 11 comments
Open

Issues with building website locally #753

musicEnfanthen opened this issue Feb 13, 2025 · 11 comments

Comments

@musicEnfanthen
Copy link
Member

musicEnfanthen commented Feb 13, 2025

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 #752 (comment)

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 #752 (comment)

@musicEnfanthen
Copy link
Member Author

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 #752 (comment)

@musicEnfanthen
Copy link
Member Author

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?

@annplaksin
Copy link
Member

annplaksin commented Feb 13, 2025

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.

@musicEnfanthen
Copy link
Member Author

musicEnfanthen commented Feb 13, 2025

Hmm, there seems to be a bigger issue with the jekyll docker image:

@craigsapp
Copy link
Member

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...

@musicEnfanthen
Copy link
Member Author

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?

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)

@musicEnfanthen
Copy link
Member Author

@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:

But internally it is probably caused by google-protobuf:

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:

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 (#753 (comment)) 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.)

@musicEnfanthen
Copy link
Member Author

musicEnfanthen commented Feb 15, 2025

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 ?

@musicEnfanthen
Copy link
Member Author

@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).

@bwbohl
Copy link
Member

bwbohl commented Feb 21, 2025

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 ;-)

@musicEnfanthen
Copy link
Member Author

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.

neekaru added a commit to neekaru/neekarublog.github.io that referenced this issue Mar 5, 2025
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

No branches or pull requests

4 participants