Foreman Install on FreeBSD 13.1

Problem:
Foreman not supported on FreeBSD

Expected outcome:
Me pulling my hair out finding a way.

Foreman and Proxy versions:
latest

Other relevant data:

I’ve been asked to test foreman out on FreeBSD. Surely somebody somewhere somehow at least attempted this sometime. Hopefully one of you can point me in the right direction?

Maybe a more general question would be, how would one go about this on any unsupported platform? Is there a tarball I could try compiling from source? Will somebody pay me gobs of money for figuring this out for them? :smiley:

It could be doable. We’ve had one person who even maintained FreeBSD ports for foreman, but it’s been some time already since they left. The puppet modules (that the installer is built on top of) have some mentions of FreeBSD, but ymmv.

Probably the path of least resistance would be running it from source.

You can get a state of the repository at certain tag from github. And since it is ruby, you will not really be compiling anything. Just download, extract, get all the dependencies, configure it and run it.

Somehow I doubt that :confused:

1 Like

Thanks for the timely reply Adam!
So I downloaded from github and was scratching my head at the lack of a ‘configure’, or an ‘install’ or ‘Make’ file…so you answered my question about that already.
Any idea what my dependencies might be? It seems if there was a port of this at some point there’s some documentation somewhere…I’m really hoping to not have to reinvent the wheel here. I’m basically still unsure how to to try to run it. To even attempt to try and figure all this out, I would need to just keep trying to run it and chasing after each error it throws at me until it’s running. But I’m still not even clear as to how to try launching it.
Is there no ‘run from source’ guide?

There’s developer docs which is essnetially a run from source guide. The only gotcha is that it assumes you’re running on a linux distribution from a specific family.

The developer docs kinda outline that. You’ll just need freebsd equivalents of the packages mentioned there.

Thank you for the developer docs link! Exactly what I was looking for. It must be the only document like that in existence!

Aight, so I installed all the dependencies, with the same versions as it mentioned, with one small caveat -
nodejs (node-14) not supported by freebsd. Installing latest node-18. node-18 was in the freebsd repo so I just ran with it because no choice. Everything else went according to plan, right up to the ‘bundle install’. I’m soooo close I can smell it, then it spits out this

Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

    current directory: /usr/local/rvm/gems/ruby-2.7.7/gems/ruby-libvirt-0.8.0/ext/libvirt
/usr/local/rvm/rubies/ruby-2.7.7/bin/ruby -I /usr/local/rvm/rubies/ruby-2.7.7/lib/ruby/2.7.0 -r ./siteconf20230222-11621-cyisth.rb extconf.rb
*** 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.

Provided configuration options:
	--with-opt-dir
	--with-opt-include
	--without-opt-include=${opt-dir}/include
	--with-opt-lib
	--without-opt-lib=${opt-dir}/lib
	--with-make-prog
	--without-make-prog
	--srcdir=.
	--curdir
	--ruby=/usr/local/rvm/rubies/ruby-2.7.7/bin/$(RUBY_BASE_NAME)
	--with-libvirt-include
	--without-libvirt-include
	--with-libvirt-lib
	--without-libvirt-lib
	--with-libvirt-config
	--without-libvirt-config
	--with-pkg-config
	--without-pkg-config
