theforeman / foreman_fog_proxmox

Foreman plugin to add Proxmox compute resource based on fog-proxmox gem
GNU General Public License v3.0
105 stars 30 forks source link

Installation guide not up to date and plugin attempts to access a development environment in pre compile step (Ubuntu 18.04.5LTS - Foreman 2.4.0 - Ruby 2.5.1p57) #196

Closed htdutchy closed 3 years ago

htdutchy commented 3 years ago

Describe the bug It seems that the installation guide has never been updated to reflect new versions of Foreman and is pretty useless when trying to install the plugin on Foreman 2.4.

I've included all the steps I did to eventually get the plugin working but the experience wasn't as smooth as I had hoped.
I have yet to try using the plugin but at least I now get the option to add proxmox as a compute source.

First issue Steps to reproduce the behavior:

  1. Make a clean install of Ubuntu 18.04.5 LTS
  2. Set up repo packages for Foreman 2.4 by following the foreman quickstart guide
  3. Try to execute the first step of the install guide sudo apt install -y foreman foreman-compute foreman-sqlite3 foreman-assets
  4. See that foreman-compute and foreman-sqlite3 are no longer available so unable to continue.

The (attempted) installation workaround Steps to reproduce the behavor:

  1. Simply continue the Foreman quickstart guide and finish setting up.
  2. Eventually get to the assets precompile step plugin:assets:precompile[foreman_fog_proxmox]
  3. Encounter the following error: ActiveRecord::AdapterNotSpecified: Thedevelopmentdatabase is not configured for thedevelopmentenvironment.

The error workaround I have not yet tested the full functionality but was able to get around the compile error by duplicating the production configuration to a development configuration in /etc/foreman/database.yml.
It should also be noted that /bin/rake is not available to the foreman user and /usr/bin/rake should be used.

Below is a full log of what I did to get the plugin installed in my environment.

# Clean ubuntu 18.04.5 LTS install
# As root
locale-gen en_US.UTF-8 
sudo apt-get -y install ca-certificates
cd /tmp && wget https://apt.puppet.com/puppet6-release-bionic.deb
sudo dpkg -i /tmp/puppet6-release-bionic.deb
echo "deb http://deb.theforeman.org/ bionic 2.4" | sudo tee /etc/apt/sources.list.d/foreman.list
echo "deb http://deb.theforeman.org/ plugins 2.4" | sudo tee -a /etc/apt/sources.list.d/foreman.list
sudo apt-get -y install ca-certificates
wget -q https://deb.theforeman.org/pubkey.gpg -O- | sudo apt-key add -
sudo apt-get update && sudo apt-get -y install foreman-installer

foreman-installer

#edit /etc/passwd and give foreman /bin/bash
#edit /etc/foreman/database.yml and copy the production configuration and name it development

cd /usr/share/foreman
echo "gem 'foreman_fog_proxmox'" | sudo -u foreman tee /usr/share/foreman/bundler.d/Gemfile.local.rb

#become the foreman user
su foreman
/usr/bin/foreman-ruby /usr/bin/bundle install
/usr/bin/foreman-ruby /usr/bin/bundle update foreman_fog_proxmox
/usr/bin/foreman-ruby /usr/bin/bundle exec /usr/bin/rake db:migrate
/usr/bin/foreman-ruby /usr/bin/bundle exec /usr/bin/rake plugin:assets:precompile[foreman_fog_proxmox]

#exit and become root again
exit
foreman-installer