pact-foundation / pact-broker-docker

Dockerized Pact Broker
https://pact.io
MIT License
107 stars 109 forks source link

Error with SQLite Backend #148

Closed JP-Ellis closed 9 months ago

JP-Ellis commented 1 year ago

I am trying to run the pact-broker image using the SQLite backend within a test suite.

Unfortunately, the image crushes with the main error being:

! Unable to load application: Sequel::AdapterNotFound: LoadError: cannot load such file -- sqlite3/sqlite3_native
bundler: failed to load command: puma (/pact_broker/vendor/bundle/ruby/3.2.0/bin/puma)

Steps to reproduce and Logs

```sh docker run \ --env PACT_BROKER_DATABASE_ADAPTER=sqlite \ --env PACT_BROKER_DATABASE_NAME=pact_broker.sqlite \ pactfoundation/pact-broker:latest-multi ``` ```text Puma starting in single mode... * Puma version: 5.6.7 (ruby 3.2.1-p31) ("Birdie's Version") * Min threads: 0 * Max threads: 5 * Environment: production * PID: 2 2023-09-17 23:56:39.408758 I [2:3240] pact-broker -- Connecting to database: -- {:adapter=>"sqlite", :database=>"pact_broker.sqlite", :encoding=>"utf8", :sql_log_level=>:none, :enable_caller_logging=>false, :log_warn_duration=>5.0, :pool_timeout=>5, :connect_max_retries=>0, :password=>"*****"} ! Unable to load application: Sequel::AdapterNotFound: LoadError: cannot load such file -- sqlite3/sqlite3_native bundler: failed to load command: puma (/pact_broker/vendor/bundle/ruby/3.2.0/bin/puma) :37:in `require': LoadError: cannot load such file -- sqlite3/sqlite3_native (Sequel::AdapterNotFound) from :37:in `require' from /pact_broker/vendor/bundle/ruby/3.2.0/gems/sqlite3-1.6.3-aarch64-linux/lib/sqlite3.rb:6:in `rescue in ' from /pact_broker/vendor/bundle/ruby/3.2.0/gems/sqlite3-1.6.3-aarch64-linux/lib/sqlite3.rb:2:in `' from :37:in `require' from :37:in `require' from /pact_broker/vendor/bundle/ruby/3.2.0/gems/sequel-5.71.0/lib/sequel/adapters/sqlite.rb:3:in `' from :37:in `require' from :37:in `require' from /pact_broker/vendor/bundle/ruby/3.2.0/gems/sequel-5.71.0/lib/sequel/database/connecting.rb:87:in `load_adapter' from /pact_broker/vendor/bundle/ruby/3.2.0/gems/sequel-5.71.0/lib/sequel/database/connecting.rb:17:in `adapter_class' from /pact_broker/vendor/bundle/ruby/3.2.0/gems/sequel-5.71.0/lib/sequel/database/connecting.rb:45:in `connect' from /pact_broker/vendor/bundle/ruby/3.2.0/gems/sequel-5.71.0/lib/sequel/core.rb:124:in `connect' from /pact_broker/vendor/bundle/ruby/3.2.0/gems/pact_broker-2.107.1/lib/pact_broker/initializers/database_connection.rb:17:in `block in create_database_connection' from /pact_broker/vendor/bundle/ruby/3.2.0/gems/pact_broker-2.107.1/lib/pact_broker/initializers/database_connection.rb:31:in `with_retries' from /pact_broker/vendor/bundle/ruby/3.2.0/gems/pact_broker-2.107.1/lib/pact_broker/initializers/database_connection.rb:16:in `create_database_connection' from /pact_broker/vendor/bundle/ruby/3.2.0/gems/pact_broker-2.107.1/lib/pact_broker/app.rb:135:in `configure_database_connection' from /pact_broker/vendor/bundle/ruby/3.2.0/gems/pact_broker-2.107.1/lib/pact_broker/app.rb:99:in `post_configure' from /pact_broker/vendor/bundle/ruby/3.2.0/gems/pact_broker-2.107.1/lib/pact_broker/app.rb:50:in `initialize' from config.ru:4:in `new' from config.ru:4:in `block in
' from /pact_broker/vendor/bundle/ruby/3.2.0/gems/rack-2.2.8/lib/rack/builder.rb:116:in `eval' from /pact_broker/vendor/bundle/ruby/3.2.0/gems/rack-2.2.8/lib/rack/builder.rb:116:in `new_from_string' from /pact_broker/vendor/bundle/ruby/3.2.0/gems/rack-2.2.8/lib/rack/builder.rb:105:in `load_file' from /pact_broker/vendor/bundle/ruby/3.2.0/gems/rack-2.2.8/lib/rack/builder.rb:66:in `parse_file' from /pact_broker/vendor/bundle/ruby/3.2.0/gems/puma-5.6.7/lib/puma/configuration.rb:348:in `load_rackup' from /pact_broker/vendor/bundle/ruby/3.2.0/gems/puma-5.6.7/lib/puma/configuration.rb:270:in `app' from /pact_broker/vendor/bundle/ruby/3.2.0/gems/puma-5.6.7/lib/puma/runner.rb:150:in `load_and_bind' from /pact_broker/vendor/bundle/ruby/3.2.0/gems/puma-5.6.7/lib/puma/single.rb:44:in `run' from /pact_broker/vendor/bundle/ruby/3.2.0/gems/puma-5.6.7/lib/puma/launcher.rb:193:in `run' from /pact_broker/vendor/bundle/ruby/3.2.0/gems/puma-5.6.7/lib/puma/cli.rb:81:in `run' from /pact_broker/vendor/bundle/ruby/3.2.0/gems/puma-5.6.7/bin/puma:10:in `' from /pact_broker/vendor/bundle/ruby/3.2.0/bin/puma:25:in `load' from /pact_broker/vendor/bundle/ruby/3.2.0/bin/puma:25:in `' from /usr/local/bundle/gems/bundler-2.4.12/lib/bundler/cli/exec.rb:58:in `load' from /usr/local/bundle/gems/bundler-2.4.12/lib/bundler/cli/exec.rb:58:in `kernel_load' from /usr/local/bundle/gems/bundler-2.4.12/lib/bundler/cli/exec.rb:23:in `run' from /usr/local/bundle/gems/bundler-2.4.12/lib/bundler/cli.rb:492:in `exec' from /usr/local/bundle/gems/bundler-2.4.12/lib/bundler/vendor/thor/lib/thor/command.rb:27:in `run' from /usr/local/bundle/gems/bundler-2.4.12/lib/bundler/vendor/thor/lib/thor/invocation.rb:127:in `invoke_command' from /usr/local/bundle/gems/bundler-2.4.12/lib/bundler/vendor/thor/lib/thor.rb:392:in `dispatch' from /usr/local/bundle/gems/bundler-2.4.12/lib/bundler/cli.rb:34:in `dispatch' from /usr/local/bundle/gems/bundler-2.4.12/lib/bundler/vendor/thor/lib/thor/base.rb:485:in `start' from /usr/local/bundle/gems/bundler-2.4.12/lib/bundler/cli.rb:28:in `start' from /usr/local/bundle/gems/bundler-2.4.12/exe/bundle:45:in `block in ' from /usr/local/bundle/gems/bundler-2.4.12/lib/bundler/friendly_errors.rb:117:in `with_friendly_errors' from /usr/local/bundle/gems/bundler-2.4.12/exe/bundle:33:in `' from /usr/local/bundle/bin/bundle:25:in `load' from /usr/local/bundle/bin/bundle:25:in `
' :37:in `require': cannot load such file -- sqlite3/sqlite3_native (LoadError) from :37:in `require' from /pact_broker/vendor/bundle/ruby/3.2.0/gems/sqlite3-1.6.3-aarch64-linux/lib/sqlite3.rb:6:in `rescue in ' from /pact_broker/vendor/bundle/ruby/3.2.0/gems/sqlite3-1.6.3-aarch64-linux/lib/sqlite3.rb:2:in `' from :37:in `require' from :37:in `require' from /pact_broker/vendor/bundle/ruby/3.2.0/gems/sequel-5.71.0/lib/sequel/adapters/sqlite.rb:3:in `' from :37:in `require' from :37:in `require' from /pact_broker/vendor/bundle/ruby/3.2.0/gems/sequel-5.71.0/lib/sequel/database/connecting.rb:87:in `load_adapter' from /pact_broker/vendor/bundle/ruby/3.2.0/gems/sequel-5.71.0/lib/sequel/database/connecting.rb:17:in `adapter_class' from /pact_broker/vendor/bundle/ruby/3.2.0/gems/sequel-5.71.0/lib/sequel/database/connecting.rb:45:in `connect' from /pact_broker/vendor/bundle/ruby/3.2.0/gems/sequel-5.71.0/lib/sequel/core.rb:124:in `connect' from /pact_broker/vendor/bundle/ruby/3.2.0/gems/pact_broker-2.107.1/lib/pact_broker/initializers/database_connection.rb:17:in `block in create_database_connection' from /pact_broker/vendor/bundle/ruby/3.2.0/gems/pact_broker-2.107.1/lib/pact_broker/initializers/database_connection.rb:31:in `with_retries' from /pact_broker/vendor/bundle/ruby/3.2.0/gems/pact_broker-2.107.1/lib/pact_broker/initializers/database_connection.rb:16:in `create_database_connection' from /pact_broker/vendor/bundle/ruby/3.2.0/gems/pact_broker-2.107.1/lib/pact_broker/app.rb:135:in `configure_database_connection' from /pact_broker/vendor/bundle/ruby/3.2.0/gems/pact_broker-2.107.1/lib/pact_broker/app.rb:99:in `post_configure' from /pact_broker/vendor/bundle/ruby/3.2.0/gems/pact_broker-2.107.1/lib/pact_broker/app.rb:50:in `initialize' from config.ru:4:in `new' from config.ru:4:in `block in
' from /pact_broker/vendor/bundle/ruby/3.2.0/gems/rack-2.2.8/lib/rack/builder.rb:116:in `eval' from /pact_broker/vendor/bundle/ruby/3.2.0/gems/rack-2.2.8/lib/rack/builder.rb:116:in `new_from_string' from /pact_broker/vendor/bundle/ruby/3.2.0/gems/rack-2.2.8/lib/rack/builder.rb:105:in `load_file' from /pact_broker/vendor/bundle/ruby/3.2.0/gems/rack-2.2.8/lib/rack/builder.rb:66:in `parse_file' from /pact_broker/vendor/bundle/ruby/3.2.0/gems/puma-5.6.7/lib/puma/configuration.rb:348:in `load_rackup' from /pact_broker/vendor/bundle/ruby/3.2.0/gems/puma-5.6.7/lib/puma/configuration.rb:270:in `app' from /pact_broker/vendor/bundle/ruby/3.2.0/gems/puma-5.6.7/lib/puma/runner.rb:150:in `load_and_bind' from /pact_broker/vendor/bundle/ruby/3.2.0/gems/puma-5.6.7/lib/puma/single.rb:44:in `run' from /pact_broker/vendor/bundle/ruby/3.2.0/gems/puma-5.6.7/lib/puma/launcher.rb:193:in `run' from /pact_broker/vendor/bundle/ruby/3.2.0/gems/puma-5.6.7/lib/puma/cli.rb:81:in `run' from /pact_broker/vendor/bundle/ruby/3.2.0/gems/puma-5.6.7/bin/puma:10:in `' from /pact_broker/vendor/bundle/ruby/3.2.0/bin/puma:25:in `load' from /pact_broker/vendor/bundle/ruby/3.2.0/bin/puma:25:in `' from /usr/local/bundle/gems/bundler-2.4.12/lib/bundler/cli/exec.rb:58:in `load' from /usr/local/bundle/gems/bundler-2.4.12/lib/bundler/cli/exec.rb:58:in `kernel_load' from /usr/local/bundle/gems/bundler-2.4.12/lib/bundler/cli/exec.rb:23:in `run' from /usr/local/bundle/gems/bundler-2.4.12/lib/bundler/cli.rb:492:in `exec' from /usr/local/bundle/gems/bundler-2.4.12/lib/bundler/vendor/thor/lib/thor/command.rb:27:in `run' from /usr/local/bundle/gems/bundler-2.4.12/lib/bundler/vendor/thor/lib/thor/invocation.rb:127:in `invoke_command' from /usr/local/bundle/gems/bundler-2.4.12/lib/bundler/vendor/thor/lib/thor.rb:392:in `dispatch' from /usr/local/bundle/gems/bundler-2.4.12/lib/bundler/cli.rb:34:in `dispatch' from /usr/local/bundle/gems/bundler-2.4.12/lib/bundler/vendor/thor/lib/thor/base.rb:485:in `start' from /usr/local/bundle/gems/bundler-2.4.12/lib/bundler/cli.rb:28:in `start' from /usr/local/bundle/gems/bundler-2.4.12/exe/bundle:45:in `block in ' from /usr/local/bundle/gems/bundler-2.4.12/lib/bundler/friendly_errors.rb:117:in `with_friendly_errors' from /usr/local/bundle/gems/bundler-2.4.12/exe/bundle:33:in `' from /usr/local/bundle/bin/bundle:25:in `load' from /usr/local/bundle/bin/bundle:25:in `
' :37:in `require': Error relocating /pact_broker/vendor/bundle/ruby/3.2.0/gems/sqlite3-1.6.3-aarch64-linux/lib/sqlite3/3.2/sqlite3_native.so: fcntl64: symbol not found - /pact_broker/vendor/bundle/ruby/3.2.0/gems/sqlite3-1.6.3-aarch64-linux/lib/sqlite3/3.2/sqlite3_native.so (LoadError) from :37:in `require' from /pact_broker/vendor/bundle/ruby/3.2.0/gems/sqlite3-1.6.3-aarch64-linux/lib/sqlite3.rb:4:in `' from :37:in `require' from :37:in `require' from /pact_broker/vendor/bundle/ruby/3.2.0/gems/sequel-5.71.0/lib/sequel/adapters/sqlite.rb:3:in `' from :37:in `require' from :37:in `require' from /pact_broker/vendor/bundle/ruby/3.2.0/gems/sequel-5.71.0/lib/sequel/database/connecting.rb:87:in `load_adapter' from /pact_broker/vendor/bundle/ruby/3.2.0/gems/sequel-5.71.0/lib/sequel/database/connecting.rb:17:in `adapter_class' from /pact_broker/vendor/bundle/ruby/3.2.0/gems/sequel-5.71.0/lib/sequel/database/connecting.rb:45:in `connect' from /pact_broker/vendor/bundle/ruby/3.2.0/gems/sequel-5.71.0/lib/sequel/core.rb:124:in `connect' from /pact_broker/vendor/bundle/ruby/3.2.0/gems/pact_broker-2.107.1/lib/pact_broker/initializers/database_connection.rb:17:in `block in create_database_connection' from /pact_broker/vendor/bundle/ruby/3.2.0/gems/pact_broker-2.107.1/lib/pact_broker/initializers/database_connection.rb:31:in `with_retries' from /pact_broker/vendor/bundle/ruby/3.2.0/gems/pact_broker-2.107.1/lib/pact_broker/initializers/database_connection.rb:16:in `create_database_connection' from /pact_broker/vendor/bundle/ruby/3.2.0/gems/pact_broker-2.107.1/lib/pact_broker/app.rb:135:in `configure_database_connection' from /pact_broker/vendor/bundle/ruby/3.2.0/gems/pact_broker-2.107.1/lib/pact_broker/app.rb:99:in `post_configure' from /pact_broker/vendor/bundle/ruby/3.2.0/gems/pact_broker-2.107.1/lib/pact_broker/app.rb:50:in `initialize' from config.ru:4:in `new' from config.ru:4:in `block in
' from /pact_broker/vendor/bundle/ruby/3.2.0/gems/rack-2.2.8/lib/rack/builder.rb:116:in `eval' from /pact_broker/vendor/bundle/ruby/3.2.0/gems/rack-2.2.8/lib/rack/builder.rb:116:in `new_from_string' from /pact_broker/vendor/bundle/ruby/3.2.0/gems/rack-2.2.8/lib/rack/builder.rb:105:in `load_file' from /pact_broker/vendor/bundle/ruby/3.2.0/gems/rack-2.2.8/lib/rack/builder.rb:66:in `parse_file' from /pact_broker/vendor/bundle/ruby/3.2.0/gems/puma-5.6.7/lib/puma/configuration.rb:348:in `load_rackup' from /pact_broker/vendor/bundle/ruby/3.2.0/gems/puma-5.6.7/lib/puma/configuration.rb:270:in `app' from /pact_broker/vendor/bundle/ruby/3.2.0/gems/puma-5.6.7/lib/puma/runner.rb:150:in `load_and_bind' from /pact_broker/vendor/bundle/ruby/3.2.0/gems/puma-5.6.7/lib/puma/single.rb:44:in `run' from /pact_broker/vendor/bundle/ruby/3.2.0/gems/puma-5.6.7/lib/puma/launcher.rb:193:in `run' from /pact_broker/vendor/bundle/ruby/3.2.0/gems/puma-5.6.7/lib/puma/cli.rb:81:in `run' from /pact_broker/vendor/bundle/ruby/3.2.0/gems/puma-5.6.7/bin/puma:10:in `' from /pact_broker/vendor/bundle/ruby/3.2.0/bin/puma:25:in `load' from /pact_broker/vendor/bundle/ruby/3.2.0/bin/puma:25:in `' from /usr/local/bundle/gems/bundler-2.4.12/lib/bundler/cli/exec.rb:58:in `load' from /usr/local/bundle/gems/bundler-2.4.12/lib/bundler/cli/exec.rb:58:in `kernel_load' from /usr/local/bundle/gems/bundler-2.4.12/lib/bundler/cli/exec.rb:23:in `run' from /usr/local/bundle/gems/bundler-2.4.12/lib/bundler/cli.rb:492:in `exec' from /usr/local/bundle/gems/bundler-2.4.12/lib/bundler/vendor/thor/lib/thor/command.rb:27:in `run' from /usr/local/bundle/gems/bundler-2.4.12/lib/bundler/vendor/thor/lib/thor/invocation.rb:127:in `invoke_command' from /usr/local/bundle/gems/bundler-2.4.12/lib/bundler/vendor/thor/lib/thor.rb:392:in `dispatch' from /usr/local/bundle/gems/bundler-2.4.12/lib/bundler/cli.rb:34:in `dispatch' from /usr/local/bundle/gems/bundler-2.4.12/lib/bundler/vendor/thor/lib/thor/base.rb:485:in `start' from /usr/local/bundle/gems/bundler-2.4.12/lib/bundler/cli.rb:28:in `start' from /usr/local/bundle/gems/bundler-2.4.12/exe/bundle:45:in `block in ' from /usr/local/bundle/gems/bundler-2.4.12/lib/bundler/friendly_errors.rb:117:in `with_friendly_errors' from /usr/local/bundle/gems/bundler-2.4.12/exe/bundle:33:in `' from /usr/local/bundle/bin/bundle:25:in `load' from /usr/local/bundle/bin/bundle:25:in `
' ```

