Fail to run tutorial example in ocsigen

Hi,

I’m learning ocisgen, but I fail to run the example “A basic Web site in OCaml”.

  • The command make test.byte returns Fatal - Error in configuration file: Incorrect hostname (same error with test.opt).
  • The command make run.byte returns Uncaught exception: Not_found (same error with test.opt).

I give below the full output of the used commands.

Thanks in advance for your help,

Bruno

My system:

  • Mac OSX 10.13.6
  • ocaml 4.07.1
  • opam packages:
    • js_of_ocaml 3.3.0
    • eliom 6.7.0
    • ocsigen-i18n 3.3.0
    • ocsigen-start 1.5.0
    • ocsigen-toolkit 2.0.0
    • ocsigenserver 2.11.0
~/code/ocsigen > eliom-distillery -name mysite -template basic.ppx -target-directory mysite
Destination directory "mysite" doesn't exist. Create it? (YES/no) 
Generated mysite/mysite.conf.in
Generated mysite/Makefile
Generated mysite/.ocp-indent
Generated mysite/README
Generated mysite/mysite.eliom
Generated mysite/static/css/mysite.css
Generated mysite/Makefile.options
~/code/ocsigen > cd mysite
~/code/ocsigen/mysite > make test.byte
Makefile:216: .depend: No such file or directory
mkdir _deps
eliomdep -server -ppx -package lwt_ppx -package js_of_ocaml-ppx.deriving mysite.eliom > _deps/mysite.eliom.server
eliomdep -client -ppx -package lwt_ppx -package js_of_ocaml-ppx -package js_of_ocaml-ppx.deriving mysite.eliom > _deps/mysite.eliom.client
cat _deps/mysite.eliom.server _deps/mysite.eliom.client > .depend
mkdir -p local/etc/mysite
sed -e "/^ *%%%/d" -e "s|%%PROJECT_NAME%%|mysite|g" -e "s|%%DATABASE_NAME%%||g" -e "s|%%DATABASE_USER%%||g" -e "s|%%CMDPIPE%%|%%PREFIX%%var/run/mysite-cmd|g" -e "s|%%LOGDIR%%|%%PREFIX%%var/log/mysite|g" -e "s|%%DATADIR%%|%%PREFIX%%var/data/mysite|g" -e "s|%%PERSISTENT_DATA_BACKEND%%|dbm|g" -e "s|%%LIBDIR%%|%%PREFIX%%lib/mysite|g" -e "s|%%WARNING%%|DON\'T EDIT THIS FILE! It is generated from mysite.conf.in, edit that one, or the variables in Makefile.options|g" -e "s|%%PACKAGES%%|\<extension\ findlib-package=\"lwt_ppx\"\ /\> \<extension\ findlib-package=\"js_of_ocaml-ppx.deriving\"\ /\>|g" -e "s|%%ELIOMSTATICDIR%%|%%PREFIX%%var/www/mysite/eliom|g" -e "s|%%DEBUGMODE%%||g" -e "s|%%PORT%%|8080|g" -e "s|%%STATICDIR%%|static|g" -e "s|%%USERGROUP%%||g" mysite.conf.in | sed -e "s|%%PREFIX%%|local/|g" > local/etc/mysite/mysite-test.conf
mkdir -p local/var/data/mysite
mkdir -p local/lib/mysite
mkdir -p local/var/log/mysite
mkdir -p local/var/www/mysite/static
mkdir -p local/var/www/mysite/eliom
mkdir -p local/var/run
eliomc -ppx -infer -package lwt_ppx -package js_of_ocaml-ppx.deriving mysite.eliom
File "mysite.eliom", line 29, characters 17-23:
Warning 3: deprecated: Eliom_content.Html.F.pcdata
Use txt instead
js_of_eliom -ppx -c -package lwt_ppx -package js_of_ocaml-ppx -package js_of_ocaml-ppx.deriving  mysite.eliom
js_of_eliom -ppx -o local/var/www/mysite/eliom/mysite.js  -package lwt_ppx -package js_of_ocaml-ppx -package js_of_ocaml-ppx.deriving  \
          _client/mysite.cmo
eliomc -ppx -c -package lwt_ppx -package js_of_ocaml-ppx.deriving  mysite.eliom
File "mysite.eliom", line 29, characters 17-23:
Warning 3: deprecated: Eliom_content.Html.F.pcdata
Use txt instead
eliomc -ppx -a -o local/lib/mysite/mysite.cma  \
          _server/mysite.cmo
ocsigenserver  -c local/etc/mysite/mysite-test.conf
ocsigenserver: ocsigen:main: Fatal - Error in configuration file: Incorrect hostname 
make: *** [test.byte] Error 50
~/code/ocsigen/mysite > make run.byte
ocsigenserver  -c /usr/local/etc/mysite/mysite.conf
ocsigenserver: main: Error: Wrong group
ocsigenserver: ocsigen:main: Fatal - Uncaught exception: Not_found
make: *** [run.byte] Error 100
~/code/ocsigen/mysite > 

Quick answer:

make test.byte:
Have a look at the following topic for which set of packages worked for the first example:
https://discuss.ocaml.org/t/ocsigen-start-how-to-really-get-up-and-running-in-5-minutes/3066

sudo make run.byte:
You should do sudo make install.byte first, and also pass the environment variables of the normal user (because root has no opam environment).

Concerning the “Basic web site in OCaml”, let me have a look at my notes and come back to you.

Thanks @RogerT for the answer.

I do not think that the first link is related to my problem.
However, I finally found a solution to get rid of the error Incorrect hostname.
In the my_site.conf.in file, I replace the line:

    <host hostfilter="*">

by

    <host defaulthostname="localhost" hostfilter="*">

For the second point, you’re right! make install is the solution. I should have read the doc more carefully.

Bruno