Project

General

Profile

Actions

tickets #158931

open

TSP Ruby stack broken

Added by crameleon 15 days ago. Updated 5 days ago.

Status:
New
Priority:
Normal
Assignee:
-
Category:
TSP
Target version:
-
Start date:
2024-04-14
Due date:
% Done:

0%

Estimated time:

Description

First this:

Installing mini_racer 0.6.3 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

    current directory: /srv/www/travel-support-program/vendor/bundle/ruby/2.7.0/gems/mini_racer-0.6.3/ext/mini_racer_extension
/usr/bin/ruby.ruby2.7 -I /usr/lib64/ruby/2.7.0 -r ./siteconf20240414-25905-qvao35.rb extconf.rb
checking for -lpthread... yes
checking for whether -Wl,--exclude-libs=ALL  is accepted as LDFLAGS... no
creating Makefile

current directory: /srv/www/travel-support-program/vendor/bundle/ruby/2.7.0/gems/mini_racer-0.6.3/ext/mini_racer_extension
make "DESTDIR=" clean

current directory: /srv/www/travel-support-program/vendor/bundle/ruby/2.7.0/gems/mini_racer-0.6.3/ext/mini_racer_extension
make "DESTDIR="
compiling mini_racer_extension.cc
linking shared-object mini_racer_extension.so
g++: error: /srv/www/travel-support-program/vendor/bundle/ruby/2.7.0/gems/libv8-node-16.10.0.0-x86_64-linux-musl/vendor/v8/x86_64-linux/libv8/obj/libv8_monolith.a: No such file or directory
make: *** [Makefile:263: mini_racer_extension.so] Error 1

make failed, exit code 2

Hacked around by:

tsp (Travel Support Program webapp):/srv/www/travel-support-program # find -name libv8_monolith.a
./vendor-20240414/bundle/ruby/2.7.0/gems/libv8-node-16.10.0.0-x86_64-linux-musl/vendor/v8/x86_64-linux-musl/libv8/obj/libv8_monolith.a
./vendor/bundle/ruby/2.7.0/gems/libv8-node-16.10.0.0-x86_64-linux-musl/vendor/v8/x86_64-linux-musl/libv8/obj/libv8_monolith.a
tsp (Travel Support Program webapp):/srv/www/travel-support-program # mkdir -p /srv/www/travel-support-program/vendor/bundle/ruby/2.7.0/gems/libv8-node-16.10.0.0-x86_64-linux-musl/vendor/v8/x8
6_64-linux/libv8/obj
tsp (Travel Support Program webapp):/srv/www/travel-support-program # ln -s $PWD/vendor/bundle/ruby/2.7.0/gems/libv8-node-16.10.0.0-x86_64-linux-musl/vendor/v8/x86_64-linux-musl/libv8/obj/libv
8_monolith.a /srv/www/travel-support-program/vendor/bundle/ruby/2.7.0/gems/libv8-node-16.10.0.0-x86_64-linux-musl/vendor/v8/x86_64-linux/libv8/obj/libv8_monolith.a

Now this:

