cherryd/fastcgi/lighttpd

View: New views
8 Messages — Rating Filter:   Alert me  

cherryd/fastcgi/lighttpd

by Eric Abrahamsen :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


I noticed the new cherryd utility comes with the ability to handle  
FCGI servers via flup. I've been working with the regular lighttpd  
configuration that uses a script file. Since httpd starts a process of  
its own, is it possible to use it in conjunction with another  
webserver like lighttpd? I've tried connecting via a socket file,  
rather than host/port combination, but it seems to want to use host/
port even with server.socket_file set. Can this be done, or am I  
barking up the wrong tree?

Thanks,
Eric

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "cherrypy-users" group.
To post to this group, send email to cherrypy-users@...
To unsubscribe from this group, send email to cherrypy-users-unsubscribe@...
For more options, visit this group at http://groups.google.com/group/cherrypy-users?hl=en
-~----------~----~----~----~------~----~------~--~---


Re: cherryd/fastcgi/lighttpd

by Robert Brewer-4 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Eric Abrahamsen wrote:
> I noticed the new cherryd utility comes with the ability to handle
> FCGI servers via flup. I've been working with the regular lighttpd
> configuration that uses a script file. Since httpd starts a process of
> its own, is it possible to use it in conjunction with another
> webserver like lighttpd? I've tried connecting via a socket file,
> rather than host/port combination, but it seems to want to use host/
> port even with server.socket_file set. Can this be done, or am I
> barking up the wrong tree?

I'm sure it can, it'll just take a little glue. Try modifying cherryd as
follows:

    sock_file = cherrypy.config.get('server.socket_file', None)
    if sock_file:
        bindAddress = sock_file
    else:
        fastcgi_port = cherrypy.config.get('server.socket_port', 4000)
        fastcgi_bindaddr = cherrypy.config.get('server.socket_host',
'0.0.0.0')
        bindAddress = (fastcgi_bindaddr, fastcgi_port)

Whether that works or not, please open a ticket. :)
http://www.cherrypy.org/newticket


Robert Brewer
fumanchu@...


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "cherrypy-users" group.
To post to this group, send email to cherrypy-users@...
To unsubscribe from this group, send email to cherrypy-users-unsubscribe@...
For more options, visit this group at http://groups.google.com/group/cherrypy-users?hl=en
-~----------~----~----~----~------~----~------~--~---


Re: cherryd/fastcgi/lighttpd

by Eric Abrahamsen :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Done: http://www.cherrypy.org/ticket/833

I tried with that, and the engine got as far as starting the monitor  
threads before it blew up like so:

ENGINE Error in HTTP server: shutting down
Traceback (most recent call last):
   File "/home/user/lib/python2.5/cherrypy/process/servers.py", line  
73, in _start_http_thread
     self.httpserver.start()
   File "/home/user/lib/python2.5/cherrypy/process/servers.py", line  
144, in start
     self.fcgiserver.run()
   File "build/bdist.linux-i686/egg/flup/server/fcgi.py", line 113, in  
run
     ret = ThreadedServer.run(self, sock)
   File "build/bdist.linux-i686/egg/flup/server/threadedserver.py",  
line 68, in run
     self._installSignalHandlers()
   File "build/bdist.linux-i686/egg/flup/server/threadedserver.py",  
line 153, in _installSignalHandlers
     signal.signal(sig, self._intHandler)
ValueError: signal only works in main thread

I'm testing this with a barebones "hello world" setup. Lighttpd is not  
running at this point, not sure if that makes any difference.

python cherryd -c site.conf -f

site.conf
#####
[global]
server.socket_file: '/tmp/fcgi.sock'
tree.myapp: cherrypy.Application(wf.root, "/",)

wf/__init__.py
#####
import cherrypy

class HelloWorld:
     @cherrypy.expose
     def index(self):
         return "Running on cherryd"

root = HelloWorld()




On Jul 2, 2008, at 12:19 AM, Robert Brewer wrote:

>
> Eric Abrahamsen wrote:
>> I noticed the new cherryd utility comes with the ability to handle
>> FCGI servers via flup. I've been working with the regular lighttpd
>> configuration that uses a script file. Since httpd starts a process  
>> of
>> its own, is it possible to use it in conjunction with another
>> webserver like lighttpd? I've tried connecting via a socket file,
>> rather than host/port combination, but it seems to want to use host/
>> port even with server.socket_file set. Can this be done, or am I
>> barking up the wrong tree?
>
> I'm sure it can, it'll just take a little glue. Try modifying  
> cherryd as
> follows:
>
>    sock_file = cherrypy.config.get('server.socket_file', None)
>    if sock_file:
>        bindAddress = sock_file
>    else:
>        fastcgi_port = cherrypy.config.get('server.socket_port', 4000)
>        fastcgi_bindaddr = cherrypy.config.get('server.socket_host',
> '0.0.0.0')
>        bindAddress = (fastcgi_bindaddr, fastcgi_port)
>
> Whether that works or not, please open a ticket. :)
> http://www.cherrypy.org/newticket
>
>
> Robert Brewer
> fumanchu@...
>
>
> >


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "cherrypy-users" group.
To post to this group, send email to cherrypy-users@...
To unsubscribe from this group, send email to cherrypy-users-unsubscribe@...
For more options, visit this group at http://groups.google.com/group/cherrypy-users?hl=en
-~----------~----~----~----~------~----~------~--~---


