From: Georges Ko
Subject: Lisp-based web servers => how do you use / maintain them?
Date: 
Message-ID: <u7jwycfgy.fsf@gko.net>
    Hi,

    I'm currently playing with Portable Aserve on LispWorks and have
been wondering about how to use it, compared to things such as PHP or
JSP:

    With PortableAserve (PA):

        the server (Lisp environment) is launched, the server code
        loaded and run, then some paths are published; if you want
        to add new paths, you have to access the Lisp environment,
        load the code and publish them...

    Compared with PHP or JSP:

        the server is launched; if you want to add new paths, you
        just have to put the PHP or JSP files in the desired
        directories and that's about it...

    Thus, the PA (and CL-HTTP?) model seems less practical, from a
publishing and maintenance points of view, since its more than "just
edit some files"...

     So, how do you remotely maintain Lisp-based web server(s)
contents and logic, that is, without having access (besides FTP,
telnet, ...) to the machine hosting the server? Do your computed pages
load Lisp some files before each request? But then, wouldn't that
require you to publish new paths for new files? I mean, unless there
is some way to automatically map paths to Lisp (or whatever) files, I
certainly wouldn't want to have to maintain such a mapping... Also,
since the file system doesn't mirror the web pages, it's hard to know
what is really running or is available (published) if a lot of changes
have been done through the listener after a long time...

    Let's say you want to run LispWorks + portableaserve on some
computer that is 10 m away from you, how do you maintain (add new
material, modify code, etc...) it?

    Thanks for any clue!

    Georges    
-- 
 Georges Ko                     ···@gko.net                      2004-04-03
 If you are not in my white list, add [m2gko] in the subject of your mail.

From: Tomek Lipski
Subject: Re: Lisp-based web servers => how do you use / maintain them?
Date: 
Message-ID: <c4kifj$fmn$1@atlantis.news.tpi.pl>
Georges Ko wrote:
>     Hi,
> 
>     I'm currently playing with Portable Aserve on LispWorks and have
> been wondering about how to use it, compared to things such as PHP or
> JSP:
> 
>     With PortableAserve (PA):
> 
>         the server (Lisp environment) is launched, the server code
>         loaded and run, then some paths are published; if you want
>         to add new paths, you have to access the Lisp environment,
>         load the code and publish them...
> 
>     Compared with PHP or JSP:
> 
>         the server is launched; if you want to add new paths, you
>         just have to put the PHP or JSP files in the desired
>         directories and that's about it...
> 
>     Thus, the PA (and CL-HTTP?) model seems less practical, from a
> publishing and maintenance points of view, since its more than "just
> edit some files"...
> 
>      So, how do you remotely maintain Lisp-based web server(s)
> contents and logic, that is, without having access (besides FTP,
> telnet, ...) to the machine hosting the server? Do your computed pages
> load Lisp some files before each request? But then, wouldn't that
> require you to publish new paths for new files? I mean, unless there
> is some way to automatically map paths to Lisp (or whatever) files, I
> certainly wouldn't want to have to maintain such a mapping... Also,
> since the file system doesn't mirror the web pages, it's hard to know
> what is really running or is available (published) if a lot of changes
> have been done through the listener after a long time...

Afaik some Lisp Server Pages implementations detect changes to .lsp 
files on the fly and reload them.

In fact only php applications are "just edit some files" - java server 
pages require compilation (and sometimes redeployment) of Java classes 
and I dont think that you can do things like changing slots for existing 
class instances - never found that useful, but this propably comes from 
little experience in web programming with Lisp.

 From my point of view, PortableAserve requires some kind of wrapping 
around its functionalities (Model View Controller with some whistles may 
be good for some people).

As for reloading of bussiness logic portion of application I don't see a 
problem in implementing simple reload/redeploy action visible as url.

Best regards,

