Issues starting smart-proxy on local mac

proxy

#1

I’m currently setting up my local Foreman dev environment on my mac, and I have Foreman up and running without issues, however the smart-proxy doesn’t seem to want to start up.

Here is the output(after doing bundle install etc.):

mac-dev:smart-proxy chris.smith$ bundle exec smart-proxy start
Errors detected on startup, see log for details. **Exiting: getaddrinfo: nodename nor servname provided, or not known**
mac-dev:smart-proxy chris.smith$ cat ~/smart-proxy.log

2019-04-25T14:53:34  [I] Successfully initialized 'foreman_proxy'
2019-04-25T14:53:34  [W] Missing SSL setup, https is disabled.
2019-04-25T14:53:34  [E] Error during startup, terminating

Any ideas what might be causing this?


#2

Hey, smart proxy is known not to work on MacOS, we use systemd notify during the startup, inotify in the DHCP etc etc. You are welcome to work on getting it working on MacOS.

For starters, I suggest to set DEBUG log level and set the output to STDOUT so you see it on the foreground. Then start figuring it. No clue really.


#3

It is known to work on Windows so MacOS should work as well. Systemd notify is optional: it’s only active when NOTIFY_SOCKET is present in ENV.

The error is from getaddrinfo which is the syscall for DNS resolution. This isn’t called directly so without DEBUG logs this is hard to really debug. It may be sufficient to ensure you can resolve your system’s hostname.


#4

Smart-proxy does work on a mac. I am able to run a development environment just fine. I haven’t tried all plugins and the dhcpd integration probably won’t work, but puppet for example works just fine.

We should probably think about offering Docker containers to run the proxy (@ohadlevy: Do you already have one by chance?) to make this a little easier.


#5

Sorry to mislead you, the last time I tried this it did not work. At least test suite did not pass, so I got the impression it’s not working.


#6

The test suite is bad at being able to run a part of it. For example, it can’t easily skip all rkerberos related tests (that I know of).


#7

Thanks @ekohl. As it turns out, my system’s hostname(mac-dev) was not resolvable. After adding it to the hosts files, however, I continue to get the same error:

2019-04-29T12:35:57  [I] Successfully initialized 'foreman_proxy'
2019-04-29T12:35:57  [W] Missing SSL setup, https is disabled.
2019-04-29T12:35:58  [E] Error during startup, terminating
Errors detected on startup, see log for details. Exiting: getaddrinfo: nodename nor servname provided, or not known

I also changed log level to DEBUG and log output to STDOUT, but am not seeing anymore logs than I was seeing before.

@TimoGoebel: Given you are able to run the proxy in your dev env(on mac), can you think of anything I may be missing? I basically cloned the repo, did a bundle install, then tried to start the proxy. Perhaps, something else needs to be run after bundle install? Setting of any environment variables?

Any further help is appreciated.


#8

That should suffice. git clone, bundle install, copy setting files, bundle exec ./bin/smart-proxy.

Can you also print the stacktrace to see where the error occurs?

Just add something like puts e.backtrace.join("\n") here:


#9

Thanks @TimoGoebel. Here is the additional stacktrace:

mac-dev:smart-proxy christopher.smith$ bundle exec smart-proxy start
2019-04-30T10:55:49 [I] Successfully initialized 'foreman_proxy'
2019-04-30T10:55:49 [W] Missing SSL setup, https is disabled.
#<Thread:0x00007f883cc48ad0@/Users/christopher.smith/.rvm/gems/ruby-2.5.0/gems/logging-2.2.2/lib/logging/diagnostic_context.rb:471 run> terminated with exception (report_on_exception is true):

Traceback (most recent call last):

9: from /Users/christopher.smith/.rvm/gems/ruby-2.5.0/gems/logging-2.2.2/lib/logging/diagnostic_context.rb:474:in `block in create_with_logging_context'
8: from /Users/christopher.smith/Documents/development/opensource/smart-proxy/lib/launcher.rb:175:in `block in launch'
7: from /Users/christopher.smith/Documents/development/opensource/smart-proxy/lib/launcher.rb:154:in `webrick_server'
6: from /Users/christopher.smith/Documents/development/opensource/smart-proxy/lib/launcher.rb:154:in `each'
5: from /Users/christopher.smith/Documents/development/opensource/smart-proxy/lib/launcher.rb:154:in `block in webrick_server'
4: from /Users/christopher.smith/.rvm/rubies/ruby-2.5.0/lib/ruby/2.5.0/webrick/ssl.rb:165:in `listen'
3: from /Users/christopher.smith/.rvm/rubies/ruby-2.5.0/lib/ruby/2.5.0/webrick/utils.rb:65:in `create_listeners'
2: from /Users/christopher.smith/.rvm/rubies/ruby-2.5.0/lib/ruby/2.5.0/socket.rb:762:in `tcp_server_sockets'
1: from /Users/christopher.smith/.rvm/rubies/ruby-2.5.0/lib/ruby/2.5.0/socket.rb:227:in `foreach'
/Users/christopher.smith/.rvm/rubies/ruby-2.5.0/lib/ruby/2.5.0/socket.rb:227:in `getaddrinfo': getaddrinfo: nodename nor servname provided, or not known (SocketError)
2019-04-30T10:55:49 [E] Error during startup, terminating
Errors detected on startup, see log for details. Exiting: getaddrinfo: nodename nor servname provided, or not known
/Users/christopher.smith/.rvm/rubies/ruby-2.5.0/lib/ruby/2.5.0/socket.rb:227:in `getaddrinfo'
/Users/christopher.smith/.rvm/rubies/ruby-2.5.0/lib/ruby/2.5.0/socket.rb:227:in `foreach'
/Users/christopher.smith/.rvm/rubies/ruby-2.5.0/lib/ruby/2.5.0/socket.rb:762:in `tcp_server_sockets'
/Users/christopher.smith/.rvm/rubies/ruby-2.5.0/lib/ruby/2.5.0/webrick/utils.rb:65:in `create_listeners'
/Users/christopher.smith/.rvm/rubies/ruby-2.5.0/lib/ruby/2.5.0/webrick/ssl.rb:165:in `listen'
/Users/christopher.smith/Documents/development/opensource/smart-proxy/lib/launcher.rb:154:in `block in webrick_server'
/Users/christopher.smith/Documents/development/opensource/smart-proxy/lib/launcher.rb:154:in `each'
/Users/christopher.smith/Documents/development/opensource/smart-proxy/lib/launcher.rb:154:in `webrick_server'
/Users/christopher.smith/Documents/development/opensource/smart-proxy/lib/launcher.rb:175:in `block in launch'
/Users/christopher.smith/.rvm/gems/ruby-2.5.0/gems/logging-2.2.2/lib/logging/diagnostic_context.rb:474:in `block in create_with_logging_context'

#10

I think I got this sorted.

In my settings.yml, I had :bind_host: ['*']. I changed this to :bind_host: ['localhost'] and it seems to be working now.

mac-dev:smart-proxy christopher.smith$ bundle exec smart-proxy start
2019-04-30T11:57:16  [I] Successfully initialized 'foreman_proxy'
2019-04-30T11:57:16  [W] Missing SSL setup, https is disabled.
2019-04-30T11:57:16  [I] Smart proxy has launched on 1 socket(s), waiting for requests

Thanks everyone for your help on this.