extconf.rb:37:in `<main>': libvirt library not found in default locations (RuntimeError)
Looking for libvirt using pkg-config

To see why this extension failed to compile, please check the mkmf.log which can be found here:

  /usr/local/rvm/gems/ruby-2.7.7/extensions/x86_64-freebsd-13/2.7.0/ruby-libvirt-0.8.0/mkmf.log

extconf failed, exit code 1

Gem files will remain installed in /usr/local/rvm/gems/ruby-2.7.7/gems/ruby-libvirt-0.8.0 for inspection.
Results logged to /usr/local/rvm/gems/ruby-2.7.7/extensions/x86_64-freebsd-13/2.7.0/ruby-libvirt-0.8.0/gem_make.out

  /usr/local/rvm/rubies/ruby-2.7.7/lib/ruby/2.7.0/rubygems/ext/builder.rb:99:in `run'
  /usr/local/rvm/rubies/ruby-2.7.7/lib/ruby/2.7.0/rubygems/ext/ext_conf_builder.rb:48:in `block in build'
  /usr/local/rvm/rubies/ruby-2.7.7/lib/ruby/2.7.0/tempfile.rb:291:in `open'
  /usr/local/rvm/rubies/ruby-2.7.7/lib/ruby/2.7.0/rubygems/ext/ext_conf_builder.rb:30:in `build'
  /usr/local/rvm/rubies/ruby-2.7.7/lib/ruby/2.7.0/rubygems/ext/builder.rb:169:in `block in build_extension'
  /usr/local/rvm/rubies/ruby-2.7.7/lib/ruby/2.7.0/rubygems/ext/builder.rb:165:in `synchronize'
  /usr/local/rvm/rubies/ruby-2.7.7/lib/ruby/2.7.0/rubygems/ext/builder.rb:165:in `build_extension'
  /usr/local/rvm/rubies/ruby-2.7.7/lib/ruby/2.7.0/rubygems/ext/builder.rb:210:in `block in build_extensions'
  /usr/local/rvm/rubies/ruby-2.7.7/lib/ruby/2.7.0/rubygems/ext/builder.rb:207:in `each'
  /usr/local/rvm/rubies/ruby-2.7.7/lib/ruby/2.7.0/rubygems/ext/builder.rb:207:in `build_extensions'
  /usr/local/rvm/rubies/ruby-2.7.7/lib/ruby/2.7.0/rubygems/installer.rb:844:in `build_extensions'
  /usr/local/rvm/gems/ruby-2.7.7/gems/bundler-2.4.7/lib/bundler/rubygems_gem_installer.rb:72:in `build_extensions'
  /usr/local/rvm/gems/ruby-2.7.7/gems/bundler-2.4.7/lib/bundler/rubygems_gem_installer.rb:28:in `install'
  /usr/local/rvm/gems/ruby-2.7.7/gems/bundler-2.4.7/lib/bundler/source/rubygems.rb:200:in `install'
  /usr/local/rvm/gems/ruby-2.7.7/gems/bundler-2.4.7/lib/bundler/installer/gem_installer.rb:54:in `install'
  /usr/local/rvm/gems/ruby-2.7.7/gems/bundler-2.4.7/lib/bundler/installer/gem_installer.rb:16:in `install_from_spec'
  /usr/local/rvm/gems/ruby-2.7.7/gems/bundler-2.4.7/lib/bundler/installer/parallel_installer.rb:167:in `do_install'
  /usr/local/rvm/gems/ruby-2.7.7/gems/bundler-2.4.7/lib/bundler/installer/parallel_installer.rb:158:in `block in worker_pool'
  /usr/local/rvm/gems/ruby-2.7.7/gems/bundler-2.4.7/lib/bundler/worker.rb:62:in `apply_func'
  /usr/local/rvm/gems/ruby-2.7.7/gems/bundler-2.4.7/lib/bundler/worker.rb:57:in `block in process_queue'
  /usr/local/rvm/gems/ruby-2.7.7/gems/bundler-2.4.7/lib/bundler/worker.rb:54:in `loop'
  /usr/local/rvm/gems/ruby-2.7.7/gems/bundler-2.4.7/lib/bundler/worker.rb:54:in `process_queue'
  /usr/local/rvm/gems/ruby-2.7.7/gems/bundler-2.4.7/lib/bundler/worker.rb:90:in `block (2 levels) in create_threads'

An error occurred while installing ruby-libvirt (0.8.0), and Bundler cannot continue.

In Gemfile:
  fog-libvirt was resolved to 0.11.0, which depends on
    ruby-libvirt

I’ve tried everything - starting with the dev docs link where it says -

In case you get this error while bundle install caused by ruby-libvirt gem: extconf.rb:37:in ': libvirt library not found in default locations (RuntimeError). Try to find the pkgconfig, it may be in a different location than /usr/lib64/pkgconfig. Try to use this command: export PKG_CONFIG_PATH=/usr/lib64/pkgconfig`.

I don’t have any path like that on my system, and it may be a red herring. I tried pointing it to the best looking potential path I could which is
export PKG_CONFIG_PATH="/usr/local/rvm/rubies/ruby-2.7.7/lib/pkgconfig"

No go.

Begin the hair pulling.

I can reproduce the exact error by simply attempting to install libvirt using gem like so -

gem install ruby-libvirt

:cold_face:

Found a fix for the gem error, because I’m the man!
do THIS first, right before the bundle install. That will be 5 bitcoin, send to imtheman@hotmail.com
gem install ruby-libvirt – --with-libvirt-include=/usr/local/include/libvirt --with-libvirt-lib=/usr/local/lib/libvirt.so
bundle install

AIGHT - now the npm install is failing. I’m SOOOO close!
There’s no Gemfile.lock file, I’ve tried two different ways, I’m stuck.

pm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: TheForemanDevDeps@3.6.0
npm ERR! Found: react-dnd-test-backend@9.5.1
npm ERR! node_modules/react-dnd-test-backend
npm ERR! dev react-dnd-test-backend@"^9.4.0" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer react-dnd-test-backend@"^7.2.0" from react-dnd-test-utils@9.5.1
npm ERR! node_modules/react-dnd-test-utils
npm ERR! dev react-dnd-test-utils@"^9.4.0" from the root project
npm ERR!
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
npm ERR!
npm ERR!

If I do a --legacy-peer-deps, it gets a lot further, then this -

npm install --legacy-peer-deps
npm ERR! code EBADENGINE
npm ERR! engine Unsupported engine
npm ERR! engine Not compatible with your version of node/npm: TheForemanDevDeps@3.7.0
npm ERR! notsup Not compatible with your version of node/npm: TheForemanDevDeps@3.7.0
npm ERR! notsup Required: {“node”:"<16.0.0"}
npm ERR! notsup Actual: {“npm”:“9.1.2”}