Using Common Lisp Apache fastcgi - apache

Concerning a web app, using Common Lisp, Apache, and fastcgi can one match urls with the desired functions defined in top-level rather than writing separate script files per urls?
Is it possible to use both approach above in a development environment of Common Lisp Apache fastcgi combination? And how, by which tools?
Is it compulsory to use a server which is loaded on Common Lisp implementation (as described and mentioned as "simple-server" in this page presents sb-fastcgi) in a development environment of Common Lisp Apache fastcgi combination? Or it is not compulsory on SBCL Apache sb-fastcgi environment and "simple-server" mentioned there is just another way? I try to avoid a server like those and some others that is not as well supported and maintained as Apache.
Does fastcgi make the connection between Interpreter (a Common Lisp here) and Apache directly or via another server software loaded on Common Lisp, say like Hunchentoot or "simpleserver" mentioned?
I want to have both of above top mentioned approaches and to be able to run Common Lisp with Apache via fastcgi? What tools i need as sufficiently necessary?

I use Clack for all web-development in lisp now.
With Caveman2 you will have a pleasant lisp web experience :)
As the web documentation states:
The reason why Clack had only a few bugs so far is plenty of quality
unit tests. There are 173 tests currently. The test coverage has been
kept over 70% since its first official release.
All releases have passed the test suite on three CL implementations:
Clozure CL, SBCL, and CLISP. You can check the current status at
http://ci.clacklisp.org/.

Related

How to stub HTTP requests on Common LISP tests?

