Error with xginx on Production

$ sudo bench setup production frappe
Restarted supervisord
Traceback (most recent call last):
File “/usr/local/bin/bench”, line 9, in
load_entry_point(‘bench==0.0.0’, ‘console_scripts’, ‘bench’)()
File “/Developers/bench-repo/bench/cli.py”, line 60, in cli
bench()
File “/Library/Python/2.7/site-packages/click/core.py”, line 716, in call
return self.main(*args, **kwargs)
File “/Library/Python/2.7/site-packages/click/core.py”, line 696, in main
rv = self.invoke(ctx)
File “/Library/Python/2.7/site-packages/click/core.py”, line 1060, in invoke
return processresult(sub_ctx.command.invoke(sub_ctx))
File “/Library/Python/2.7/site-packages/click/core.py”, line 1060, in invoke
return processresult(sub_ctx.command.invoke(sub_ctx))
File “/Library/Python/2.7/site-packages/click/core.py”, line 889, in invoke
return ctx.invoke(self.callback, **ctx.params)
File “/Library/Python/2.7/site-packages/click/core.py”, line 534, in invoke
return callback(*args, **kwargs)
File “/Developers/bench-repo/bench/cli.py”, line 456, in setup_production
setupproduction(user=user)
File “/Developers/bench-repo/bench/production_setup.py”, line 77, in setup_production
restart_service(‘nginx’)
File “/Developers/bench-repo/bench/production_setup.py”, line 21, in restart_service
raise Exception, ‘No service manager found’
Exception: No service manager found

i know the error is can’t restart nginx, but if a type
“$ sudo nginx -s reload”
it’s works

I’m installed nginx with MacPorts and that’s why it don’t have a systemctl. How can i add a systemctl for nginx on OS X ?

Thank you guys in advance.

i solved my own issue…

$ sudo bench setup production frappe
Password:
Restarted supervisord
Starting nginx: [ OK ]

thanks any way i needed modify the file production_setup.py to resolve this and a few more things.

@gvargas what was the modification required? If it would benefit others, can you send a pull request?

I suppose you changed something in this line: https://github.com/frappe/bench/blob/master/bench/production_setup.py#L24

@anand Sure!.. First of all im on OS X… so, Nginx don’t have Service Manager i found one here:

https://github.com/fooltruth/nginxctl

and put this on the path “/usr/local/bin/” (to do this first remove rootless issue)
and then

and then i modify production_setup.py but no that line , this one:

https://github.com/frappe/bench/blob/master/bench/production_setup.py#L77

something like this:

   exec_cmd('supervisorctl reload')
    if os.environ.get('NO_SERVICE_RESTART'):
            return
    exec_cmd('nginxctl --restart')
    if os.environ.get('NO_SERVICE_RESTART'):
            return

and that’s all in here, no big deal actually, but important to work

in exec_cmd(‘nginxctl --restart’)
can put something like exec_cmd(‘nginx -s reload’) and will be the same thing.