Bug #10378
closedsmart-proxy service doesn't start on windows
Description
```
C:\AA\foreman\smart\bin>net start "smart proxy"
The service is not responding to the control function.
More help is available by typing NET HELPMSG 2186.
```
No logs are created. I don't know what is happening at all :/
Updated by Benjamin Papillon over 9 years ago
With some trials and tests, we nailed the error to the use of bundler vs bundler_ext.
When using the former the service starts. when using bundle, ruby 1.9.3 complains about not finding its dependencies.
The work around :
- prerequisites : the smart proxy service should be registered with <smartproxy dir>\bin\smart-proxy-win-service
- In the smart proxy directory, copy gemfile to gemfile.in
- Install bundler_ext gem
gem install bundler_ext
Here is the file I used as bin\smart-proxy-win-service
Please be sure to update 1st line and logfile path.
#!c:\ruby193\bin\ruby.exe $LOAD_PATH.unshift(*Dir[File.expand_path("../../lib", __FILE__), File.expand_path("../../modules", __FILE__)]) require 'rubygems' require 'win32/daemon' include Win32 require 'smart_proxy' begin class SmartDaemon < Daemon include ::Proxy::Log def service_init logger.info("Service is initializing") end def service_main(*args) logger.info("Service is running") # Start the foreman daemon Proxy::Launcher.new.launch # the daemon is about to exit. logger.info("Service is terminating") end # This event triggers when the service receives a signal to stop. # # NOTE: Older versions of this code used an explicit exit! call # to force the Ruby interpreter to exit. Don't do that. It is no # longer required and, in fact, may cause issues. # def service_stop logger.info("Received stop signal") end # This event triggers when the service receives a signal to pause. # def service_pause logger.info("Received pause signal") end # This event triggers when the service receives a signal to resume # from a paused state. # def service_resume logger.info("Received resume signal") end end # Create an instance of the Daemon and put it into a loop. I borrowed the # method name 'mainloop' from Tk, btw. # SmartDaemon.mainloop rescue Exception => e logger.error("Daemon failure: #{e} #{e.backtrace}") raise end
Updated by Benjamin Papillon over 9 years ago
- Related to Support #10098: Does anyone have an updated procedure to install smart proxy on a Windows Server 2008 R2 OS? added
Updated by The Foreman Bot over 9 years ago
- Status changed from New to Ready For Testing
- Pull request https://github.com/theforeman/smart-proxy/pull/285 added
- Pull request deleted (
)
Updated by Anonymous almost 9 years ago
- Is duplicate of Bug #8793: Smart-proxy does not run as a service on Windows added
Updated by Anonymous almost 9 years ago
- Is duplicate of deleted (Bug #8793: Smart-proxy does not run as a service on Windows)
Updated by Dominic Cleal almost 9 years ago
- Category set to Core
- Translation missing: en.field_release set to 104
Updated by Dominic Cleal almost 9 years ago
- Related to Feature #12006: RFE: Be more specific about smart-proxy installation in windows added
Updated by Anonymous almost 9 years ago
- Status changed from Ready For Testing to Closed
- % Done changed from 0 to 100
Applied in changeset 8e19663fa0d964c6cbb408663f25b9bd16420db5.
Updated by Zak Herner almost 9 years ago
I'm unable to get this to work. I've tried the steps above with gemfile.in and installing bundler_ext without any luck. I've tried a lot of things, ruby 1.9.3, 2.1.7 and 2.2.3 along with smart-proxy 1.7, 1.9, 1.10 and develop and no combination worked with smart-proxy-win-service.
From the win-service.log that gets created it has the following:I, [2015-12-23T14:18:27.130041 #6992] INFO -- : Service is initializing
E, [2015-12-23T14:18:30.145679 #6992] ERROR -- : Daemon failure: Service_Main thread exited abnormally D:/foreman/Ruby22/lib/ruby/gems/2.2.0/gems/win32-service-0.8.7/lib/win32/daemon.rb:282:in `mainloop'
D:/foreman/Ruby22/lib/ruby/gems/2.2.0/gems/win32-service-0.8.7/lib/win32/daemon.rb:217:in `mainloop'
./bin/smart-proxy-win-service:39:in `<main>'
smart-proxy-win-service from the command line does not work but regular smart-proxy does work for me. I think it would be ideal to use smart-proxy-win-service but the option that worked for me was to use nssm.
Updated by Anonymous almost 9 years ago
The fix has been merged, bundler_ext and the workaround mentioned above isn't needed. Please follow installation docs for Windows (can be found here: http://theforeman.org/manuals/1.10/index.html) and see if it works for you.
Updated by Zak Herner almost 9 years ago
Dmitri Dolguikh wrote:
The fix has been merged, bundler_ext and the workaround mentioned above isn't needed. Please follow installation docs for Windows (can be found here: http://theforeman.org/manuals/1.10/index.html) and see if it works for you.
I was using the above doc to do the install and didn't have any luck. I'm installing on a new Win2K12 server, I also have the same issue on my Win7 workstation.
Updated by James Camping over 8 years ago
Zak Herner wrote:
Dmitri Dolguikh wrote:
The fix has been merged, bundler_ext and the workaround mentioned above isn't needed. Please follow installation docs for Windows (can be found here: http://theforeman.org/manuals/1.10/index.html) and see if it works for you.
I was using the above doc to do the install and didn't have any luck. I'm installing on a new Win2K12 server, I also have the same issue on my Win7 workstation.
Try running "ruby bin\smart-proxy-win-service" In my case I had to change line 12 to specify a log file as an absolute path. After that the ruby service worked without issue.
Updated by Dominic Cleal over 8 years ago
- Translation missing: en.field_release changed from 104 to 71
Non-trivial to backport, bumping to 1.11.0.