Tomek Lipski <tlipski@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@rpw3.org>
627 26th Avenue <URL:http://rpw3.org/>
San Mateo, CA 94403 (650)572-2607