[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[MirageOS-devel] irmin-www server



Hi,

I'm making a little Irmin-based web-server:

  https://github.com/talex5/irmin-www

It serves the contents of an Irmin repository as an HTTP site, and
allows updating the site via the Irmin REST API (which can be used via
the command-line). I have a few questions:

First, can I sync to it using the "irmin" CLI? I can upload individual
files, e.g.

    irmin write -s http --uri https://127.0.0.1:8444 index.html
'<h1>Hello, world!</h1>'

But I don't see a way to clone the whole repository or push from a
local one, e.g.

    $ irmin clone --verbose -s mem https://127.0.0.1:8444
    Error!

Is there a Mirage BLOCK backend for Irmin yet? Currently, when
compiled for Xen it uses an in-memory store only. I think someone
tried it under FAT - did that work? What is the long-term plan here?

Finally, the listen API for the Irmin server seems awkward. After
configuring its HTTP server, Irmin wants to call listen itself, which
requires passing in a module defining it. Since listen requires extra
context (e.g. the TCP stack to use and TLS parameters), this requires
defining an in-line module. e.g.

    Lwt.async (fun () ->
      let module Irmin_server = struct
        module X = struct
          include S

          let listen t ?timeout uri =
            assert (timeout = None);
            let port = match Uri.port uri with
              | None   -> failwith "Missing port in Irmin endpoint"
              | Some p -> p in
            Stack.listen_tcpv4 stack ~port (wrap_tls tls_config (listen t));
            return ()
        end
        module Y = struct
          let pretty d =
            Printf.sprintf "%Ld" d
        end

        include Irmin_http_server.Make(X)(Y)(Store)
      end in
      Irmin_server.listen (s "server") ~strict:true irmin_uri
    );
    Stack.listen stack

Perhaps it would make more sense for Irmin_http_server to return the
spec, rather than calling listen itself? Then I could pass the Cohttp
S module directly to the Irmin functor and call listen myself. Also,
Irmin could then forget about the timeout parameter. Maybe the URI
could go away too.

However, even that requires letting Irmin parse the HTTP requests
itself. It would be more convenient for me to handle all HTTP requests
on a single port, and dispatch paths under /api to Irmin, for example.
Maybe we need some standard dispatcher API here?

Finally, what options does Irmin provide for authentication? I see it
supports https, but it seemed overly helpful about automatically
accepting my self-signed server certificate. Can I use it with client
auth, or HTTP basic auth?

Thanks,


-- 
Dr Thomas Leonard        http://roscidus.com/blog/
GPG: DA98 25AE CAD0 8975 7CDA  BD8E 0713 3F96 CA74 D8BA

_______________________________________________
MirageOS-devel mailing list
MirageOS-devel@xxxxxxxxxxxxxxxxxxxx
http://lists.xenproject.org/cgi-bin/mailman/listinfo/mirageos-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.