Is there any tool usually used in Common LISP tests to block all network requests and stub responses for specific URLs?
Just for reference, in Ruby we usually use:
https://github.com/bblimke/webmock
https://github.com/chrisk/fakeweb
(or even more powerful tools like https://github.com/vcr/vcr made on top of them)
I know similar tools exist in Python (I remember this one: https://github.com/gabrielfalcao/HTTPretty) and I have found:
https://github.com/johanhaleby/stub-http
created for Clojure and described here:
Strategy for stubbing HTTP requests in Clojure tests
Is there anything similar to this? If not, what do you usually test code that open connections and do external requests. Do you only mock methods directly with tools like mockingbird and cl-mock or is there anything I'm missing?

gwan reverse proxy

I am searching to configure gwan to act as reverse-proxy cache to my web python application.
I could'nt find some example on the web.
Thanks a lot for your examples
Laurent
If your goal is merely to accelerate your Python application then you should just run it from G-WAN (see the hello.py example).
Some (advanced) users have used G-WAN handlers to write their own custom proxy, but G-WAN will document its embedded proxy (and load-balancer) in the following weeks.
It still works without configuration files, so you will not have to learn anything new.
And the competent users will like the ability to personalize the proxy with their own scripts.
There's always a long way between a solution that "runs" and a polished version ready for a wide public.

Apache module for restful services

My objective is create an apache module that will provide RESTful services (i.e., we have some legacy code that controls/queries some networking equipment and we would now like to expose that functionality as a RESTful service). I guess the flow might look something like this:
WebBrowser -- issues RESTful URI---> [Apache (my_module) ] -->..
..---> Interface to existing Legacy code.
I have been mucking around various wikis, blogs, forums, articles etc. but I just can't seem to understand how those RESTful urls will get to (my_module) in apache [you can tell I have never worked with web-servers internals, much less modules, before]. I mean, do I have to edit that httpd.conf file and say something like: Send all urls that look like http://baseurl/restservices/... to my_module. If so, how do I do it?
Also, what will my_module actually get? Does it get the full http request message and it has to parse it like typical CGI programs?
Further, what is the best way for my_module to interact with my legacy code? E.g., Open a TCP connection to it and send messages and write wrapper around legacy code to interpret those messages. Or can my_module directly invoke the functions in my legacy code somehow if I compiled my entire legacy code as a module in apache?
Thanks for any hints. If u know of a good tutorial, please point me to it. I'm looking for a high level overview that will give me the architecture (the developers under me can then follow up on the nitty-gritty details).
I'd write an extension for PHP or Python and use mod_php / mod_wsgi
I think you are approaching this in the wrong way:
Apache modules are not really how you want to handle a URL if your requirements are quote basic. Depending on the language your legacy code is in, I would advise:
Binding its API into a python or PHP module, and have that script called by Apache through normal means. It is also a lot simple (in many cases) to glue a C-call style compiled language to these scripting languages rather than Apache itself.
It also has the advantage of adding an abstractions which allows you to layer additional logic in a scripting language on your core legacy code. You may also want to preprocess data and validate it from the request before handing it into your legacy code.
Both PHP and Python also have RESTful frameworks and utilities.
If you do write an Apache module, then check out Writing Apache Modules with Perl and C
See:
Developing PHP Extensions in C, Extending Python in C or C++ ... also if using Python checkout the WSGI stuff.
I'd agree with Aiden. Writing Apache modules is not for the faint hearted and you definitely don't want to go there unless you absolutely must. You would need to be prepared to become very conversant with how Apache works.
If you still think you need to, then look at:
http://httpd.apache.org/apreq/
This is a library which uses existing Apache Runtime Libraries and which provides higher level functionality for dealing with POST data, cookies etc from C code hooked into Apache via a custom module.
The book Aiden mentions though is a bit dated. Better off getting:
The Apache Modules Book: Application Development with Apache

Apache 2 Administration Tools on Ubuntu or Windows

I am totally new to Apache and Ubuntu, is there an admin tools where the available functions and features and settings are more accessible? I am finding it very difficult to do even the simplest things.... please help.
Cheers.
apacheConf is available for most flavours of Linux, however:
1) it ignores the distribution-specific layout of the config files and implements its own structure
2) its just a tool for updating the config - it doesn't actually tell you what the config options mean
3) like any gui tool it abstracts the actual data (in this case, the apache config) you are manipulating
4) there are at least 3 different programs branded as apacheConf
http://www.apache-gui.com/apache-linux.html
http://www.redhat.com/docs/manuals/linux/RHL-7.2-Manual/custom-guide/apacheconf.html
and the config tool bundled in Mandriva
5) it limits what you can actually configure to the design on the UI (e.g. RedHat apacheConf only allows you to set one listening address
Having buttons to click does not help you understand what you are actually trying to achieve (unless your objective is an MCSE of course ;). I'd recommend you go get a good book on Apache config and take the time to read it.
C.
Try Webmin - a nice web-based GUI tool. There is a .deb package for ubuntu in their downloads page.
http://webmin.com
Here are some options to consider for helping you to better understand how Apache works and how to administer/configure the server:
Read the official HOW-TO
Take a look at a commercial tool like ApacheConf
Ask questions here about the specific issues you are having
HTH,
-aj

What is the most painless and multi-platform way to use scripting?

What is the most painless and multi-platform way to use scripting?...
...for things such as
Compilation
Web application deployment
Web server controlling
Other misc. tasks around web servers...
NOTE: I'm in the Java ecosystem.
Sure, there is Apache Ant, which is pretty multi-platform, but
it isn't scripting.
Depends entirely on what environment you're working in.
For Java you can either use the JavaScript ScriptEngine that ships with the Sun JDK.
Alternatively you could use Groovy, which is a separate download but works on all modern JREs.
For general scripting I'd personally choose Python, because it's available almost everywhere and reasonably compact, while being an awsome language.
The only scripting environment that you'll find on almost all computers these days (no mater what OS/Hardware) is a JavaScript engine. But usually that's confined to the browser and doesn't really allow interaction with anything outside the browser.
I recall reading that Java and Javascript are not not related - so Joachim Sauer's answer puzzles me...
Meanwhile, the original question lists compilation; web application deployment; web server controlling and other misc tasks around web servers.
That's a very broad spectrum, but then the question wasn't 'which the best scripting language?' but 'What is the most painless and multi-platform way to use scripting?' which is not necessarily the same thing.
As BerggreenDK said 'can you elaborate?'