Software versions

Docker Image docker.io/pactfoundation/pact-broker:latest-multi 5fdce916114d
Operating System macOS 13.5.2 on arm64
Docker Version podman 4.6.2
RykoL commented 9 months ago

Can confirm this release breaks deployment with sqlite. Same error coming from a different project https://gitlab.alpinelinux.org/alpine/aports/-/issues/15583

YOU54F commented 9 months ago

Thanks for the links that is really helpful @RykoL

Initially we only saw this on the aarch64 images, but it is now cropping up in the x86_64 version

pact-broker-1  | <internal:/usr/local/lib/ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:38:in `require': Error relocating /pact_broker/vendor/bundle/ruby/3.2.0/gems/sqlite3-1.7.2-x86_64-linux/lib/sqlite3/3.2/sqlite3_native.so: posix_fallocate64: symbol not found - /pact_broker/vendor/bundle/ruby/3.2.0/gems/sqlite3-1.7.2-x86_64-linux/lib/sqlite3/3.2/sqlite3_native.so (LoadError)
pact-broker-1  |        from <internal:/usr/local/lib/ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:38:in `require'
pact-broker-1  |        from /pact_broker/vendor/bundle/ruby/3.2.0/gems/sqlite3-1.7.2-x86_64-linux/lib/sqlite3.rb:4:in `<top (required)>'
pact-broker-1  |        from <internal:/usr/local/lib/ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:38:in `require'
pact-broker-1  |        from <internal:/usr/local/lib/ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:38:in `require'
pact-broker-1  |        from /pact_broker/vendor/bundle/ruby/3.2.0/gems/sequel-5.77.0/lib/sequel/adapters/sqlite.rb:3:in `<top (required)>'
pact-broker-1  |        from <internal:/usr/local/lib/ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:38:in `require'
pact-broker-1  |        from <internal:/usr/local/lib/ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:38:in `require'
pact-broker-1  |        from /pact_broker/vendor/bundle/ruby/3.2.0/gems/sequel-5.77.0/lib/sequel/database/connecting.rb:87:in `load_adapter'
pact-broker-1  |        from /pact_broker/vendor/bundle/ruby/3.2.0/gems/sequel-5.77.0/lib/sequel/database/connecting.rb:17:in `adapter_class'
pact-broker-1  |        from /pact_broker/vendor/bundle/ruby/3.2.0/gems/sequel-5.77.0/lib/sequel/database/connecting.rb:45:in `connect'
pact-broker-1  |        from /pact_broker/vendor/bundle/ruby/3.2.0/gems/sequel-5.77.0/lib/sequel/core.rb:124:in `connect'
pact-broker-1  |        from /pact_broker/vendor/bundle/ruby/3.2.0/gems/pact_broker-2.109.0/lib/pact_broker/initializers/database_connection.rb:17:in `block in create_database_connection'
pact-broker-1  |        from /pact_broker/vendor/bundle/ruby/3.2.0/gems/pact_broker-2.109.0/lib/pact_broker/initializers/database_connection.rb:31:in `with_retries'
pact-broker-1  |        from /pact_broker/vendor/bundle/ruby/3.2.0/gems/pact_broker-2.109.0/lib/pact_broker/initializers/database_connection.rb:16:in `create_database_connection'
pact-broker-1  |        from /pact_broker/vendor/bundle/ruby/3.2.0/gems/pact_broker-2.109.0/lib/pact_broker/app.rb:134:in `configure_database_connection'
pact-broker-1  |        from /pact_broker/vendor/bundle/ruby/3.2.0/gems/pact_broker-2.109.0/lib/pact_broker/app.rb:98:in `post_configure'
pact-broker-1  |        from /pact_broker/vendor/bundle/ruby/3.2.0/gems/pact_broker-2.109.0/lib/pact_broker/app.rb:49:in `initialize'
pact-broker-1  |        from config.ru:4:in `new'
pact-broker-1  |        from config.ru:4:in `block in <main>'

I'll have a look at compiling sqlite from source in the image.

For now x86_64 users should pin to 2.114.0-pactbroker2.108.0

YOU54F commented 9 months ago

Release going out now

https://github.com/pact-foundation/pact-broker-docker/actions/runs/7805779592