Deploying Ocsigen applications

Hi,

I have written a short text on how Ocsigen applications might be packed in order to be deployed to other nodes, that don’t have your development environment installed.

Deploying Ocsigen

If you happen to have a better way, or solutions to parts that I have not been able to solve, please let me know.

Kindest regards,

Hans Ole Rafaelsen

3 Likes

Generally, I’ve had good success containerizing all my apps.

It works with many technologies, forces you to simplify/standardize your build and deployment processes. Plus it solves the problem of having apps with conflicting dependencies running on the same server.

I don’t know if it’s “better" though.

Hi,

Thank you! That’s interesting.

Be Sport is using Docker containers on EC2. Maybe @vouillon or @Jean_Dutier can give more info about that.

I started last week to work on a simpler way to run Ocsigen Server without config file and with static linking. The feature existed for years but was not documented (and was not implemented for all modules and not fully functional).

My draft PR is here: Using Ocsigen Server without configuration file (and with static linking) by balat · Pull Request #238 · ocsigen/ocsigenserver · GitHub

My goal is to make Ocsigen Server easier to use for example as a unikernel with MirageOS.
For Eliom, I think I will add an optional parameter to the register function for the and on which you want your service to be registered.

I will try to complete it soon and make a release and document it.

Vincent

3 Likes

Hi,

This sounds interesting and I’m looking forward for it. Looks like everyone is using containers for everything these days, but it’s nice to have the option to “travel light”.


Hans Ole

2 Likes

Hi!

I hope you don’t mind me ressurecting this thread.

I built an Eliom web application using the new(ish) “ocsigenserver as a library without config file” method (@Vincent_Balat mentioned it in his comment).
This is what I did:

  • I started the project with eliom-distillery using the app.lib template.
  • I threw away the Makefiles, which didn’t seem to match this development style.
  • I developed my application (let’s call it foo), testing it with dune build ; dune exec foo.

When I try to run the resulting binary foo_main.exe on the server, it won’t run:

./foo_main.exe 
Fatal error: exception Failure("Config file not found - neither XXX/.opam/ocsigen/lib/findlib.conf nor the directory XXX/.opam/ocsigen/lib/findlib.conf.d")
Raised at Stdlib.failwith in file "stdlib.ml", line 29, characters 17-33
Called from Findlib.init in file "findlib.ml", lines 194-196, characters 10-34
Called from Ocsigen_loader in file "src/baselib/ocsigen_loader.ml", line 136, characters 9-24

The development machine and the server both run Debian 12. I don’t need static binaries including libc and everything. But I was hoping to build a binary which contains the Eliom app completely.
How would I do that?

Thank you!

Hi,

I have not tried with the latest version. With the old version I had to create an empty findlib.conf file and set environment variable OCAMLFIND_CONF to point to this file (export OCAMLFIND_CONF=./lib/findlib.conf). But I guess that brakes the single file application. You can try this as a temporary workaround. Hopefully there is a better way to do this.

Regards,

Hans

This still works, thank you very much!