Re: cherryd/fastcgi/lighttpd

by Robert Brewer-4 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Eric Abrahamsen wrote:

> Done: http://www.cherrypy.org/ticket/833
>
> I tried with that, and the engine got as far as starting the monitor
> threads before it blew up like so:
>
> ENGINE Error in HTTP server: shutting down
> Traceback (most recent call last):
>    File "/home/user/lib/python2.5/cherrypy/process/servers.py", line
> 73, in _start_http_thread
>      self.httpserver.start()
>    File "/home/user/lib/python2.5/cherrypy/process/servers.py", line
> 144, in start
>      self.fcgiserver.run()
>    File "build/bdist.linux-i686/egg/flup/server/fcgi.py", line 113, in
> run
>      ret = ThreadedServer.run(self, sock)
>    File "build/bdist.linux-i686/egg/flup/server/threadedserver.py",
> line 68, in run
>      self._installSignalHandlers()
>    File "build/bdist.linux-i686/egg/flup/server/threadedserver.py",
> line 153, in _installSignalHandlers
>      signal.signal(sig, self._intHandler)
> ValueError: signal only works in main thread
>
> I'm testing this with a barebones "hello world" setup. Lighttpd is not
> running at this point, not sure if that makes any difference.
>
> python cherryd -c site.conf -f
>
> site.conf
> #####
> [global]
> server.socket_file: '/tmp/fcgi.sock'
> tree.myapp: cherrypy.Application(wf.root, "/",)
>
> wf/__init__.py
> #####
> import cherrypy
>
> class HelloWorld:
>      @cherrypy.expose
>      def index(self):
>          return "Running on cherryd"
>
> root = HelloWorld()

georgem has been doing some great work on getting this going--please try
out trunk and let us know how it goes.


Robert Brewer
fumanchu@...


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "cherrypy-users" group.
To post to this group, send email to cherrypy-users@...
To unsubscribe from this group, send email to cherrypy-users-unsubscribe@...
For more options, visit this group at http://groups.google.com/group/cherrypy-users?hl=en
-~----------~----~----~----~------~----~------~--~---


Re: cherryd/fastcgi/lighttpd

by Eric Abrahamsen :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message



On Jul 23, 2008, at 12:19 PM, Robert Brewer wrote:

>
> Eric Abrahamsen wrote:
>> Done: http://www.cherrypy.org/ticket/833
>>
>> I tried with that, and the engine got as far as starting the monitor
>> threads before it blew up like so:
>>
>> ENGINE Error in HTTP server: shutting down
>> Traceback (most recent call last):
>>   File "/home/user/lib/python2.5/cherrypy/process/servers.py", line
>> 73, in _start_http_thread
>>     self.httpserver.start()
>>   File "/home/user/lib/python2.5/cherrypy/process/servers.py", line
>> 144, in start
>>     self.fcgiserver.run()
>>   File "build/bdist.linux-i686/egg/flup/server/fcgi.py", line 113, in
>> run
>>     ret = ThreadedServer.run(self, sock)
>>   File "build/bdist.linux-i686/egg/flup/server/threadedserver.py",
>> line 68, in run
>>     self._installSignalHandlers()
>>   File "build/bdist.linux-i686/egg/flup/server/threadedserver.py",
>> line 153, in _installSignalHandlers
>>     signal.signal(sig, self._intHandler)
>> ValueError: signal only works in main thread
>>
>> I'm testing this with a barebones "hello world" setup. Lighttpd is  
>> not
>> running at this point, not sure if that makes any difference.
>>
>> python cherryd -c site.conf -f
>>
>> site.conf
>> #####
>> [global]
>> server.socket_file: '/tmp/fcgi.sock'
>> tree.myapp: cherrypy.Application(wf.root, "/",)
>>
>> wf/__init__.py
>> #####
>> import cherrypy
>>
>> class HelloWorld:
>>     @cherrypy.expose
>>     def index(self):
>>         return "Running on cherryd"
>>
>> root = HelloWorld()
>
> georgem has been doing some great work on getting this going--please  
> try
> out trunk and let us know how it goes.

