Ocsigen Start: How to really get up and running in 5 minutes?

ocsigen

#1

I started to play with ocsigen start ( two years ago, I’ve been playing with eliom).
As discussed https://discuss.ocaml.org/t/your-first-app-in-5-minutes-no/2694, I couldn’t have “app in 5 minutes” but for another reason.
In my context (Debian Stretch postgresql 11.1), I discovered that make db-init failed because of an incorrect path caused by Make.db:

$ psql --version | cut -d' ' -f 3 | cut -d'.' -f 1-2
11.1
$ echo /usr/lib/postgresql/11/bin/pg_ctl

See details on Github

I’m quite confident because ocsigen seems solidly founded for a few years now. However, there is obviously more than a minimum to know to really get up and running…in only 5mn.

Now, I get a template website running on a local ocsigen server and accessible via localhost:8080 .
I used the sequence from ocsigen-start/…/README.md that worked well, once Make.db trouble fixed:

$ make db-init
$ make db-create
$ make db-schema$
$ make test.byte (or make test.opt)

However, it doesn’t have an active menu (js is active) as in http://ocsigen-1.inria.fr/ocsigen-start/demo/.
I don’t know if it’s normal or if the setup is incomplete.

Screenshot%20from%202018-12-17%2017-46-06

_
I’ve spend much more than 5 mn just to get there and the first demo web page is not running as expected.
Hey ocsigen experienced people! What should be checked?
Then which minimum files set should be used to customized site? (obviously, at least myapp.eliom). Of course, I think I should find the necessary information to get further in https://ocsigen.org/tuto/6.2/manual/basicwebsite. But it doesn’t fit a 5 mn agreement!

Anyway I hope this will help other people to really get their first ocsigen app in 5 minutes.

_
@Vincent_Balat
If this demo page is normal, could you pls. indicate it on the README.md and also in the file that appears as the homepage?
If it’s not normal, which I highly suspect (!), can you give a hand and tell what to do from now to get up and running?

