Closed gravitystorm closed 1 month ago
Attempted to use Ubuntu 24.04 on Docker, but encountered the following issue when running bundle install
:
46.83 Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
46.83 current directory:
46.83 /var/lib/gems/3.2.0/gems/mini_racer-0.9.0/ext/mini_racer_extension
46.83 /usr/bin/ruby3.2 -I/usr/lib/ruby/vendor_ruby extconf.rb
46.83 checking for -lpthread... yes
46.83 checking for whether -Wl,--exclude-libs=ALL is accepted as LDFLAGS... no
46.83 creating Makefile
46.83 current directory:
46.83 /var/lib/gems/3.2.0/gems/mini_racer-0.9.0/ext/mini_racer_extension
46.83 make DESTDIR\= sitearchdir\=./.gem.20240724-6-5fxsmr sitelibdir\=./.gem.20240724-6-5fxsmr clean
46.83 current directory:
46.83 /var/lib/gems/3.2.0/gems/mini_racer-0.9.0/ext/mini_racer_extension
46.83 make DESTDIR\= sitearchdir\=./.gem.20240724-6-5fxsmr sitelibdir\=./.gem.20240724-6-5fxsmr
46.83 compiling mini_racer_extension.cc
46.83 linking shared-object mini_racer_extension.so
46.83 /usr/bin/ld: cannot find
46.83 /var/lib/gems/3.2.0/gems/libv8-node-18.19.0.0-aarch64-linux/vendor/v8/aarch64-linux-gnu/libv8/obj/libv8_monolith.a:
46.83 No such file or directory
46.83 collect2: error: ld returned 1 exit status
46.83 make: *** [Makefile:265: mini_racer_extension.so] Error 1
46.83 make failed, exit code 2
Tried addressing this issue but couldn't find a solution. At this point, downgrading to eslint 8 seems to be the most practical approach.
I was able to downgrade to eslint 8 and update the eslint config format accordingly since it won't work out of the box when downgrading. The changes are reflected on this branch: node-version-sync
I can open a PR to discuss this further if you think this might be a good approach. @gravitystorm
Are you trying to run this on arm64? https://github.com/rubyjs/mini_racer has some comment in the readme about platforms:
make sure to have PLATFORMS set correctly in Gemfile.lock via bundle lock --add-platform
By the way, since production will move to Debian 12 anyway at some point, it might make sense to skip Ubuntu 24.04.
Are you trying to run this on arm64? https://github.com/rubyjs/mini_racer has some comment in the readme about platforms:
make sure to have PLATFORMS set correctly in Gemfile.lock via bundle lock --add-platform
Tried running on amd64 linux machine also but got an error. I don't think that is the problem here but I will take a look at the docs just in case.
We also need to consider what extra things we can do to avoid this from happening again. For example,
- Is it possible to put maintainer-facing notes (or Dangerfile etc) to avoid these becoming out-of-sync?
- Is it possible to change github CI to use a fixed version of node, that we can match to the version that's shipped in Ubuntu?
Would it be acceptable to create a script which installs nodejs we want and call it from Dockerfile, Vagrant and GitHub workflows? In that case, everything would be on one place, and it would be easier than processing / updating configuration files ..
Since I couldn't get the build working on Ubuntu 24.04
, I tried using a Docker image based on Debian 12.6
. The build itself works fine, but when running tests Selenium Errors are encountered, most commonly:
Selenium::WebDriver::Error::InvalidSessionIdError: Tried to run command without establishing a connection
Selenium::WebDriver::Error::UnknownError: Failed to decode response from marionette
After some investigation with a colleague, we discovered that the issue arises from the parallelization of tests. Reducing the number of processors used during testing to 1 or 2 resolves the issue, but running tests with the default settings results in errors.
class TestCase
include FactoryBot::Syntax::Methods
include ActiveJob::TestHelper
# Run tests in parallel with specified workers
parallelize(:workers => :number_of_processors) #harcoding number_of_processors to 1 or 2 works
parallelize_setup do |worker|
SimpleCov.command_name "#{SimpleCov.command_name}-#{worker}"
end
parallelize_teardown do
SimpleCov.result
end
Few remarks:
mini_racer
during the container build, which might be related to the failures encountered during bundle install
...........................E
Error:
UserSignupTest#test_Show_OpenID_form_when_OpenID_provider_button_is_clicked:
Selenium::WebDriver::Error::UnknownError: Failed to decode response from marionette
test/system/user_signup_test.rb:15:in `block in <class:UserSignupTest>'
Error:
UserSignupTest#test_Show_OpenID_form_when_OpenID_provider_button_is_clicked:
Selenium::WebDriver::Error::InvalidSessionIdError: Tried to run command without establishing a connection
/var/lib/gems/3.1.0/gems/selenium-webdriver-4.23.0/lib/selenium/webdriver/remote/response.rb:62:in `add_cause'
/var/lib/gems/3.1.0/gems/selenium-webdriver-4.23.0/lib/selenium/webdriver/remote/response.rb:41:in `error'
/var/lib/gems/3.1.0/gems/selenium-webdriver-4.23.0/lib/selenium/webdriver/remote/response.rb:52:in `assert_ok'
/var/lib/gems/3.1.0/gems/selenium-webdriver-4.23.0/lib/selenium/webdriver/remote/response.rb:34:in `initialize'
/var/lib/gems/3.1.0/gems/selenium-webdriver-4.23.0/lib/selenium/webdriver/remote/http/common.rb:101:in `new'
/var/lib/gems/3.1.0/gems/selenium-webdriver-4.23.0/lib/selenium/webdriver/remote/http/common.rb:101:in `create_response'
/var/lib/gems/3.1.0/gems/selenium-webdriver-4.23.0/lib/selenium/webdriver/remote/http/default.rb:103:in `request'
/var/lib/gems/3.1.0/gems/selenium-webdriver-4.23.0/lib/selenium/webdriver/remote/http/common.rb:67:in `call'
/var/lib/gems/3.1.0/gems/selenium-webdriver-4.23.0/lib/selenium/webdriver/remote/bridge.rb:675:in `execute'
/var/lib/gems/3.1.0/gems/selenium-webdriver-4.23.0/lib/selenium/webdriver/remote/bridge.rb:292:in `screenshot'
/var/lib/gems/3.1.0/gems/selenium-webdriver-4.23.0/lib/selenium/webdriver/common/driver.rb:333:in `screenshot'
/var/lib/gems/3.1.0/gems/selenium-webdriver-4.23.0/lib/selenium/webdriver/common/takes_screenshot.rb:58:in `screenshot_as'
/var/lib/gems/3.1.0/gems/selenium-webdriver-4.23.0/lib/selenium/webdriver/common/takes_screenshot.rb:60:in `screenshot_as'
/var/lib/gems/3.1.0/gems/selenium-webdriver-4.23.0/lib/selenium/webdriver/common/takes_screenshot.rb:39:in `block in save_screenshot'
/var/lib/gems/3.1.0/gems/selenium-webdriver-4.23.0/lib/selenium/webdriver/common/takes_screenshot.rb:39:in `open'
/var/lib/gems/3.1.0/gems/selenium-webdriver-4.23.0/lib/selenium/webdriver/common/takes_screenshot.rb:39:in `save_screenshot'
/var/lib/gems/3.1.0/gems/capybara-3.40.0/lib/capybara/selenium/driver.rb:152:in `save_screenshot'
/var/lib/gems/3.1.0/gems/capybara-3.40.0/lib/capybara/session.rb:748:in `block in save_screenshot'
<internal:kernel>:90:in `tap'
/var/lib/gems/3.1.0/gems/capybara-3.40.0/lib/capybara/session.rb:748:in `save_screenshot'
/var/lib/gems/3.1.0/gems/actionpack-7.1.3.4/lib/action_dispatch/system_testing/test_helpers/screenshot_helper.rb:106:in `save_image'
/var/lib/gems/3.1.0/gems/actionpack-7.1.3.4/lib/action_dispatch/system_testing/test_helpers/screenshot_helper.rb:36:in `take_screenshot'
/var/lib/gems/3.1.0/gems/actionpack-7.1.3.4/lib/action_dispatch/system_testing/test_helpers/screenshot_helper.rb:47:in `take_failed_screenshot'
/var/lib/gems/3.1.0/gems/actionpack-7.1.3.4/lib/action_dispatch/system_testing/test_helpers/setup_and_teardown.rb:8:in `before_teardown'
Error:
UserSignupTest#test_Show_OpenID_form_when_OpenID_provider_button_is_clicked:
Selenium::WebDriver::Error::InvalidSessionIdError: Tried to run command without establishing a connection
test/application_system_test_case.rb:22:in `after_teardown'
bin/rails test test/system/user_signup_test.rb:12
E
Error:
UserSignupTest#test_Sign_up_from_login_page:
Selenium::WebDriver::Error::UnknownError: Failed to decode response from marionette
test/system/user_signup_test.rb:7:in `block in <class:UserSignupTest>'
Error:
UserSignupTest#test_Sign_up_from_login_page:
Selenium::WebDriver::Error::InvalidSessionIdError: Tried to run command without establishing a connection
/var/lib/gems/3.1.0/gems/selenium-webdriver-4.23.0/lib/selenium/webdriver/remote/response.rb:62:in `add_cause'
/var/lib/gems/3.1.0/gems/selenium-webdriver-4.23.0/lib/selenium/webdriver/remote/response.rb:41:in `error'
/var/lib/gems/3.1.0/gems/selenium-webdriver-4.23.0/lib/selenium/webdriver/remote/response.rb:52:in `assert_ok'
/var/lib/gems/3.1.0/gems/selenium-webdriver-4.23.0/lib/selenium/webdriver/remote/response.rb:34:in `initialize'
/var/lib/gems/3.1.0/gems/selenium-webdriver-4.23.0/lib/selenium/webdriver/remote/http/common.rb:101:in `new'
/var/lib/gems/3.1.0/gems/selenium-webdriver-4.23.0/lib/selenium/webdriver/remote/http/common.rb:101:in `create_response'
/var/lib/gems/3.1.0/gems/selenium-webdriver-4.23.0/lib/selenium/webdriver/remote/http/default.rb:103:in `request'
/var/lib/gems/3.1.0/gems/selenium-webdriver-4.23.0/lib/selenium/webdriver/remote/http/common.rb:67:in `call'
/var/lib/gems/3.1.0/gems/selenium-webdriver-4.23.0/lib/selenium/webdriver/remote/bridge.rb:675:in `execute'
/var/lib/gems/3.1.0/gems/selenium-webdriver-4.23.0/lib/selenium/webdriver/remote/bridge.rb:292:in `screenshot'
/var/lib/gems/3.1.0/gems/selenium-webdriver-4.23.0/lib/selenium/webdriver/common/driver.rb:333:in `screenshot'
/var/lib/gems/3.1.0/gems/selenium-webdriver-4.23.0/lib/selenium/webdriver/common/takes_screenshot.rb:58:in `screenshot_as'
/var/lib/gems/3.1.0/gems/selenium-webdriver-4.23.0/lib/selenium/webdriver/common/takes_screenshot.rb:60:in `screenshot_as'
/var/lib/gems/3.1.0/gems/selenium-webdriver-4.23.0/lib/selenium/webdriver/common/takes_screenshot.rb:39:in `block in save_screenshot'
/var/lib/gems/3.1.0/gems/selenium-webdriver-4.23.0/lib/selenium/webdriver/common/takes_screenshot.rb:39:in `open'
/var/lib/gems/3.1.0/gems/selenium-webdriver-4.23.0/lib/selenium/webdriver/common/takes_screenshot.rb:39:in `save_screenshot'
/var/lib/gems/3.1.0/gems/capybara-3.40.0/lib/capybara/selenium/driver.rb:152:in `save_screenshot'
/var/lib/gems/3.1.0/gems/capybara-3.40.0/lib/capybara/session.rb:748:in `block in save_screenshot'
<internal:kernel>:90:in `tap'
/var/lib/gems/3.1.0/gems/capybara-3.40.0/lib/capybara/session.rb:748:in `save_screenshot'
/var/lib/gems/3.1.0/gems/actionpack-7.1.3.4/lib/action_dispatch/system_testing/test_helpers/screenshot_helper.rb:106:in `save_image'
/var/lib/gems/3.1.0/gems/actionpack-7.1.3.4/lib/action_dispatch/system_testing/test_helpers/screenshot_helper.rb:36:in `take_screenshot'
/var/lib/gems/3.1.0/gems/actionpack-7.1.3.4/lib/action_dispatch/system_testing/test_helpers/screenshot_helper.rb:47:in `take_failed_screenshot'
/var/lib/gems/3.1.0/gems/actionpack-7.1.3.4/lib/action_dispatch/system_testing/test_helpers/setup_and_teardown.rb:8:in `before_teardown'
Error:
UserSignupTest#test_Sign_up_from_login_page:
Selenium::WebDriver::Error::InvalidSessionIdError: Tried to run command without establishing a connection
test/application_system_test_case.rb:22:in `after_teardown'
FROM debian:12.6
ENV DEBIAN_FRONTEND=noninteractive
# Install system packages then clean up to minimize image size
RUN apt-get update \
&& apt-get install --no-install-recommends -y \
build-essential \
curl \
default-jre-headless \
file \
git-core \
gpg-agent \
libarchive-dev \
libffi-dev \
libgd-dev \
libpq-dev \
libsasl2-dev \
libvips-dev \
libxml2-dev \
libxslt1-dev \
libyaml-dev \
locales \
postgresql-client \
ruby \
ruby-dev \
ruby-bundler \
software-properties-common \
tzdata \
unzip \
nodejs \
npm
# Install yarn globally
RUN npm install --global yarn
# Install geckodriver and firefox
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
ca-certificates curl firefox-esr \
&& curl -L https://github.com/mozilla/geckodriver/releases/download/v0.34.0/geckodriver-v0.34.0-linux64.tar.gz | tar xz -C /usr/local/bin
# Install compatible Osmosis to help users import sample data in a new instance
RUN curl -OL https://github.com/openstreetmap/osmosis/releases/download/0.47.2/osmosis-0.47.2.tgz \
&& tar -C /usr/local -xzf osmosis-0.47.2.tgz
ENV DEBIAN_FRONTEND=dialog
# Setup app location
RUN mkdir -p /app
WORKDIR /app
# Install Ruby packages
ADD Gemfile Gemfile.lock /app/
RUN bundle install
# Install NodeJS packages using yarn
ADD package.json yarn.lock /app/
ADD bin/yarn /app/bin/
RUN bundle exec bin/yarn install
I definitely think it would be a good idea to switch to Debian but beyond that I don't really have much advice.
Does debian not have a packaged geckodriver that would avoid the need to do a manual install?
It definitely has a packaged osmosis - a newer one than that in fact.
I tried the Debian docker image. Everything seems to work fine here:
docker compose run --rm web bundle exec rails test:all
[+] Creating 1/0
✔ Container openstreetmap-website-db-1 Running 0.0s
2024-09-04 20:43:45 INFO Selenium [:logger_info] Details on how to use and modify Selenium logger:
https://selenium.dev/documentation/webdriver/troubleshooting/logging
2024-09-04 20:43:45 WARN Selenium [:selenium_manager] The geckodriver version (0.34.0) detected in PATH at /usr/local/bin/geckodriver might not be compatible with the detected firefox version (115.15.0); currently, geckodriver 0.35.0 is recommended for firefox 115.*, so it is advised to delete the driver in PATH and retry
Running 1827 tests in parallel using 8 processes
Run options: --seed 56833
# Running:
...................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................
Finished in 161.717326s, 11.2975 runs/s, 6194.9330 assertions/s.
1827 runs, 1001828 assertions, 0 failures, 0 errors, 0 skips
Coverage report generated for Minitest, Minitest-0, Minitest-1, Minitest-2, Minitest-3, Minitest-4, Minitest-5, Minitest-6, Minitest-7 to /app/coverage. 6302 / 6688 LOC (94.23%) covered.
Lcov style coverage report generated for Minitest, Minitest-0, Minitest-1, Minitest-2, Minitest-3, Minitest-4, Minitest-5, Minitest-6, Minitest-7 to coverage/lcov.info
I'm using Docker version 27.2.0, build 3ab4256 on Ubuntu 22.04 / amd64.
I tried the Debian docker image. Everything seems to work fine here:
docker compose run --rm web bundle exec rails test:all [+] Creating 1/0 ✔ Container openstreetmap-website-db-1 Running 0.0s 2024-09-04 20:43:45 INFO Selenium [:logger_info] Details on how to use and modify Selenium logger: https://selenium.dev/documentation/webdriver/troubleshooting/logging 2024-09-04 20:43:45 WARN Selenium [:selenium_manager] The geckodriver version (0.34.0) detected in PATH at /usr/local/bin/geckodriver might not be compatible with the detected firefox version (115.15.0); currently, geckodriver 0.35.0 is recommended for firefox 115.*, so it is advised to delete the driver in PATH and retry Running 1827 tests in parallel using 8 processes Run options: --seed 56833 # Running: ................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................... Finished in 161.717326s, 11.2975 runs/s, 6194.9330 assertions/s. 1827 runs, 1001828 assertions, 0 failures, 0 errors, 0 skips Coverage report generated for Minitest, Minitest-0, Minitest-1, Minitest-2, Minitest-3, Minitest-4, Minitest-5, Minitest-6, Minitest-7 to /app/coverage. 6302 / 6688 LOC (94.23%) covered. Lcov style coverage report generated for Minitest, Minitest-0, Minitest-1, Minitest-2, Minitest-3, Minitest-4, Minitest-5, Minitest-6, Minitest-7 to coverage/lcov.info
I'm using Docker version 27.2.0, build 3ab4256 on Ubuntu 22.04.
It worked perfectly on my Windows 11 Intel based machine too, but, we hit some troubles under Arm based MacBook last time we tried. If I remember well, the problem was in ARM packages (@kcne please, correct me if I'm wrong).
I tried the Debian docker image. Everything seems to work fine here:
docker compose run --rm web bundle exec rails test:all [+] Creating 1/0 ✔ Container openstreetmap-website-db-1 Running 0.0s 2024-09-04 20:43:45 INFO Selenium [:logger_info] Details on how to use and modify Selenium logger: https://selenium.dev/documentation/webdriver/troubleshooting/logging 2024-09-04 20:43:45 WARN Selenium [:selenium_manager] The geckodriver version (0.34.0) detected in PATH at /usr/local/bin/geckodriver might not be compatible with the detected firefox version (115.15.0); currently, geckodriver 0.35.0 is recommended for firefox 115.*, so it is advised to delete the driver in PATH and retry Running 1827 tests in parallel using 8 processes Run options: --seed 56833 # Running: ................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................... Finished in 161.717326s, 11.2975 runs/s, 6194.9330 assertions/s. 1827 runs, 1001828 assertions, 0 failures, 0 errors, 0 skips Coverage report generated for Minitest, Minitest-0, Minitest-1, Minitest-2, Minitest-3, Minitest-4, Minitest-5, Minitest-6, Minitest-7 to /app/coverage. 6302 / 6688 LOC (94.23%) covered. Lcov style coverage report generated for Minitest, Minitest-0, Minitest-1, Minitest-2, Minitest-3, Minitest-4, Minitest-5, Minitest-6, Minitest-7 to coverage/lcov.info
I'm using Docker version 27.2.0, build 3ab4256 on Ubuntu 22.04.
It worked perfectly on my Windows 11 Intel based machine too, but, we hit some troubles under Arm based MacBook last time we tried. If I remember well, the problem was in ARM packages (@kcne please, correct me if I'm wrong).
The error with packages as mentioned in this comment was encountered on ubuntu 24.04. The issue was most likely due to geckodriver and firefox versions being out of sync. I didn't know that back then since last geckodriver version was the one I used in this image which is 0.34
In #4992 the nodejs version was updated to node18, but only for Docker. The version wasn't updated for either the installation instructions (INSTALL.md), nor for the vagrant installation. These three alternatives should be kept in sync at all times.
The reason that nodejs had to be upgraded to version 18 was because eslint 9 requires it. The previous version of eslint, version 8, also ran on node 12, which is what is shipped on Ubuntu 22.04. https://github.com/openstreetmap/openstreetmap-website/commit/938037d6a26baecd334944957882c0108d2176e6 was the upgrade. This wasn't picked up as a breaking change in CI, since the "github flavoured ubuntu" used in CI doesn't use the Ubuntu node packages that INSTALL.md and vagrant use.
We need to do one of the following:
We also need to consider what extra things we can do to avoid this from happening again. For example,