Tomek Lipski
From: Christopher C. Stacy
Subject: Re: Lisp-based web servers => how do you use / maintain them?
Date: 
Message-ID: <uoeqa3vsm.fsf@news.dtpq.com>
>>>>> On Fri, 02 Apr 2004 22:29:16 +0200, Tomek Lipski ("Tomek") writes:
 Tomek> java server pages require compilation (and sometimes redeployment)
 Tomek> of Java classes and I dont think that you can do things like
 Tomek> changing slots for existing class instances - never found that
 Tomek> useful, but this propably comes from little experience in web
 Tomek> programming with Lisp.

That sort of thing is useful when debugging the web application, 
or even making certain kinds of patches to the live system without 
having to take it offline.
From: Rob Warnock
Subject: Re: Lisp-based web servers => how do you use / maintain them?
Date: 
Message-ID: <kaCcnfeeba6iAvPd3czS-g@speakeasy.net>
Tomek Lipski  <·······@Remove.thiS.common-lisp.And.thaT.net> wrote:
+---------------
| Georges Ko wrote:
| > ...  So, how do you remotely maintain Lisp-based web server(s)
| > contents and logic, that is, without having access (besides FTP,
| > telnet, ...) to the machine hosting the server?
+---------------

First off, use Dan Barlow's "dettachtty" <URL:http://www.cliki.net/detachtty>
to get access to the REPL remotely, even when the server was started
without a terminal at boot time. It can also keep a dribble log of what
came out of the REPL when you weren't watching.

+---------------
| > Do your computed pages load Lisp some files before each request?
+---------------

Mine do, but only the first time (or if the Lisp file has changed
since the last time the associated URL was accessed).

Note: I don't use AServe/PortableAserve (wrote my own mod_lisp-like
server behind Apache), but you should be able to do something similar
with them.

+---------------
| > since the file system doesn't mirror the web pages, it's hard to know
| > what is really running or is available (published) if a lot of changes
| > have been done through the listener after a long time...
|
| Afaik some Lisp Server Pages implementations detect changes to .lsp 
| files on the fly and reload them.
+---------------

Exactly. My code does the same thing and, iff the code was compiled
before, recompiles it first.

+---------------
| As for reloading of business logic portion of application I don't see a 
| problem in implementing simple reload/redeploy action visible as url.
+---------------