Could you add in the documentation:

  • all the detailed requirements before executing commands
  • what should be verified after each setup step
  • what should be exactly obtained from a command (e.g. make test.byte should give you a page accessible at localhost:8080 with all enabled features (menu, widgets, etc.) such as ocsigen-1.inria.frdemo )
  • the minimum files set that should be used to get a own customized running ocsigen website (I feel that one should read and practice at least all the main tutorial to really have an overview.

Thanks


#2

Hi!
Thank you for your feedback.
Of course, 5 minutes does not include package installation and debugging :wink:

If your app does nothing, it means that something went wrong.
Do you have some error message in the browser console? (or in server console).
The app should work exactly like http://ocsigen-1.inria.fr/ocsigen-start/demo/

About the Debian error: it seems that Debian changed the way it names the directories :frowning:
I will discuss the Debian hack on Github.

More generally, we have many problems with external dependencies.
The installation depends a lot on the Linux distribution and installed versions.
You will probably discover that it is even worse when you’ll try to generate a mobile app for Android (or iOS)…
NPM packages are always changing and they do not have opam to help.
We’re trying to update Ocsigen Start as much as possible to follow all these changes but it can’t be perfect.
You’ll jump into the JS world and all its inconsistencies and I think we cannot avoid that …

The only thing we can do is to fix the problems when they are discovered.
Do not hesitate to do pull requests on github if you see easy fixes.

Thank you for your comments on documentation. We’ll take them into consideration soon.

Once your project is running, take some time to explore all the features and the source code of all pages. I think it is the best way to learn.
Then, you can get rid of all demo_*.eliom* files and make your own app.

Vincent


#3

Thanks for your quick answer!

The server console seems to show nothing suspect from my basic knowledge:

Server console
==== The website is available at http://localhost:8080 ====
ocsigenserver "-v" -c local/etc/web1/web1-test.conf
ocsigenserver: ocsigen:config: While parsing config file, tag <host>: No defaulthostname, assuming it is "test"
ocsigenserver: ocsigen:main: Ocsigen has been launched (initialisations ok)
ocsigenserver: access: connection for localhost from ::1 (Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/605.1 (KHTML, like Gecko) Version/11.0 Safari/605.1 Debian/9.0 (3.22.7-1) Epiphany/3.22.7): 
ocsigenserver: access: connection for localhost from ::1 (Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/605.1 (KHTML, like Gecko) Version/11.0 Safari/605.1 Debian/9.0 (3.22.7-1) Epiphany/3.22.7): web1_d2c033bb6bbef16107f446b97a1b4a4d.js
ocsigenserver: access: connection for localhost from ::1 (Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/605.1 (KHTML, like Gecko) Version/11.0 Safari/605.1 Debian/9.0 (3.22.7-1) Epiphany/3.22.7): css/web1_ce18137e68ed19f2bfa62be33275944f.css
ocsigenserver: access: connection for localhost from ::1 (Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/605.1 (KHTML, like Gecko) Version/11.0 Safari/605.1 Debian/9.0 (3.22.7-1) Epiphany/3.22.7): css/ot_buttons.css
ocsigenserver: access: connection for localhost from ::1 (Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/605.1 (KHTML, like Gecko) Version/11.0 Safari/605.1 Debian/9.0 (3.22.7-1) Epiphany/3.22.7): css/ot_carousel.css
ocsigenserver: access: connection for localhost from ::1 (Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/605.1 (KHTML, like Gecko) Version/11.0 Safari/605.1 Debian/9.0 (3.22.7-1) Epiphany/3.22.7): css/ot_datetime.css
ocsigenserver: access: connection for localhost from ::1 (Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/605.1 (KHTML, like Gecko) Version/11.0 Safari/605.1 Debian/9.0 (3.22.7-1) Epiphany/3.22.7): css/font-awesome.min.css
ocsigenserver: access: connection for localhost from ::1 (Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/605.1 (KHTML, like Gecko) Version/11.0 Safari/605.1 Debian/9.0 (3.22.7-1) Epiphany/3.22.7): css/ot_sticky.css
ocsigenserver: access: connection for localhost from ::1 (Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/605.1 (KHTML, like Gecko) Version/11.0 Safari/605.1 Debian/9.0 (3.22.7-1) Epiphany/3.22.7): css/ot_drawer.css
ocsigenserver: access: connection for localhost from ::1 (Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/605.1 (KHTML, like Gecko) Version/11.0 Safari/605.1 Debian/9.0 (3.22.7-1) Epiphany/3.22.7): css/ot_page_transition.css
ocsigenserver: access: connection for localhost from ::1 (Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/605.1 (KHTML, like Gecko) Version/11.0 Safari/605.1 Debian/9.0 (3.22.7-1) Epiphany/3.22.7): css/ot_icons.css
ocsigenserver: access: connection for localhost from ::1 (Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/605.1 (KHTML, like Gecko) Version/11.0 Safari/605.1 Debian/9.0 (3.22.7-1) Epiphany/3.22.7): css/ot_popup.css
ocsigenserver: access: connection for localhost from ::1 (Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/605.1 (KHTML, like Gecko) Version/11.0 Safari/605.1 Debian/9.0 (3.22.7-1) Epiphany/3.22.7): css/ot_picture_uploader.css
ocsigenserver: access: connection for localhost from ::1 (Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/605.1 (KHTML, like Gecko) Version/11.0 Safari/605.1 Debian/9.0 (3.22.7-1) Epiphany/3.22.7): css/ot_spinner.css
ocsigenserver: access: connection for localhost from ::1 (Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/605.1 (KHTML, like Gecko) Version/11.0 Safari/605.1 Debian/9.0 (3.22.7-1) Epiphany/3.22.7): favicon.ico
ocsigenserver: access: connection for localhost from ::1 (Mozilla/5.0 (X11; Linux x86_64; rv:62.0) Gecko/20100101 Firefox/62.0): css/ot_drawer.css

But the browser console clearly says there is a type error:

TypeError: s.charCodeAt is not a function [Learn More]
"Browser console

TypeError: s.charCodeAt is not a function [Learn More]

read32u
http://localhost:8080/web1_d2c033bb6bbef16107f446b97a1b4a4d.js:3280:21
caml_unwrap_value_from_string</<
http://localhost:8080/web1_d2c033bb6bbef16107f446b97a1b4a4d.js:3323:19
caml_call3
http://localhost:8080/web1_d2c033bb6bbef16107f446b97a1b4a4d.js:5129:28
unwrap
http://localhost:8080/web1_d2c033bb6bbef16107f446b97a1b4a4d.js:80542:15
unwrap_js
http://localhost:8080/web1_d2c033bb6bbef16107f446b97a1b4a4d.js:80551:1234:
dQs
http://localhost:8080/web1_d2c033bb6bbef16107f446b97a1b4a4d.js:86720:36
caml_call1
http://localhost:8080/web1_d2c033bb6bbef16107f446b97a1b4a4d.js:5125:28
case$1
http://localhost:8080/web1_d2c033bb6bbef16107f446b97a1b4a4d.js:53315:48
caml_call3
http://localhost:8080/web1_d2c033bb6bbef16107f446b97a1b4a4d.js:5129:28
get_request_data
http://localhost:8080/web1_d2c033bb6bbef16107f446b97a1b4a4d.js:86722:14
init$11
http://localhost:8080/web1_d2c033bb6bbef16107f446b97a1b4a4d.js:94652:19

TypeError: s.charCodeAt is not a function Learn More

What do you recommend to fix that?


Do you mean that it’s just hard to get up and running smoothly because of that fast moving js world, but once you correctly setup a server and a client they will work safely?
Or do you also mean that it can impact safety?

BTW, as my main concern is safety, (and assuming that js is somehow unsafe - as I’m not a js expert I can’t tell anything about js safety) can you recommend a hardened/safer setup to provide a reliable web GUI for deploying OCaml software?

I am considering to go for a desktop GUI for a few users in a controlled environment (machines can be freely configured) because safety is needed, as discussed in Reliable development of desktop GUI: which tools best suit? . And also because I’m not very confident (and experienced with advanced webdev).

What can you tell about obrowser?
It is available in Opam https://opam.ocaml.org/packages/obrowser/obrowser.1.1.1/ but appears as an ocsigen “unmaintained” project ocsigen other projects.
Do you think it can be reliably used instead of a desktop GUI to deploy OCaml code?


#4

It seems you have incompatible versions of Eliom and js_of_ocaml.
I don’t know how it is possible. What versions do you have?
Did you install everything using opam?

I was just speaking about installation problems. Android is moving fast and cordova libs do not always follow right away. It is sometimes difficult to find the right plugin version numbers.

At Be Sport, we are not using any external JS library for GUI. Ocsigen Toolkit fits our needs (+ some basic homemade widgets).

O’Browser was an experimental OCaml virtual machine written un JS, to run OCaml programs in a browser. Now that we have js_of_ocaml, you don’t need that anymore.


#5

Everything was installed with opam on a 4.06.1 fresh switch (with commands from the ocsigen start tutorial):
eliom 6.3.0 and js_of_ocaml 3.2.0

Details of versions
$ opam list | grep eliom 
eliom                         6.3.0       Client/server Web framework
ocsigen-i18n                  3.1.0       I18n made easy for web sites written with eliom.
$ opam list | grep js_of_ocaml
js_of_ocaml                   3.2.0       Compiler from OCaml bytecode to Javascript
js_of_ocaml-camlp4            3.1.0       Compiler from OCaml bytecode to Javascript
js_of_ocaml-compiler          3.2.1       Compiler from OCaml bytecode to Javascript
js_of_ocaml-lwt               3.2.1       Compiler from OCaml bytecode to Javascript
js_of_ocaml-ocamlbuild        3.1.0       Compiler from OCaml bytecode to Javascript
js_of_ocaml-ppx               3.2.0       Compiler from OCaml bytecode to Javascript
js_of_ocaml-ppx_deriving_json 3.2.0       Compiler from OCaml bytecode to Javascript
js_of_ocaml-tyxml             3.2.0       Compiler from OCaml bytecode to Javascript

I’ve just made a opam update && opam upgrade
js_of_ocaml is now 3.3.0

opam upgrade details
$ opam upgrade && opam update
...
│ ⊘ remove    ocsigen-start                 1.1.0
│ ↻ recompile conf-dbm                      1.0.0
│ ↻ recompile conf-m4                       1
│ ↻ recompile conf-openssl                  1
│ ↻ recompile dbm                           1.2
│ ↻ recompile eliom                         6.3.0
│ ↻ recompile jbuilder                      transition
│ ↻ recompile js_of_ocaml-tyxml             3.2.0
│ ↻ recompile lwt_ssl                       1.1.2
│ ↻ recompile ocsigen-toolkit               1.1.0
│ ↻ recompile ocsigenserver                 2.9
│ ↻ recompile ppx_sexp_conv                 v0.11.2
│ ↻ recompile ssl                           0.5.7
│ ↻ recompile tyxml                         4.2.0
│ ↻ recompile uutf                          1.0.1
│ ↗ upgrade   cmdliner                      1.0.2 to 1.0.3
│ ↗ upgrade   dune                          1.5.1 to 1.6.2
│ ↗ upgrade   ipaddr                        2.8.0 to 2.9.0
│ ↗ upgrade   js_of_ocaml                   3.2.0 to 3.3.0
│ ↗ upgrade   js_of_ocaml-compiler          3.2.1 to 3.3.0
│ ↗ upgrade   js_of_ocaml-lwt               3.2.1 to 3.3.0
│ ↗ upgrade   js_of_ocaml-ppx               3.2.0 to 3.3.0
│ ↗ upgrade   js_of_ocaml-ppx_deriving_json 3.2.0 to 3.3.0
│ ↗ upgrade   ocsigen-i18n                  3.1.0 to 3.2.0
│ ↗ upgrade   ppxlib                        0.3.1 to 0.4.0

Surprinsingly, opam removed ocsigen-start! So the os.pgocaml template was no longer available when using the following command
$ eliom-distillery -name web2 -template os.pgocaml

So I tried to install ocsigen-start again.
But I was asked again to install ocsigen-start dependencies which I did (although there is postgresql 11.1 installed, opam installed postgresql (11+197.pgdg90+1) ; may be postgresql 11.1 was not a supported version ?)

$ opam depext ocsigen-start
...
# All required OS packages found.

Then

$ opam install ocsigen-start

#=== ERROR while compiling ocsigen-start.1.1.0 ================================#
# context     2.0.0 | linux/x86_64 | ocaml-base-compiler.4.06.1 | https://opam.ocaml.org/#95592435
# path        ~/.opam/test.4.06.1/.opam-switch/build/ocsigen-start.1.1.0
# command     ~/.opam/opam-init/hooks/sandbox.sh build make
# exit-code   2
# env-file    ~/.opam/log/ocsigen-start-14353-05296d.env
# output-file ~/.opam/log/ocsigen-start-14353-05296d.out
### output ###
# Makefile:192: .depend: No such file or directory
# mkdir -p _deps
# mkdir -p _deps/src/
# mkdir -p _deps/src/
# eliomdep -server -package pgocaml -package pgocaml.syntax -package macaque.syntax -package calendar -package safepass -eliom-inc src/ src/os_db.ml > _deps/src/os_db.ml.server
# Fatal error: exception Fl_package_base.No_such_package("js_of_ocaml.syntax", "required by `eliom.syntax.predef'")
# Makefile:201: recipe for target '_deps/src/os_db.ml.server' failed
# make: *** [_deps/src/os_db.ml.server] Error 2

Have you an idea about where to look to fix that?
Maybe there is some opam trick to do (clean or whatever)
In parallel, I’m currently setting up a new ocsigen start on a new 4.07.0 fresh switch.

I just get the following:

$ opam install ocsigen-start
The following dependencies couldn't be met:
  - ocsigen-start → eliom >= 6.2.0 → ocsigenserver >= 2.9 → ocaml < 4.07
      base of this switch (use `--unlock-base' to force)
  - ocsigen-start → eliom >= 6.2.0 → js_of_ocaml < 3.0 → ocaml < 4.05.0
      base of this switch (use `--unlock-base' to force)

No solution found, exiting

Uh!?


#6

I believe this depends on a new release of ocsigenserver. The current master compiles when using OCaml 4.07. You can try to pin to the dev version to see if it works for you. opam pin add ocsigenserver --dev-repo


#7

Does a preliminary opam install js_of_ocaml-camlp4 fix this issue? I think the syntax library has moved there now (otherwise try to force downgrade to the js_of_ocaml 2.8.4 — I think — version.


#8
$ opam install js_of_ocaml-camlp4   # not really preliminary!
[NOTE] Package js_of_ocaml-camlp4 is already installed (current version is 3.1.0).

$ opam install js_of_ocaml.2.8.4
The following dependencies couldn't be met:
  - js_of_ocaml → ocaml < 4.05.0
      base of this switch (use `--unlock-base' to force)

No solution found, exiting

Assuming it’s js_of_ocaml.2.8.4:

$ opam install js_of_ocaml.2.8.4 --unlock-base

↘ downgrade ocaml                         4.06.1 to 4.04.2  [required by js_of_ocaml]
...
↘ downgrade js_of_ocaml                   3.3.0 to 2.8.4
...
↘ downgrade eliom                         6.3.0 to 6.2.0    [uses js_of_ocaml]
...
Done

But trying to install ocsigen-start triggers an upgrade back to js_of_ocaml.3.3.0 that I refused:

$ opam install ocsigen-start
The following actions will be performed:
  ↗ upgrade   lwt                           2.7.1 to 3.3.0 [required by ocsigenserver, js_of_ocaml-lwt]
          For the PPX, please install package lwt_ppx
          For the Camlp4 syntax, please install package lwt_camlp4
  ∗ install   js_of_ocaml-compiler          3.3.0          [required by js_of_ocaml]
  ↗ upgrade   lwt_ssl                       1.0.0 to 1.1.2 [required by ocsigenserver]
  ↗ upgrade   lwt_react                     1.0.0 to 1.1.1 [required by ocsigenserver]
  ↻ recompile lwt_log                       1.0.0          [uses lwt]
  ↗ upgrade   js_of_ocaml                   2.8.4 to 3.3.0 [required by eliom]
  ↗ upgrade   ocsigenserver                 2.8 to 2.9     [required by eliom]
  ∗ install   js_of_ocaml-ppx               3.3.0          [required by eliom]
  ↻ recompile js_of_ocaml-ppx_deriving_json 3.3.0          [uses js_of_ocaml]
  ∗ install   js_of_ocaml-tyxml             3.2.0          [required by eliom]
  ∗ install   js_of_ocaml-lwt               3.3.0          [required by eliom]
  ↗ upgrade   eliom                         6.2.0 to 6.3.0 [required by ocsigen-start]
  ↗ upgrade   ocsigen-toolkit               1.0.0 to 1.1.0 [required by ocsigen-start]
  ∗ install   ocsigen-start                 1.1.0
===== ∗ 5   ↻ 2   ↗ 7 =====
Do you want to continue? [Y/n]

At last, I just tried an older version of ocsigen-start that was successful:

$ opam install ocsigen-start.1.0.0
Done.

Then, as usual:
$ eliom-distillery -name web2 -template os.pgocaml
change Makefile.db to fix the path issue to Postgresql as explained above.

$ make db-init && make db-create && make db-schema && make test.byte

Now I have the web page available at http://localhost:8080 with enabled menu as expected 5 mn ago! :slight_smile:

Let’s wait for @Vincent_Balat’s answer regarding versions and a reliable installation instructions.

Thanks

opam switch details
base                          v0.11.1     Full standard library replacement for OCaml
base-bigarray                 base
base-bytes                    base        Bytes library distributed with the OCaml compiler
base-num                      base        Num library distributed with the OCaml compiler
base-threads                  base
base-unix                     base
base64                        2.3.0       Base64 encoding for OCaml
biniou                        1.2.0       Binary data format designed for speed, safety, ease of use and backward compatibility as protocols
calendar                      2.04        Library for handling dates and times in your program
camlp4                        4.04+1      Camlp4 is a system for writing extensible parsers for programming languages
cmdliner                      1.0.3       Declarative definition of command line interfaces for OCaml
conf-dbm                      1.0.0       Virtual package relying on gdbm
conf-gmp                      1           Virtual package relying on a GMP lib system installation
conf-gmp-powm-sec             1           Virtual package relying on a GMP lib with constant-time modular exponentiation
conf-libpcre                  1           Virtual package relying on a libpcre system installation
conf-m4                       1           Virtual package relying on m4
conf-openssl                  1           Virtual package relying on an OpenSSL system installation
conf-perl                     1           Virtual package relying on perl
conf-pkg-config               1.1         Virtual package relying on pkg-config installation
conf-which                    1           Virtual package relying on which
conf-zlib                     1           Virtual package relying on zlib
cppo                          1.6.5       Equivalent of the C preprocessor for OCaml programs
cppo_ocamlbuild               1.6.0       ocamlbuild support for cppo, OCaml-friendly source preprocessor
cryptokit                     1.13        A library of cryptographic primitives.
csv                           2.2         A pure OCaml library to read and write CSV files
dbm                           1.2         Binding to the NDBM/GDBM Unix "databases"
deriving                      0.8.1       Extension to OCaml for deriving functions from type declarations
dune                          1.6.2       Fast, portable and opinionated build system
easy-format                   1.3.1       High-level and functional interface to the Format module of the OCaml standard library
eliom                         6.2.0       Client/server Web framework
ipaddr                        2.9.0       A library for manipulation of IP (and MAC) address representations
jbuilder                      transition  This is a transition package, jbuilder is now named dune. Use the dune
js_of_ocaml                   2.8.4       Compiler from OCaml bytecode to Javascript
js_of_ocaml-camlp4            3.1.0       Compiler from OCaml bytecode to Javascript
js_of_ocaml-ocamlbuild        3.1.0       Compiler from OCaml bytecode to Javascript
js_of_ocaml-ppx_deriving_json 3.3.0       Compiler from OCaml bytecode to Javascript
lwt                           2.7.1       Monadic promises and concurrent I/O
lwt_log                       1.0.0       Lwt logging library (deprecated)
lwt_react                     1.0.0       Helpers for using React with Lwt
lwt_ssl                       1.0.0       Lwt-friendly OpenSSL bindings
macaque                       0.7.4       Macaque (Macros for Caml Queries) is a DSL for OCaml, which produces
menhir                        20181113    An LR(1) parser generator
num                           0           The Num library for arbitrary-precision integer and rational arithmetic
oasis                         0.4.11      Tooling for building OCaml libraries and applications
ocaml                         4.04.2      The OCaml compiler (virtual package)
ocaml-base-compiler           4.04.2      Official 4.04.2 release
ocaml-compiler-libs           v0.11.0     OCaml compiler libraries repackaged
ocaml-config                  1           OCaml Switch Configuration
ocaml-migrate-parsetree       1.1.0
ocamlbuild                    0.12.0      OCamlbuild is a build system with builtin rules to easily build most OCaml projects.
ocamlfind                     1.8.0       A library manager for OCaml
ocamlify                      0.0.1       Include files in OCaml code
ocamlmod                      0.0.9       Generate OCaml modules from source files
ocamlnet                      4.1.6       Internet protocols (HTTP, CGI, e-mail etc.) and helper data structures
ocsigen-i18n                  3.1.0       I18n made easy for web sites written with eliom.
ocsigen-start                 1.0.0       Skeleton for building client-server Eliom applications
ocsigen-toolkit               1.0.0       Reusable UI components for Eliom applications (client only, or client-server)
ocsigenserver                 2.8         A full-featured and extensible Web server
parsexp                       v0.11.0     S-expression parsing library
pcre                          7.3.5       Bindings to the Perl Compatibility Regular Expressions library
pgocaml                       2.3         Interface to PostgreSQL databases
ppx_derivers                  1.0         Shared [@@deriving] plugin registry
ppx_deriving                  4.2.1       Type-driven code generation for OCaml >=4.02
ppx_sexp_conv                 v0.11.2     Generation of S-expression conversion functions from type definitions
ppx_tools                     5.0         Tools for authors of ppx rewriters and other syntactic tools
ppx_tools_versioned           5.2.1       A variant of ppx_tools based on ocaml-migrate-parsetree
ppxlib                        0.4.0       Base library and tools for ppx rewriters
re                            1.7.3       RE is a regular expression library for OCaml
react                         1.2.1       Declarative events and signals for OCaml
reactiveData                  0.2.1       Functional reactive programming with incremental changes in data structures
result                        1.3         Compatibility Result module
safepass                      3.0         Facilities for the safe storage of user passwords
sexplib                       v0.11.0     Library for serializing OCaml values to and from S-expressions
sexplib0                      v0.11.0     Library containing the definition of S-expressions and some base converters
ssl                           0.5.7       Bindings for OpenSSL
stdio                         v0.11.0     Standard IO library for OCaml
topkg                         1.0.0       The transitory OCaml software packager
tyxml                         4.2.0       TyXML is a library for building statically correct HTML5 and SVG documents
uchar                         0.0.2       Compatibility library for OCaml's Uchar module
uutf                          1.0.1       Non-blocking streaming Unicode codec for OCaml
yojson                        1.4.1       Yojson is an optimized parsing and printing library for the JSON format
zarith                        1.7         Implements arithmetic and logical operations over arbitrary-precision integers

#9

We are currently upgrading all the packages on opam. The process should be completed tomorrow.
The switch started a few days ago, which can explain some problems, I guess.
I recommend to wait until Ocsigen Start is updated on Opam.


#10

Thank you for that information.
In the meantime, can you give us your last configuration of ocsigen-start packages known as valid? Where is this information available?

This way, one can fine tune his packet manager or do it manually in order to get this valid configuration.

Couldn’t you update the whole ocsigen-start set of packages in one time to avoid this (possible) inconsistency? It should take a very short time to upload a set of packages.

I’m not aware of an existing opam feature that could let you set a state flag to say that a set of packages is valid or currently being upgraded.
Does it exist?


#11

Hello there,

Unfortunately there haven’t been any releases on the ocsigen packages for much too long. This is why I have created releases for ocsigenserver, eliom, ocsigen-toolkit, and ocsigen-start, which are currently pending. Once the releases are out you will once more be able to install everything required by a simple opam install ocsigen-start.

For the impatient what you can do in the meantime is pinning the packages to the appropriate tags on github:
opam pin add -n -y eliom XXX/eliom.git#6.5.0
opam pin add -n -y ocsigen-toolkit XXX/ocsigen-toolkit.git#2.0.0
opam pin add -n -y ocsigen-start XXX/ocsigen-start.git#1.2.0
Replace “XXX” by "git@github.com:ocsigen". (I know that this is stupid, but I’m not allowed to post more than 2 links in one post.) Then run opam install ocsigen-start.


#12

Thanks.
And where is available the configuration of ocsigen-start packages known as valid by the authors?

Concerning the “maximum two links rule” I propose to publish the commands as code as shown below.
Do you agree?

$ opam pin add -n -y eliom git@github.com:ocsigen/eliom.git#6.5.0
$ opam pin add -n -y ocsigen-toolkit git@github.com:ocsigen/ocsigen-toolkit.git#2.0.0
$ opam pin add -n -y ocsigen-start git@github.com:ocsigen/ocsigen-start.git#1.2.0

#13

TEST of the “maximum two links” rule evoked by @Jean_Dutier:
discuss.ocaml.org
ocaml.org
x.org
OK for three links.

EDIT three additional links:
a.org
b.org
c.org
OK for six links.

Who or what prevents you from posting more than two links in one post?


#14

I do. Now that I am not considered a “new user” anymore by the system, I can actually post more than two links:

$ opam pin add -n -y eliom git@github.com:ocsigen/eliom.git#6.5.0
$ opam pin add -n -y ocsigen-toolkit git@github.com:ocsigen/ocsigen-toolkit.git#2.0.0
$ opam pin add -n -y ocsigen-start git@github.com:ocsigen/ocsigen-start.git#1.2.0

#15

I don’t understand the question. What do you mean by configuration? Do you mean a set of package versions that work together? That should be expressed by the version bounds in the opam files. At least as long as the package maintainers attend to their duty…


#16

Yes. I’m even talking about the exact set of packages that has been successfully tested.

Are all the possible combinations given in the opam file tested by the authors before pushing the package(s) on opam? (I mean the dependencies of a package and also the compatibilies between several packages regarding their respective dependencies).

For example, the eliom.6.3.0 package gives a valid range for several dependencies (ocaml>=4.03.0 …) but who knows that all combinations of dependencies work together?

With opam I installed eliom 6.3.0 that installed js_of_ocaml-ppx 3.2.0 while the opam file says js_of_ocaml-ppx<= 3.0.2
Is this an opam problem of an eliom/ocsigen problem?
How can this be avoided?


#17

Certainly not. If at all this is only feasible using automatised tests. Some automatic testing happens as part of the publishing process of a package (see for instance https://github.com/ocaml/opam-repository/pull/13173 at the bottom).

This is a general problem that exists (to my knowledge) in all package management systems.

No-one does. This is a non-trivial problem for all package management systems (for Linux distributions as well as for other programming languages) that I know. The best solution that I am aware of and which I try to follow is the Haskell Package Versioning Policy (https://pvp.haskell.org/). The key approach is raising the major version number with each release that introduces a breaking change. If everyone sticks to this you can always safely update dependencies w.r.t. minor version numbers and it gives you a good idea on what value to use for upper version bounds.

If you are interested in the problem of package versioning I recommend you to follow the relevant guidelines and discussions. I would post a few links, but as a “new user” I am not allowed to do that. For Haskell there is a tool called cabal-bounds that can be used to automatically raise dependency version bounds. It would be cool to have something similar for OCaml.


#18

Trying to start os.pgocaml, I encountered the following issues:

  • postgres was not built on my debian system. The transclusion of postgres version in the path does not work: the actual path to pg_ctl is /usr/lib/postgresql/11/bin/pg_ctl whereas it was built as /usr/lib/postgresql/11.1/bin/pg_ctl. After changing it in Makefile the setup of db is sucessful.
  • The build of web2.eliom failed with unbound module Lwt_log. Commenting every log declaration makes it pass.

#20

Eventually, the following opam pin add commands worked for me:

$ opam pin add eliom https://github.com/ocsigen/eliom.git
  installed eliom.6.5.0

$ opam pin add ocsigen-toolkit https://github.com/ocsigen/ocsigen-toolkit.git
  installed ocsigen-toolkit.2.0.0

$ opam pin add ocsigen-start https://github.com/ocsigen/ocsigen-start.git#master
  installed resource-pooling.0.5.2
  installed ocsigen-start.1.2.0

I didn’t find https://github.com/ocsigen/ocsigen-start/tree/1.1 , so I used https://github.com/ocsigen/ocsigen-start/tree/master , as the opam file indicates version: "1.2.0"

I could do the following:

$ eliom-distillery -name web1 -template os.pgocaml
$ make db-init && make db-create && make db-schema

But I could not get the application launched (see the let%server _ function in the in web1.eliom file):

$ make test.byte
js_of_eliom -w +A-4-7-9-37-38-39-41-42-44-45-48 -jsopt +base/runtime.js -ppx -ppx "ocsigen-i18n-rewriter Web1_i18n" -c -package lwt_ppx -package js_of_ocaml-ppx -package js_of_ocaml-ppx.deriving -package ppx_deriving.std -package ocsigen-start.client -package base -g web1.eliom
File "web1.eliom", line 81, characters 38-51:
Error: Unbound module Lwt_log
Makefile.os:284: recipe for target '_client/web1.cmo' failed
make: *** [_client/web1.cmo] Error 2

EDIT :
In the generated file web1.eliom (for app web1), I commented out the let%server _ function that seems related to debug, and I could have the make test.byte command working and a site accessible at localhost:8080 .
However, the menu is not enabled (exactly as the situation I described when I opened this topic).

Eventually, after some F5/refresh browser, or some magic, the menu has been enabled :slight_smile:

EDIT2
In fact, ESC stopped the tab process (locally or with the server) but it also froze the menu.
And I got no error message in browser console.
So I don’t know yet what really happened.

The problem with machine was when using a vpn to connect to (:8080).
There was no problem when doing the same make test byte directly on the machine (CLI and browser to get to localhost:8080).

Again it was not five minutes to get up and running but many hours instead.
However, it seems to work enough correctly with the last ocsigen-start.1.2.0 package and I can begin to learn how to customize this setup!
Thanks.


About the opam pin add commands
Previously, I tried to do the opam pin add commands you gave but it failed:

$ #opam 2.0.2
$ opam pin add -n -y eliom git@github.com:ocsigen/eliom.git#6.5.0
Processing: [eliom.6.3.0: git]  # ???
[ERROR] Could not synchronize /home/test/.opam/4.06.1_ocsigen/.opam-switch/sources/eliom from
        "git+ssh://git@github.com/ocsigen/eliom.git#6.5.0":
        "/usr/bin/git fetch -q" exited with code 128
[ERROR] Error getting source from git+ssh://git@github.com/ocsigen/eliom.git#6.5.0:
          - git+ssh://git@github.com/ocsigen/eliom.git#6.5.0

as well as for the other packages:

$ opam pin add -n -y ocsigen-toolkit git@github.com:ocsigen/ocsigen-toolkit.git#2.0.0
$ opam pin add -n -y ocsigen-start git@github.com:ocsigen/ocsigen-start.git#1.2.0

@Jean_Dutier
Where does the syntax of your commands come from?
What is the -n for? (the -y seems enough for installing packages)
Can you describe your setup that make them working?


About the current ocsigen-start package in the opam repository
Here are two tests I’ve done in parallel with the current package in the opam repository, which is the situation of any person trying to use ocsigen-start without all the information of this topic.
Setup: Linux Debian 8/Jessie with a fresh opam 2.0.2 setup on a 4.06.1 and a 4.07.1 switches.
Result : they both failed for different reasons (eliom or js_of_ocaml_compiler).

@Vincent_Balat and @Jean_Dutier: do you agree that it seems more than necessary to be able to put a flag on the ocsigen-start package in the opam repository and on the ocsigen-start website to indicate that opam won’t install correctly the ocsigen-start package and that the above commands should be used instead until the repository is updated?

@AltGr: do you know how to tweak opam 2.0.2 for doing that? Can the opam team consider to add this flag feature?

Details: Tests for installation of ocsigen-start with current ocsigen-start package in the opam repository
    $ #Ocaml 4.07.1
    $ opam switch create 4.07.1
    $ opam depext ocsigen-start
    $ opam install ocsigen-start
    #=== ERROR while compiling eliom.6.3.0 ========================================#
    # context     2.0.2 | linux/x86_64 | ocaml-base-compiler.4.07.1 | https://opam.ocaml.org#91c7f189
    # path        ~/.opam/default/.opam-switch/build/eliom.6.3.0
    # command     ~/.opam/opam-init/hooks/sandbox.sh build make
    # exit-code   2
    # env-file    ~/.opam/log/eliom-27721-6cc03f.env
    # output-file ~/.opam/log/eliom-27721-6cc03f.out

    # ocamlfind: Package `lwt.ppx' not found
    # Command exited with code 2.
    # Makefile:7: recipe for target 'all' failed
    # make: *** [all] Error 10

    $ #Ocaml 4.06.1
    $ opam switch create 4.06.1
    $ opam install ocsigen-start
    #=== ERROR while installing js_of_ocaml-compiler.3.3.0 ========================#
    # path        ~/.opam/4.06.1_ocsigen/.opam-switch/build/js_of_ocaml-compiler.3.3.0
    # command     /usr/bin/install -m 0644 /home/test/.opam/4.06.1_ocsigen/.opam-switch/build/js_of_ocaml-compiler.3.3.0/_build/install/default/lib/js_of_ocaml-compiler/js_of_ocaml_compiler.cma /home/test/.opam/4.06.1_ocsigen/lib/js_of_ocaml-compiler/js_of_ocaml_compiler.cma
    # exit-code   1
    # env-file    ~/.opam/log/log-28544-0280a2.env
    # output-file ~/.opam/log/log-28544-0280a2.out

#21

I have fixed this issue, which will be included in ocsigen-start.1.3.0 (https://github.com/ocaml/opam-repository/pull/13202).