[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [EXT] Web development
Re: [EXT] Web development
Fri, 4 Sep 2020 11:56:25 -0400
On Fri, Sep 4, 2020 at 11:44 AM Zelphir Kaltstahl
> Hello Guile Users!
> Today I wanted to try developing a website in Guile again. I took a look
> at GNU Artanis, but unfortunately it seems to be not compatible with
> Guile 3 or at least not yet released for Guile 3. At least version 0.4.1
> on Guix seems to still depend on Guile-2.2.x. So I thought "Hmmm I had
> that example project once, but the issue was with serving static files
> not being a good idea using Guile's web server." So that leads me to the
> next point: What HTTP server to use?
> - I could use NGINX, but then again I don't really like NGINX
> configurations, even though I am familiar with it.
> - I could try and get familiar with HAProxy. This seems to have the
> advantage of being GPLv2.
> But how to create a development setup? I'd like to not install Docker on
> this particular system (so far it is very clean, only using free
> software), but still keep my system clean. Perhaps I could use Guix
> somehow (Guix containers?). Both, NGINX and HAProxy, seem available on Guix.
> I seem to remember, that sending static files via Guile's web server
> would be slow or insecure and that other HTTP servers make use of
> sendfile or something, to be fast. Also they take care of MIME types
> etc. I would be OK with being a bit slower, if I don't have to make a
> huge effort to handle MIME types and whatever other stuff correctly. But
> if there was something already implemented in Guile somewhere, which I
> could copy for my project, perhaps that would work too.
> I would like to have a local development environment, where I can start
> a server (and the Guile service behind it) with a command and shut it
> down again, but keeping my system rather clean.
> So I have a few questions:
> (1) How do you do your Guile web development? What's the setup?
> (2) What do you use to serve static files (securely)? If you use Guile's
> web server, how exactly do you do it? Do you have the code somewhere?
> (3) Perhaps there is a minimalistic option instead of NGINX or HAProxy
> out there, which is also free software? Is there perhaps even anything
> in Guile, which I could use, that is suitable for serving static files?
I have never run a guile web application in a production environment
but the same general pattern for web applications written in other
languages would apply here:
* nginx (or equivalent) sits in front and all requests go through it first
* nginx handles all static file requests because it is very good at
serving static files
* all other requests are passed to the guile web application via reverse proxy
Artanis is the only web framework I know of for Guile, but I've never
used it. I wrote the initial version of the 'guix publish' tool using
Guile's built-in web server and used the built-in pattern matcher for
handling the very simple request routing it needed.
Hope this helps,