Re: LW as a web app
"Adam Weaver (as adam at cleversure dot com dot au)" <[email protected]>
| Newsgroups | gmane.lisp.lispworks.general |
|---|---|
| Message-ID | <ME0P282MB46312D6F5C3B8402733860379C60A@ME0P282MB4631.AUSP282.PROD.OUTLOOK.COM> |
>> Which required a FASTCGI responder: https://github.com/adamweaver/lw-fcgi > How does this work? Do you compile your lisp application to an > executable Yes, like I said in the original post - DELIVER the application to an executable. I run the executable in a startup script on the server. > which is then spawned by the webserver? That's CGI not FASTCGI. CGI is a "spawn process per connection", and FASTCGI was invented to multiplex requests over a single connection > Or do you run it in app-server style, where you expose a socket or a tcp > port from your running lisp to service requests from the webserver? Yeah this one. My LW-FCGI code listens on the given port for FCGI requests. It's a binary protocol, but it's pretty basic. Essentially it's the same as a HTTP/1.1 request, but rather than parsing headers from the body stream, HTTP headers are sent in a weird sort-of-netstring-but-not-really format. > The former is the only mode of operation that seems to be possible from > what I see from locally installed lighttpd docs. that's interesting. I'm using CADDY as a frontend rather than lighthttpd, and Caddy explicitly requires the fcgi/http transports to already be running. No spwaning-on-demand possible. > There are two versions > of cl-fastcgi on github. KDr2/cl-fastcgi (also KDr2/sb-fastcgi) which > uses ffi to a c library libfcgi.so, and there's also a sbcl-only > ruediger/cl-fastcgi which seems to be a lisp implementation, Oh to be honest I didn't even look for existing lisp fastcgi implementations before writing my own. It's rather a simple protocol - I had it running in a day. FCGI _is_ however rather underspecified - no RFC level of detail in the "spec", so there's a little bit of trial-and-error required in the implementation. > I can't > spot how to rig a running lisp to the webserver. I'm with you - socket/port is the way I guess. Makes sense, the image based nature of lisp doesn't exactly play well with the average web server. I think even PHP has gone the FastCGI route - mod_php (Apache only) seems to be deprecated in favour of FPM. But that's PHP. Yuck. > Would it be possible for me to run lw-fcgi from say the personal edition > where with say lighthttp? I would think so? There's nothing LW-PRO or LW-ENT specific in the codebase. It *is* a very simple protocol after all. But you'd want to fix the request matching to suit your needs; the code I shoved up on github is very specific to my needs :( I only put that and a bunch of other support libs up on github because I was having the guilts over not contributing non-core-to-my-app code back to the community. Not that I would expect anyone in the community to be particularly interested in my not-documented-at-all-and-probably-complete-crap code anyway :| A _______________________________________________ Lisp Hug - the mailing list for LispWorks users [email protected] http://www.lispworks.com/support/lisp-hug.html