I have found the following very useful during development and early
deployment, though it might too expensive to use when the load starts
building up:

    % grep lisp /usr/local/apache/htdocs/foo/bar/.htaccess
    AddHandler lisp-handled-pages .lhp

    % cat /usr/local/apache/htdocs/foo/bar/baz.lhp
    ;;; Boilerplate for using ASDF from LHP page.
    (let ((system "some-ASDF-system-name")
	  (package :org.rpw3.package-name)
	  (function '#:baz-page-function-name))
      (flet ((this-page (request)
	       ;; Ensure up-to-date each time
	       (asdf:operate 'asdf:load-op system)
	       ;; Must use following hack since package doesn't exist
	       ;; the first time this is read.
	       (funcall (intern (symbol-name function) package)
			request)))
	(lhp:lhp-set-page-function #'this-page)))
    % 

So when any file in the ASDF-managed system changes, the next HTTP
request for that page will "do the right thing" and compile/reload
all of the pieces affected by the change(s). Like I said, it's somewhat
crude (practically a sledgehammer, to be blunt!), but *very* convenient
during development...


-Rob

-----
Rob Warnock			<····@rpw3.org>
627 26th Avenue			<URL:http://rpw3.org/>
San Mateo, CA 94403		(650)572-2607
From: Dave Roberts
Subject: Re: Lisp-based web servers => how do you use / maintain them?
Date: 
Message-ID: <2hCbc.65262$w54.399324@attbi_s01>
Rob Warnock wrote:

> First off, use Dan Barlow's "dettachtty"
> <URL:http://www.cliki.net/detachtty> to get access to the REPL remotely,
> even when the server was started without a terminal at boot time. It can
> also keep a dribble log of what came out of the REPL when you weren't
> watching.

Is there a way to do this with SLIME? That is, a really nice development
environment would be SLIME running in local Emacs connected to a remote
Lisp image, tunneled over SSH for security. If there was then some way to
push both files and bits of lisp to the remote REPL, that would be really
cool.

The problem with the basic REPL is that it's hard to edit at. Yup, you can
do some amount of debugging, and then fix a bug in a local file, transfer
the file to a remote location, and then reload it through the REPL, but it
seems like all that could be fully automated out of Emacs for a really nice
debugging/editing environment on a running system.

So, has anybody done this, or is there some flaw somewhere that I'm not yet
seeing?

-- 
Dave Roberts
·············@re-move.droberts.com
From: Brian Mastenbrook
Subject: Re: Lisp-based web servers => how do you use / maintain them?
Date: 
Message-ID: <030420041251111196%NOSPAMbmastenbNOSPAM@cs.indiana.edu>
In article <······················@attbi_s01>, Dave Roberts
<·············@re-move.droberts.com> wrote:

> Is there a way to do this with SLIME? That is, a really nice development
> environment would be SLIME running in local Emacs connected to a remote
> Lisp image, tunneled over SSH for security. If there was then some way to
> push both files and bits of lisp to the remote REPL, that would be really
> cool.
> 
> The problem with the basic REPL is that it's hard to edit at. Yup, you can
> do some amount of debugging, and then fix a bug in a local file, transfer
> the file to a remote location, and then reload it through the REPL, but it
> seems like all that could be fully automated out of Emacs for a really nice
> debugging/editing environment on a running system.
> 
> So, has anybody done this, or is there some flaw somewhere that I'm not yet
> seeing?

Remote SLIME works just fine for the REPL - load swank-loader.lisp, run
(swank:create-swank-server someport), and tunnel the port. However,
remote file editing will be a problem unless you have a shared file
system between the two hosts. If you do, then everything except
interrupting lisp will work.

-- 
Brian Mastenbrook
http://www.cs.indiana.edu/~bmastenb/
From: Thomas F. Burdick
Subject: Re: Lisp-based web servers => how do you use / maintain them?
Date: 
Message-ID: <xcvd66o3msi.fsf@famine.OCF.Berkeley.EDU>
Brian Mastenbrook <····················@cs.indiana.edu> writes:

> In article <······················@attbi_s01>, Dave Roberts
> <·············@re-move.droberts.com> wrote:
> 
> > Is there a way to do this with SLIME? That is, a really nice development
> > environment would be SLIME running in local Emacs connected to a remote
> > Lisp image, tunneled over SSH for security. If there was then some way to
> > push both files and bits of lisp to the remote REPL, that would be really
> > cool.
> > 
> > The problem with the basic REPL is that it's hard to edit at. Yup, you can
> > do some amount of debugging, and then fix a bug in a local file, transfer
> > the file to a remote location, and then reload it through the REPL, but it
> > seems like all that could be fully automated out of Emacs for a really nice
> > debugging/editing environment on a running system.
> > 
> > So, has anybody done this, or is there some flaw somewhere that I'm not yet
> > seeing?
> 
> Remote SLIME works just fine for the REPL - load swank-loader.lisp, run
> (swank:create-swank-server someport), and tunnel the port. However,
> remote file editing will be a problem unless you have a shared file
> system between the two hosts. If you do, then everything except
> interrupting lisp will work.

Out of curiosity, what's wrong with using tramp?

-- 
           /|_     .-----------------------.                        
         ,'  .\  / | No to Imperialist war |                        
     ,--'    _,'   | Wage class war!       |                        
    /       /      `-----------------------'                        
   (   -.  |                               
   |     ) |                               
  (`-.  '--.)                              
   `. )----'                               
From: Ivan Boldyrev
Subject: Re: Lisp-based web servers => how do you use / maintain them?
Date: 
Message-ID: <3j93k1xin6.ln2@ibhome.cgitftp.uiggm.nsc.ru>
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 8704 day of my life Dave Roberts wrote:
> Rob Warnock wrote:
>
>> First off, use Dan Barlow's "dettachtty"
>> <URL:http://www.cliki.net/detachtty> to get access to the REPL remotely,
>> even when the server was started without a terminal at boot time. It can
>> also keep a dribble log of what came out of the REPL when you weren't
>> watching.
>
> Is there a way to do this with SLIME?

Run remote lisp with Swank:

;; Usage:
;;
;;   (require :swank)
;;   (swank:create-swank-server PORT) => ACTUAL-PORT
;;
;;
;; (PORT can be zero to mean "any available port".)
;; Then the Swank server is running on localhost:ACTUAL-PORT. You can
;; use `M-x slime-connect' to connect Emacs to it.

slime-connect will ask hostname and port.

Looks very interesing, but I didn't try such configuration...

- -- 
Ivan Boldyrev

                                                  Your bytes are bitten.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.3.5 (GNU/Linux)

iQEVAwUBQG73Qg4ALcwzZFpVAQLWkwf/bFz1yjgp3kCJNbQVd6R2Y43C1TDe71h8
KKCTfK2gfJVJF12lTPJ6T5R7bwtDDuCBPjPRE7Qa3E9+0BPPXCnflK4qmnT6H+Km
A31B9nTBQrhkUeUT2nBlUM268QwDoZjNhMQRgf9PsezOtsV3BJNwOXJ1+/dbc72H
xPCam8zVqLEp2gNeR2ETwRGvFfz+qVfTbH7Kolyg1rvHjPhFNz4iQhNoc/mVsHoy
N8RpdICz7vFR5o9hmbnXKY7BuBmivVvG0ovlpHWzPq1hKK9HCzlSGrEYiRBcnD4i
DqladnsD25o8GoEGxzCRWxm8uHG80lQ7LWa+S0d9IqfE1tBNc3cTFg==
=eeld
-----END PGP SIGNATURE-----
From: Jans Aasman
Subject: Re: Lisp-based web servers => how do you use / maintain them?
Date: 
Message-ID: <406f33f2$0$566$e4fe514c@news.xs4all.nl>
>>  From my point of view, PortableAserve requires some kind of wrapping
> around its functionalities (Model View Controller with some whistles may
> be good for some people).
>
did you see webactions, the wrapping around aserve?
http://opensource.franz.com/aserve/
From: Tomek Lipski
Subject: Re: Lisp-based web servers => how do you use / maintain them?
Date: 
Message-ID: <c4ocjj$deo$1@atlantis.news.tpi.pl>
Jans Aasman wrote:

>>> From my point of view, PortableAserve requires some kind of wrapping
>>
>>around its functionalities (Model View Controller with some whistles may
>>be good for some people).
>>
> 
> did you see webactions, the wrapping around aserve?
> http://opensource.franz.com/aserve/
Only from a manuals (haven't tried it). Looks quite ok for me, the only 
thing they could add is including raw lisp code in .clp files (but that 
may be undesired for some reasons).

The tag model they use lacks expressions (jstl or rtexpr-like) for me to 
be totally flexible (I know that I can write my own tags, but first 
thing I would do i would write simple expression language alike to 
jstl). In java such expressions allowed to dynamize code (no type 
checking at compile-time, working on simple lists, etc.) but Lisp code 
can be dynamic enough without such extensions.

In fact, I liked WebActions so much, that I am working on my own MVC 
framework for Lisp. I believe that little rivalization can do only good 
for both projects :-)

Best regards,

Tomek Lipski
From: Matthew Danish
Subject: Re: Lisp-based web servers => how do you use / maintain them?
Date: 
Message-ID: <20040403055525.GE22619@mapcar.org>
On Sat, Apr 03, 2004 at 04:06:05AM +0800, Georges Ko wrote:
>     Thus, the PA (and CL-HTTP?) model seems less practical, from a
> publishing and maintenance points of view, since its more than "just
> edit some files"...

It is more than ``just edit some files.''  In fact, the PA model is
designed to be most practical to Lisp programmers.  Most Lisp
programmers work by incrementally changing the Lisp image from the
top-level, and PA lets you do this with dynamic web pages.  I run PA
from within a detached screen session which lets me get at the REPL from
remote easily.  I find this to be a very powerful way of working with
the web server, but it may not be suitable to all situations.  However,
PA's language is Common Lisp, and obviously giving the full power of CL
to unprivileged users is a recipe for security violations.  It is
conceivable to embed a language interpreter or compiler into PA that
would allow it to load files from users' directories and run them, but
personally I'd rather they run their own Lisp image and have it managed
by mod_proxy if you don't want PA talking directly to the clients.

-- 
; Matthew Danish <·······@andrew.cmu.edu>
; OpenPGP public key: C24B6010 on keyring.debian.org
; Signed or encrypted mail welcome.
; "There is no dark side of the moon really; matter of fact, it's all dark."
From: Edi Weitz
Subject: Re: Lisp-based web servers => how do you use / maintain them?
Date: 
Message-ID: <m3brm9mr0r.fsf@bird.agharta.de>
On Sat, 03 Apr 2004 04:06:05 +0800, Georges Ko <···@gko.net> wrote:

>     I'm currently playing with Portable Aserve on LispWorks and have
> been wondering about how to use it, compared to things such as PHP
> or JSP:
>
>     With PortableAserve (PA):
>
>         the server (Lisp environment) is launched, the server code
>         loaded and run, then some paths are published; if you want
>         to add new paths, you have to access the Lisp environment,
>         load the code and publish them...
>
>     Compared with PHP or JSP:
>
>         the server is launched; if you want to add new paths, you
>         just have to put the PHP or JSP files in the desired
>         directories and that's about it...
>
>     Thus, the PA (and CL-HTTP?) model seems less practical, from a
> publishing and maintenance points of view, since its more than "just
> edit some files"...

As others have already pointed out Lispers seem to find this /more/
practical, not less practical. If you think that editing and uploading
lots of different files is a better approach you probably haven't
grokked the Lisp way of doing things yet.

Besides, if you really dig the PHP (yuk!) way of doing this you might
want to look at how a "project" is defined in Allegro Webactions[1] -
or maybe check out clhp[2] (which I don't know myself).

>      So, how do you remotely maintain Lisp-based web server(s)
> contents and logic, that is, without having access (besides FTP,
> telnet, ...) to the machine hosting the server?

With telnet (or rather ssh) access most Lispers building a dynamic web
site use something like Dan Barlow's detachtty.[3] Search this group's
archive for usage descriptions - see for example my posting from
February.[4]

> Do your computed pages load Lisp some files before each request?

No, generally not.

> But then, wouldn't that require you to publish new paths for new
> files?  I mean, unless there is some way to automatically map paths
> to Lisp (or whatever) files, I certainly wouldn't want to have to
> maintain such a mapping... Also, since the file system doesn't
> mirror the web pages, it's hard to know what is really running or is
> available (published) if a lot of changes have been done through the
> listener after a long time...

You don't have to work solely in the listener. I usually test on my
local machine, prepare a patch file, transfer it to the server and
load it from the REPL. Why do all newbies think that you're forbidden
to use source files in Lisp and must only use the listener? Sheesh...

BTW, if you are restricted to one fixed URL-to-file-name mapping as
with PHP it is very hard to do interesting things. You don't have to
compare PHP with Lisp - just look at the dozen or so parts of the
Apache "request cycle" and how you can modify its behaviour with
mod_perl[5]. Try to write, say, a cleanup handler in PHP.[6]

(After you've checked out mod_perl and you're beginning to think that
it's fun and flexible stop for a moment and become aware of the fact
that you generally have to restart Apache after you've made a change
to your code. Hmm...)

Of course, if you only have very simple, boring projects that do
nothing that wasn't anticipated by PHP's pre-packaged functionality
PHP looks kinda cool... :)

>     Let's say you want to run LispWorks + portableaserve on some
> computer that is 10 m away from you, how do you maintain (add new
> material, modify code, etc...) it?

See above.

Cheers,
Edi.


[1] <http://www.franz.com/support/tech_corner/using-webactions.html>
    <http://www.franz.com/support/tech_corner/webactions.html>
[2] <http://common-lisp.net/project/clhp/>
[3] <http://www.cliki.net/detachtty>
[4] <http://www.google.com/groups?selm=m3znbehv6m.fsf%40bird.agharta.de>
[5] described very well in O'Reilly's "Eagle book"
[6] Nope, register_shutdown_function doesn't do that - it's buggy.
From: Brian Mastenbrook
Subject: Re: Lisp-based web servers => how do you use / maintain them?
Date: 
Message-ID: <030420041014155588%NOSPAMbmastenbNOSPAM@cs.indiana.edu>
In article <·············@gko.net>, Georges Ko <···@gko.net> wrote:

>     Let's say you want to run LispWorks + portableaserve on some
> computer that is 10 m away from you, how do you maintain (add new
> material, modify code, etc...) it?

I maintain the lisppaste (
http://www.common-lisp.net/project/lisppaste/ ) IRC bot remotely.
Basically my development method is:

* Launch a development lisppaste on the local machine and make the
changes
* Sync with the remote computer over CVS
* Compile and load the changed files

That's it... I don't know if it ought to be any more complicated than
that!

-- 
Brian Mastenbrook
http://www.cs.indiana.edu/~bmastenb/
From: Jock Cooper
Subject: Re: Lisp-based web servers => how do you use / maintain them?
Date: 
Message-ID: <m3lllaweq6.fsf@jcooper02.sagepub.com>
Georges Ko <···@gko.net> writes:

>     Hi,
> 
>     I'm currently playing with Portable Aserve on LispWorks and have
> been wondering about how to use it, compared to things such as PHP or
> JSP:
> 
>     With PortableAserve (PA):
> 
>         the server (Lisp environment) is launched, the server code
>         loaded and run, then some paths are published; if you want
>         to add new paths, you have to access the Lisp environment,
>         load the code and publish them...
> 
>     Compared with PHP or JSP:
> 
>         the server is launched; if you want to add new paths, you
>         just have to put the PHP or JSP files in the desired
>         directories and that's about it...
> 
>     Thus, the PA (and CL-HTTP?) model seems less practical, from a
> publishing and maintenance points of view, since its more than "just
> edit some files"...
> 
>      So, how do you remotely maintain Lisp-based web server(s)
> contents and logic, that is, without having access (besides FTP,
> telnet, ...) to the machine hosting the server? Do your computed pages
> load Lisp some files before each request? But then, wouldn't that
> require you to publish new paths for new files? I mean, unless there
> is some way to automatically map paths to Lisp (or whatever) files, I
> certainly wouldn't want to have to maintain such a mapping... Also,
> since the file system doesn't mirror the web pages, it's hard to know
> what is really running or is available (published) if a lot of changes
> have been done through the listener after a long time...
> 
>     Let's say you want to run LispWorks + portableaserve on some
> computer that is 10 m away from you, how do you maintain (add new
> material, modify code, etc...) it?
> 
>     Thanks for any clue!
> 

You can automatically map paths with a small amount of CL code.

Define an interface in which each FASL file defines a separate package
and contains a symbol like *web-publish-url*.  Then keep a thread
running to scan your FASL directory periodically and load in any new
FASLs it sees.  It then decides which package is new, and PUBLISHes
newpackagename::*web-publish-url*.  This idea can be used for
init actions other than PUBLISH of course.  For example, the package
could also contain a function called INITIALIZE-ME which the scanner
would check for and run.  

And as other posters have mentioned you can easily set up a remote
REPL to do other maintainance.

I implemented a web based system for distributing financial reports
much like this.


--
http://www.fractal-recursions.com
From: Georges Ko
Subject: Re: Lisp-based web servers => how do you use / maintain them?
Date: 
Message-ID: <ulll95atw.fsf@gko.net>
    I have installed SLIME and it works well with LispWorks, so my
main issue (remote maintenance / debug) is no more there.

    Thanks for all your inputs! 
-- 
 Georges Ko                     ···@gko.net                      2004-04-07
 If you are not in my white list, add [m2gko] in the subject of your mail.