Hello Everyone! I’m a newbie in Foreman and trying to use Foreman for managing salt minions.
I run salt master in docker container and I’d like running Foreman in K8s too (from this repo https://github.com/ohadlevy/foreman-kube).
So, I tried multiple approaches to build this Foreman image:
- Rebuild image adfter adding
I’ve error like
constant Proxy is not associated. Found related issue on the forum which recommended to install plugins only with rpm or even with
- I’m not sure if it is correct, I tried to build test image based on
centos:7.8.2003 and installed all necessary rpms. AS
CMD in this Dockerfile I added:
CMD foreman-installer --enable-foreman-plugin-salt --enable-foreman-proxy-plugin-salt
Note: I didn’t manage to add
RUN foreman-installer --enable-foreman-plugin-salt --enable-foreman-proxy-plugin-salt as separate layer due to hostname conflicts.
foreman-installer is too long operation amd it is inconvenient to use it as entrypoint in docker container.
Could you please advice what is recommended way to build foreman with salt plugins in docker?
And If I understand correctly I need install
foreman_smart_proxy_salt in container with Foreman and
foreman_smart_proxy_salt in container with Salt master?
Thank you in advance!
And have a good day!
Foreman and Proxy versions:
Tested with 1.24 too
did you see https://github.com/theforeman/foreman/blob/develop/developer_docs/containers.asciidoc? you would need to rebuild the image with the gemfile for the plugin.
regarding the proxy, sadly i didn’t build the smart proxy image yet, but probably your approach with the installer would work (as a second container image vs bundling it into one larger image).
there is multiple prior art doing that exactly, my first hit on google seems close https://github.com/joshbenner/foreman-proxy-docker
Thank you Ohad for advice!
Yes, adding ruby packages sounds amazing!
and I’d like to follow this way
But building docker image with gem
smart_proxy_salt I got this error on step 25
rake aborted!NameError: uninitialized constant Proxy::Log ) :
Step 25/47 : RUN make -C locale all-mo && mv -v db/schema.rb.nulldb db/schema.rb && bundle exec rake assets:clean assets:precompile apipie:cache:index
---> Running in 3bcec9220684
make: Entering directory '/home/foreman/locale'
mkdir -p sv_SE/LC_MESSAGES
msgfmt -o sv_SE/LC_MESSAGES/foreman.mo sv_SE/foreman.po
mkdir -p cs_CZ/LC_MESSAGES
msgfmt -o cs_CZ/LC_MESSAGES/foreman.mo cs_CZ/foreman.po
mkdir -p pt_BR/LC_MESSAGES
msgfmt -o pt_BR/LC_MESSAGES/foreman.mo pt_BR/foreman.po
mkdir -p zh_TW/LC_MESSAGES
msgfmt -o zh_TW/LC_MESSAGES/foreman.mo zh_TW/foreman.po
mkdir -p de/LC_MESSAGES
msgfmt -o de/LC_MESSAGES/foreman.mo de/foreman.po
mkdir -p es/LC_MESSAGES
msgfmt -o es/LC_MESSAGES/foreman.mo es/foreman.po
mkdir -p nl_NL/LC_MESSAGES
msgfmt -o nl_NL/LC_MESSAGES/foreman.mo nl_NL/foreman.po
mkdir -p pl/LC_MESSAGES
msgfmt -o pl/LC_MESSAGES/foreman.mo pl/foreman.po
mkdir -p ca/LC_MESSAGES
msgfmt -o ca/LC_MESSAGES/foreman.mo ca/foreman.po
mkdir -p ru/LC_MESSAGES
msgfmt -o ru/LC_MESSAGES/foreman.mo ru/foreman.po
mkdir -p ja/LC_MESSAGES
msgfmt -o ja/LC_MESSAGES/foreman.mo ja/foreman.po
mkdir -p en_GB/LC_MESSAGES
msgfmt -o en_GB/LC_MESSAGES/foreman.mo en_GB/foreman.po
mkdir -p fr/LC_MESSAGES
msgfmt -o fr/LC_MESSAGES/foreman.mo fr/foreman.po
mkdir -p gl/LC_MESSAGES
msgfmt -o gl/LC_MESSAGES/foreman.mo gl/foreman.po
mkdir -p zh_CN/LC_MESSAGES
msgfmt -o zh_CN/LC_MESSAGES/foreman.mo zh_CN/foreman.po
mkdir -p ko/LC_MESSAGES
msgfmt -o ko/LC_MESSAGES/foreman.mo ko/foreman.po
mkdir -p it/LC_MESSAGES
msgfmt -o it/LC_MESSAGES/foreman.mo it/foreman.po
mkdir -p en/LC_MESSAGES
msgfmt -o en/LC_MESSAGES/foreman.mo en/foreman.po
make: Leaving directory '/home/foreman/locale'
renamed 'db/schema.rb.nulldb' -> 'db/schema.rb'
NameError: uninitialized constant Proxy::Log
/home/foreman/vendor/ruby/2.6.0/gems/smart_proxy_salt-3.1.1/lib/smart_proxy_salt/cli.rb:5:in `<top (required)>'
/home/foreman/vendor/ruby/2.6.0/gems/smart_proxy_salt-3.1.1/lib/smart_proxy_salt/salt.rb:3:in `<top (required)>'
/home/foreman/vendor/ruby/2.6.0/gems/smart_proxy_salt-3.1.1/lib/smart_proxy_salt.rb:4:in `<top (required)>'
/usr/share/gems/gems/bundler-1.17.2/lib/bundler/runtime.rb:81:in `block (2 levels) in require'
/usr/share/gems/gems/bundler-1.17.2/lib/bundler/runtime.rb:76:in `block in require'
/home/foreman/config/application.rb:37:in `<top (required)>'
/home/foreman/Rakefile:1:in `<top (required)>'
/home/foreman/vendor/ruby/2.6.0/gems/rake-13.0.1/exe/rake:27:in `<top (required)>'
/usr/share/gems/gems/bundler-1.17.2/exe/bundle:30:in `block in <top (required)>'
/usr/share/gems/gems/bundler-1.17.2/exe/bundle:22:in `<top (required)>'
(See full trace by running task with --trace)
The command '/bin/sh -c make -C locale all-mo && mv -v db/schema.rb.nulldb db/schema.rb && bundle exec rake assets:clean assets:precompile apipie:cache:index' returned a non-zero code: 1
Will try to troubleshoot it
hmm… this might be a bug in the salt plugin? normally foreman code does
not depend on the proxy code at all and just make api calls to it… why
do we need the proxy gem file? or perhaps you are mixing things up? I would
- you have a checkout copy of foreman repo, and you add a gemfile with the
foreman salt plugin and build that container.
- you have a smart proxy checkout with the smart proxy salt plugin and you
build another container based on that…
I might misunderstood (as you didnt paste your changes) but you might tried
to take the smart proxy plugin and add it as a foreman plugin?
I really mixed things up
For now, I successfully built
foreman_salt plugin. I see that some Salt options became available from Foreman UI
and I’m adding to
salt-master alpine image: ruby dependencies, smart-proxy and
smart_proxy_salt and its configuration
Thank you for your help!
Thank you very much.
If you have some improvements for the documentation it would be great that you open a PR on https://github.com/theforeman/theforeman.org/tree/gh-pages/plugins/foreman_salt
Thank you very much.
yes, it makes sense
so, for now I’m figuring out with integration processes and I can share when I succeed
How did you resolve your issue?