rgrinberg / opium

Sinatra like web toolkit for OCaml

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Move unix dependency on opium to another package

dinosaure opened this issue · comments

In the way to facilitate building an unikernel with Opium, it could be interesting to split a bit the package with two versions:

  • one with the unix dependency (like opium-unix)
  • the other with no dependencies with the host system

Some parts of Opium relies only on the caml runtime (such as route.ml) but they are unusable with MirageOS due to the dependency to unix (transitively with httpaf-lwt-unix). As far as I can see, opium as a framework requires unix only for two things:

  • the way to initiate a simple HTTP server (so we can easily move this part to a new package)
  • Body.of_file which can be special middleware available only with opium-unix

Currently, I experimented only rock with MirageOS but the API is really poor and, even if it facilitates some details (about request/response), it's not enough to make a real application.

Hi @dinosaure!

That's something we've talked about and although we're all very enthusiastic about building Opium unikernels, we agreed on waiting for some initial support for Mirage before factoring out the Unix parts of Opium.

In practice, that probably means having an opium-mirage library that provides the Mirage equivalent of the Unix-dependent bits. I've been meaning to start this work for some time now but lacked the time, so if you're experimenting on this and would like to get the ball rolling, a PR will be very much welcome 🙂