tsp (Travel Support Program webapp):/srv/www/travel-support-program # RAILS_ENV=production sudo -Eu tsp rake.ruby.ruby2.7 db:migrate:status
rake aborted!
Gem::LoadError: Specified 'postgresql' for database adapter, but the gem is not loaded. Add `gem 'pg'` to your Gemfile (and ensure its version is at the minimum required by ActiveRecord).
/srv/www/travel-support-program/vendor/bundle/ruby/2.7.0/gems/activerecord-5.1.7/lib/active_record/connection_adapters/connection_specification.rb:188:in `rescue in spec'
/srv/www/travel-support-program/vendor/bundle/ruby/2.7.0/gems/activerecord-5.1.7/lib/active_record/connection_adapters/connection_specification.rb:185:in `spec'
/srv/www/travel-support-program/vendor/bundle/ruby/2.7.0/gems/activerecord-5.1.7/lib/active_record/connection_adapters/abstract/connection_pool.rb:882:in `establish_connection'
/srv/www/travel-support-program/vendor/bundle/ruby/2.7.0/gems/activerecord-5.1.7/lib/active_record/connection_handling.rb:58:in `establish_connection'
/srv/www/travel-support-program/vendor/bundle/ruby/2.7.0/gems/activerecord-5.1.7/lib/active_record/railtie.rb:124:in `block (2 levels) in <class:Railtie>'
/srv/www/travel-support-program/vendor/bundle/ruby/2.7.0/gems/activesupport-5.1.7/lib/active_support/lazy_load_hooks.rb:69:in `instance_eval'
/srv/www/travel-support-program/vendor/bundle/ruby/2.7.0/gems/activesupport-5.1.7/lib/active_support/lazy_load_hooks.rb:69:in `block in execute_hook'
/srv/www/travel-support-program/vendor/bundle/ruby/2.7.0/gems/activesupport-5.1.7/lib/active_support/lazy_load_hooks.rb:60:in `with_execution_control'
/srv/www/travel-support-program/vendor/bundle/ruby/2.7.0/gems/activesupport-5.1.7/lib/active_support/lazy_load_hooks.rb:65:in `execute_hook'
/srv/www/travel-support-program/vendor/bundle/ruby/2.7.0/gems/activesupport-5.1.7/lib/active_support/lazy_load_hooks.rb:41:in `block in on_load'
/srv/www/travel-support-program/vendor/bundle/ruby/2.7.0/gems/activesupport-5.1.7/lib/active_support/lazy_load_hooks.rb:40:in `each'
/srv/www/travel-support-program/vendor/bundle/ruby/2.7.0/gems/activesupport-5.1.7/lib/active_support/lazy_load_hooks.rb:40:in `on_load'
/srv/www/travel-support-program/vendor/bundle/ruby/2.7.0/gems/activerecord-5.1.7/lib/active_record/railtie.rb:120:in `block in <class:Railtie>'
/srv/www/travel-support-program/vendor/bundle/ruby/2.7.0/gems/railties-5.1.7/lib/rails/initializable.rb:30:in `instance_exec'
/srv/www/travel-support-program/vendor/bundle/ruby/2.7.0/gems/railties-5.1.7/lib/rails/initializable.rb:30:in `run'
/srv/www/travel-support-program/vendor/bundle/ruby/2.7.0/gems/railties-5.1.7/lib/rails/initializable.rb:59:in `block in run_initializers'
/srv/www/travel-support-program/vendor/bundle/ruby/2.7.0/gems/railties-5.1.7/lib/rails/initializable.rb:58:in `run_initializers'
/srv/www/travel-support-program/vendor/bundle/ruby/2.7.0/gems/railties-5.1.7/lib/rails/application.rb:353:in `initialize!'
/srv/www/travel-support-program/config/environment.rb:5:in `<top (required)>'
/srv/www/travel-support-program/vendor/bundle/ruby/2.7.0/gems/activesupport-5.1.7/lib/active_support/dependencies.rb:292:in `require'
/srv/www/travel-support-program/vendor/bundle/ruby/2.7.0/gems/activesupport-5.1.7/lib/active_support/dependencies.rb:292:in `block in require'
/srv/www/travel-support-program/vendor/bundle/ruby/2.7.0/gems/activesupport-5.1.7/lib/active_support/dependencies.rb:258:in `load_dependency'
/srv/www/travel-support-program/vendor/bundle/ruby/2.7.0/gems/activesupport-5.1.7/lib/active_support/dependencies.rb:292:in `require'
/srv/www/travel-support-program/vendor/bundle/ruby/2.7.0/gems/railties-5.1.7/lib/rails/application.rb:329:in `require_environment!'
/srv/www/travel-support-program/vendor/bundle/ruby/2.7.0/gems/railties-5.1.7/lib/rails/application.rb:445:in `block in run_tasks_blocks'
/usr/bin/rake.ruby.ruby2.7:23:in `load'
/usr/bin/rake.ruby.ruby2.7:23:in `<main>'

Caused by:
Gem::LoadError: pg is not part of the bundle. Add it to your Gemfile.

In "Gemfile" the "pg" line is commented:
https://github.com/openSUSE/travel-support-program/blob/master/Gemfile#L11

I uncommented it in our checkout (also a workaround, how are we ever supposed to update this with local changes to a file tracked by VCS), but

tsp (Travel Support Program webapp):/srv/www/travel-support-program # RAILS_ENV=production sudo -Eu tsp rake.ruby.ruby2.7 db:migrate:status
You are trying to install in deployment mode after changing
your Gemfile. Run `bundle install` elsewhere and add the
updated Gemfile.lock to version control.

If this is a development machine, remove the /srv/www/travel-support-program/Gemfile freeze
by running `bundle config unset deployment`.

The dependencies in your gemfile changed

You have added to the Gemfile:
* pg (~> 0.21)
Actions #1

Updated by crameleon 15 days ago

  • Private changed from Yes to No
Actions #2

Updated by crameleon 15 days ago

Also tried:

tsp (Travel Support Program webapp):/srv/www/travel-support-program # sudo -u tsp bundle.ruby.ruby2.7 config unset deployment
tsp (Travel Support Program webapp):/srv/www/travel-support-program # sudo -u tsp bundler.ruby.ruby2.7 install
...
Fetching pg 0.21.0
Installing pg 0.21.0 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

    current directory: /srv/www/travel-support-program/vendor/bundle/ruby/2.7.0/gems/pg-0.21.0/ext
/usr/bin/ruby.ruby2.7 -I /usr/lib64/ruby/2.7.0 -r ./siteconf20240414-27272-wbja3y.rb extconf.rb
checking for pg_config... no
No pg_config... trying anyway. If building fails, please try again with
 --with-pg-config=/path/to/pg_config
checking for libpq-fe.h... no
Can't find the 'libpq-fe.h header
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers.  Check the mkmf.log file for more details.  You may
need configuration options.

Why all this development stuff needs to be on a production machine is beyond me.

Actions #3

Updated by crameleon 15 days ago

The instructions in https://github.com/openSUSE/travel-support-program/blob/master/doc/INSTALL.md#getting-started don't work either from a fresh checkout:

tsp (Travel Support Program webapp):/srv/www/travel-support-program # vim Gemfile
# uncomment pg line
tsp (Travel Support Program webapp):/srv/www/travel-support-program # sudo -u tsp bundle.ruby.ruby2.7
You are trying to install in deployment mode after changing
your Gemfile. Run `bundle install` elsewhere and add the
updated Gemfile.lock to version control.

If this is a development machine, remove the /srv/www/travel-support-program/Gemfile freeze
by running `bundle config unset deployment`.

The dependencies in your gemfile changed

You have added to the Gemfile:
* pg (~> 0.21)
Actions #4

Updated by crameleon 15 days ago

tsp (Travel Support Program webapp):/srv/www/travel-support-program # rpm -ql postgresql12-server-devel|grep /usr/bin/pg_config
/usr/bin/pg_config
tsp (Travel Support Program webapp):/srv/www/travel-support-program # ls /usr/bin/pg_config
ls: cannot access '/usr/bin/pg_config': No such file or directory
Actions #5

Updated by crameleon 15 days ago

Reinstalling postgresql12-server-devel did not bring the file (which turns out to be an alternatives link) back, but installing postgresql13-server-devel did.
After that, the bundle call also worked and compiled some things.

Great, now db:migrate:status works and returns two "down" lines. But db:migrate brings more errors:

PG::DuplicateTable: ERROR:  relation "event_emails" already exists
: CREATE TABLE "event_emails" ("id" serial NOT NULL PRIMARY KEY, "to" text, "subject" character varying, "body" text, "user_id" integer, "event_id" integer, "created_at" timestamp, "updated_at
" timestamp)
Actions #6

Updated by crameleon 15 days ago

Hacking around that, I was now able to bring it up again.
All very ugly, please someone configure this properly:

  • all configuration in VCS (Salt or upstream)
  • automatic updates need to work without breakage / service needs to come back
Actions #7

Updated by hellcp 5 days ago

I might have a look at setting up an rpm for this to avoid these issues. Frankly we might need to have the default database backend set in the Gemfile to avoid these issues, since it causes problems with the development setup too

Actions

Also available in: Atom PDF