I am trying to make a statically linked executable of an ocsigen server.
The code for the service looks like this:
module Stat_test_app =
Eliom_registration.App (
struct
let application_name = "stat_test"
let global_data_path = None
end)
let f = lazy begin
let main_service =
Eliom_service.create
~path:(Eliom_service.Path [])
~meth:(Eliom_service.Get Eliom_parameter.unit)
()
in
Stat_test_app.register
~service:main_service
(fun () () ->
Lwt.return
(Eliom_tools.F.html
~title:"stat_test"
~css:[["css";"stat_test.css"]]
Html.F.(body [
h1 [txt "Welcome from Eliom's distillery!"];
])))
end
let () = Eliom_service.register_eliom_module "stat_test" (fun () -> ignore (Lazy.force f))
I use this command to make the statically linked file (not sure if all package are needed):
ocamlfind ocamlopt -package lwt.unix,lwt_log,ocsigenserver.ext.userconf,eliom,ocsigenserver.ext.ocsipersist-dbm,ocsigenserver.ext.extendconfiguration,eliom.server,ocsigenserver.ext.staticmod,lwt_ppx,js_of_ocaml-ppx.deriving _server/stat_test.cmx server_main.cmx -thread -linkpkg -o myserver
config file:
<ocsigen>
<server>
<port>8080</port>
<logdir>local/var/log/stat_test</logdir>
<datadir>local/var/data/stat_test</datadir>
<charset>utf-8</charset>
<debugmode/>
<commandpipe>local/var/run/stat_test-cmd</commandpipe>
<extension name="stat_test" />
<host hostfilter="*">
<!-- <static dir="static" /> -->
<!-- <static dir="local/var/www/stat_test/eliom" /> -->
<!-- <eliommodule module="local/lib/stat_test/stat_test.cma" /> -->
<!-- <eliom name="stat_test" /> -->
<!-- <eliom/> -->
</host>
</server>
</ocsigen>
When I try to run it complains about the configuration file. With the extension ‘stat_test’ in the configuration file it comes with: Eliom_common_base.Eliom_site_information_not_available(“service”), but the service is first added in the register_eliom_module. It also complains about the tags in the host tag.