Error When Installing Smart Proxy Plugin


#1

Greetings,

I am trying to install a smart proxy plugin on a foreman-proxy development box, but I am having issues when trying to install it. I am following the guide at: How to Install a Smart-Proxy Plugin - Foreman. I tried to do a gem installation through vagrant ssh, and it appears as though the proxy plugin got installed, but it doesn’t show up in the “Administer->About->Smart Proxies” section on the Foreman web interface. When I tried a source installation, it again appears as though the plugin installed correctly but when I try to restart foreman proxy service, I get this:



and the interface remains unchanged.


#2

Hi,
it seems like a bundler error, it could be caused by a number of things. Which proxy plugin are you trying to install? What is the version of the plugin? The plugin maintainer(s) will probably be the best source of information on this problem…


#3

Thanks for your reply! I have the goal of creating my own smart proxy plugin in the future but for now I have an example that I am trying to install from https://github.com/theforeman/smart_proxy_example.


#4

This proxy plugin will not show in Foreman as a proxy feature even if it is successfully installed, because Foreman needs to have a corresponding feature in the database. It is usually done by Foreman plugins.

If you plan to develop your own proxy plugin, I would recommend setting up proxy for development, as it would allow you to debug things easier, progress faster and the whole experience is much more pleasant.
It requires a couple of manual steps, but it is not too difficult:

  1. clone the smart-proxy and smart_proxy_example repos into your workspace
mkdir workspace
cd workspace
git clone https://github.com/theforeman/smart-proxy.git
git clone https://github.com/theforeman/smart_proxy_example.git
  1. configure the proxy to use the plugin
echo 'gemspec :path => "../smart_proxy_example"' > smart-proxy/bundler.d/Gemfile.local.rb
  1. create plugin config
cp smart_proxy_example/settings.d/example.yml.example smart-proxy/config/settings.d/example.yml
  1. create proxy config
cp smart-proxy/config/settings.yml.example smart-proxy/config/settings.yml
  1. uncomment/modify the following lines in smart-proxy/config/settings.yml, which is bare minimum to get the proxy running
:http_port: 8000
:log_file: /var/log/foreman-proxy/proxy.log # change to a writable file
  1. install dependencies, your local checkout of smart_proxy_example should show among them
cd smart-proxy
bundle install
  1. run the proxy
bin/smart-proxy

Proxy should now run over http on port 8000. Note that if you do this in the vagrant develop box, you will need to stop the proxy that is already running there, otherwise you will get clash on the port.

You can verify the features of the proxy using your browser:

proxy-features


#5

Thanks for the suggestion, this should work for what I am trying to do! I walked through all the steps and everything runs smoothly, but what ip address should I use when verifying features on the web browser? When I do a ‘ifconfig’, I get an ip of ‘127.0.0.1’ but when I try it in the browser it fails to open.


#6

It depends on where you are developing. When verifying in the browser, it is essentially the same call to the proxy as Foreman does when you refresh proxy features in Foreman UI. I had my proxy setup in a vagrant box, so 192.168.100.67 on the screenshot is ip of my box. But if you are locally, then ‘127.0.0.1:8000/features’ should work.

Adding ifconfig of my box for a reference:


#7

Ahh okay that helps a lot. I was using the wrong IP address. I have everything up and working and ready to develop now. Thank you for all of your help!