Starts beautifully. I'll try it with the full lighttpd stack when I  
have a little more time, but I don't see why that wouldn't work.  
Thanks a lot to georgem et al. for all the work! Cherrypy continues to  
rock.

E


>
>
>
> Robert Brewer
> fumanchu@...
>
>
> >


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "cherrypy-users" group.
To post to this group, send email to cherrypy-users@...
To unsubscribe from this group, send email to cherrypy-users-unsubscribe@...
For more options, visit this group at http://groups.google.com/group/cherrypy-users?hl=en
-~----------~----~----~----~------~----~------~--~---


Re: cherryd/fastcgi/lighttpd

by Eric Abrahamsen :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


okay, I think I spoke too soon. It worked once, but hasn't worked  
since (very weird, since nothing in my environment has changed, so far  
as I can tell). The next few times I tried it it died with the  
following error:

   File "/home/taojian/lib/python2.5/cherrypy/process/servers.py",  
line 95, in wait
     raise self.interrupt
error: (95, 'Operation not supported')

The last time it died with that error, twice, and then got into an  
infinite loop between wspbus.py:315 and wspbus.py:157, log and  
publish, back and forth. I'm pasting everything below; the log/publish  
loop continued until it hit max recursion depth...

Sorry to be a spoilsport,
Eric




[24/Jul/2008:05:17:56] ENGINE Error in HTTP server: shutting down
Traceback (most recent call last):
   File "/home/taojian/lib/python2.5/cherrypy/process/servers.py",  
line 73, in _start_http_thread
     self.httpserver.start()
   File "/home/taojian/lib/python2.5/cherrypy/wsgiserver/__init__.py",  
line 1377, in start
     raise socket.error, msg
error: (95, 'Operation not supported')

[24/Jul/2008:05:17:56] ENGINE Bus STOPPING
[24/Jul/2008:05:17:56] ENGINE HTTP Server  
cherrypy._cpwsgi_server.CPWSGIServer('/tmp/fcgi.sock') already shut down
[24/Jul/2008:05:17:56] ENGINE Stopped thread 'Autoreloader'.
[24/Jul/2008:05:17:56] ENGINE Error in 'start' listener <bound method  
Server.start of <cherrypy._cpserver.Server object at 0x9b6df4c>>
Traceback (most recent call last):
   File "/home/taojian/lib/python2.5/cherrypy/process/wspbus.py", line  
147, in publish
     output.append(listener(*args, **kwargs))
   File "/home/taojian/lib/python2.5/cherrypy/_cpserver.py", line 89,  
in start
     ServerAdapter.start(self)
   File "/home/taojian/lib/python2.5/cherrypy/process/servers.py",  
line 60, in start
     self.wait()
   File "/home/taojian/lib/python2.5/cherrypy/process/servers.py",  
line 95, in wait
     raise self.interrupt
error: (95, 'Operation not supported')

[24/Jul/2008:05:17:56] ENGINE Shutting down due to error in start  
listener:
Traceback (most recent call last):
   File "/home/taojian/lib/python2.5/cherrypy/process/wspbus.py", line  
180, in start
     self.publish('start')
   File "/home/taojian/lib/python2.5/cherrypy/process/wspbus.py", line  
147, in publish
     output.append(listener(*args, **kwargs))
   File "/home/taojian/lib/python2.5/cherrypy/_cpserver.py", line 89,  
in start
     ServerAdapter.start(self)
   File "/home/taojian/lib/python2.5/cherrypy/process/servers.py",  
line 60, in start
     self.wait()
   File "/home/taojian/lib/python2.5/cherrypy/process/servers.py",  
line 95, in wait
     raise self.interrupt
error: (95, 'Operation not supported')

[24/Jul/2008:05:17:56] ENGINE Bus STOPPING
[24/Jul/2008:05:17:56] ENGINE HTTP Server  
cherrypy._cpwsgi_server.CPWSGIServer('/tmp/fcgi.sock') already shut down
[24/Jul/2008:05:17:56] ENGINE No thread running for Autoreloader.
[24/Jul/2008:05:17:56] ENGINE Stopped thread '_TimeoutMonitor'.
[24/Jul/2008:05:17:56] ENGINE Bus STOPPED
[24/Jul/2008:05:17:56] ENGINE Bus EXITING
[24/Jul/2008:05:17:56] ENGINE Bus EXITED
Exception in thread HTTPServer Thread-3 (most likely raised during  
interpreter shutdown):
Traceback (most recent call last):
   File "/usr/local/lib/python2.5/threading.py", line 460, in  
__bootstrap
   File "/usr/local/lib/python2.5/threading.py", line 440, in run
   File "/home/taojian/lib/python2.5/cherrypy/process/servers.py",  
line 88, in _start_http_thread
   File "/home/taojian/lib/python2.5/cherrypy/process/wspbus.py", line  
198, in exit
   File "/home/taojian/lib/python2.5/cherrypy/process/wspbus.py", line  
