5 ms·
Lwt [1] based web frameworks can be used on MirageOS if they provide an interface that allows someone to swap out the unix dependent pieces. One such framework
by anuragsoni 6y ago
Lwt [1] based web frameworks can be used on MirageOS if they provide an interface that allows someone to swap out the unix dependent pieces. One such framework is Opium [2], that provides most of its features in a unix independent code library `opium_kernel`. Its fairly straightforward to run an opium app on mirage. This example needs to be updated to the newest apis in the released version of Opium but this can provide some hints about how to run an opium app on mirage: https://github.com/anuragsoni/ocaml-opium-unikernel https://github.com/anuragsoni/ocaml-opium-unikernel.
If a lower level web toolkit is sufficient then ocaml's cohttp [3] library has been available on mirage for quite some time now.
[1] https://github.com/ocsigen/lwt/ https://github.com/ocsigen/lwt/
[2] https://github.com/rgrinberg/opium https://github.com/rgrinberg/opium
[3] https://github.com/mirage/ocaml-cohttp/ https://github.com/mirage/ocaml-cohttp/
- cies 6y agoThanks for chiming in! Sadly cohttp is (or was) performing so bad that it is kind of at odds with using it on a unikernel. This one is quite a bit faster: https://github.com/inhabitedtype/httpaf https://github.com/inhabitedtype/httpaf
- anuragsoni 6y agoThe `opium_kernel` example I linked to above is running on top of https://github.com/dinosaure/paf-le-chien https://github.com/dinosaure/paf-le-chien which is a mirage layer for httpaf. Opium itself has also moved to using httpaf as the underlying layer.
- cies 6y agoWow. That's great. Thanks for setting this straight. Seems OCaml/Mirage is the pretty far ahead in typed web dev using a unikernel.