287, in stop
   File "/home/taojian/lib/python2.5/cherrypy/process/wspbus.py", line  
157, in publish
   File "/home/taojian/lib/python2.5/cherrypy/process/wspbus.py", line  
315, in log
   File "/home/taojian/lib/python2.5/cherrypy/process/wspbus.py", line  
157, in publish
   File "/home/taojian/lib/python2.5/cherrypy/process/wspbus.py", line  
315, in log
   File "/home/taojian/lib/python2.5/cherrypy/process/wspbus.py", line  
157, in publish


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "cherrypy-users" group.
To post to this group, send email to cherrypy-users@...
To unsubscribe from this group, send email to cherrypy-users-unsubscribe@...
For more options, visit this group at http://groups.google.com/group/cherrypy-users?hl=en
-~----------~----~----~----~------~----~------~--~---


Re: cherryd/fastcgi/lighttpd

by Robert Brewer-4 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Eric Abrahamsen wrote:

> okay, I think I spoke too soon. It worked once, but hasn't worked
> since (very weird, since nothing in my environment has changed, so far
> as I can tell). The next few times I tried it it died with the
> following error:
>
>    File "/home/taojian/lib/python2.5/cherrypy/process/servers.py",
> line 95, in wait
>      raise self.interrupt
> error: (95, 'Operation not supported')
>
> The last time it died with that error, twice, and then got into an
> infinite loop between wspbus.py:315 and wspbus.py:157, log and
> publish, back and forth. I'm pasting everything below; the log/publish
> loop continued until it hit max recursion depth...

OK, first things first. http://www.cherrypy.org/changeset/2027 should
fix the infinite loop.

> [24/Jul/2008:05:17:56] ENGINE Error in HTTP server: shutting down
> Traceback (most recent call last):
>    File "/home/taojian/lib/python2.5/cherrypy/process/servers.py",
> line 73, in _start_http_thread
>      self.httpserver.start()
>    File "/home/taojian/lib/python2.5/cherrypy/wsgiserver/__init__.py",
> line 1377, in start
>      raise socket.error, msg
> error: (95, 'Operation not supported')

Why is wsgiserver being run? That should be unsubscribed when you choose
FastCGI (via the '-f' arg to cherryd).


Robert Brewer
fumanchu@...


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "cherrypy-users" group.
To post to this group, send email to cherrypy-users@...
To unsubscribe from this group, send email to cherrypy-users-unsubscribe@...
For more options, visit this group at http://groups.google.com/group/cherrypy-users?hl=en
-~----------~----~----~----~------~----~------~--~---


Re: cherryd/fastcgi/lighttpd

by Eric Abrahamsen :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Brilliant! All the lights come on, and it works with the full lighttpd  
stack. Updating the CP code indeed fixed the infinite loop, and  
remembering to use the -f option to cherryd (ahem), fixed the other  
problem. :)

Thanks again!
Eric

On Jul 25, 2008, at 12:47 AM, Robert Brewer wrote:

>
> Eric Abrahamsen wrote:
>> okay, I think I spoke too soon. It worked once, but hasn't worked
>> since (very weird, since nothing in my environment has changed, so  
>> far
>> as I can tell). The next few times I tried it it died with the
>> following error:
>>
>>   File "/home/taojian/lib/python2.5/cherrypy/process/servers.py",
>> line 95, in wait
>>     raise self.interrupt
>> error: (95, 'Operation not supported')
>>
>> The last time it died with that error, twice, and then got into an
>> infinite loop between wspbus.py:315 and wspbus.py:157, log and
>> publish, back and forth. I'm pasting everything below; the log/
>> publish
>> loop continued until it hit max recursion depth...
>
> OK, first things first. http://www.cherrypy.org/changeset/2027 should
> fix the infinite loop.
>
>> [24/Jul/2008:05:17:56] ENGINE Error in HTTP server: shutting down
>> Traceback (most recent call last):
>>   File "/home/taojian/lib/python2.5/cherrypy/process/servers.py",
>> line 73, in _start_http_thread
>>     self.httpserver.start()
>>   File "/home/taojian/lib/python2.5/cherrypy/wsgiserver/__init__.py",
>> line 1377, in start
>>     raise socket.error, msg
>> error: (95, 'Operation not supported')
>
> Why is wsgiserver being run? That should be unsubscribed when you  
> choose
> FastCGI (via the '-f' arg to cherryd).
>
>
> Robert Brewer
> fumanchu@...
>
>
> >


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "cherrypy-users" group.
To post to this group, send email to cherrypy-users@...
To unsubscribe from this group, send email to cherrypy-users-unsubscribe@...
For more options, visit this group at http://groups.google.com/group/cherrypy-users?hl=en
-~----------~----~----~----~------~----~------~--~---