From 998b5ba6a2b101af174142a1ce4e48bd7cc73e48 Mon Sep 17 00:00:00 2001 From: Thomas Leonard Date: Wed, 8 Jan 2020 11:17:19 +0000 Subject: [PATCH] Upgrade to OCaml 4.07 and Mirage 3.7.3 --- .gitignore | 11 ----------- Dockerfile | 11 +++++------ README.md | 18 ++++++++++-------- lib/utils/git_storage.ml | 2 +- server/.gitignore | 21 +++++++++++++++++++++ server/unikernel.ml | 6 +++--- 6 files changed, 40 insertions(+), 29 deletions(-) create mode 100644 server/.gitignore diff --git a/.gitignore b/.gitignore index 75bd6d4..16d1286 100644 --- a/.gitignore +++ b/.gitignore @@ -1,15 +1,4 @@ _build .merlin -server/Makefile -server/cuekeeper_libvirt.xml -server/main.ml -server/main.native -server/cuekeeper.xl.in -server/mir-cuekeeper -server/static.ml -server/static1.ml* -server/log -server/conf -server/devices.ml cuekeeper-bin-* cuekeeper-bin-*.zip diff --git a/Dockerfile b/Dockerfile index 049fb6e..de27688 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,13 +1,12 @@ -FROM ocaml/opam2:debian-10-opam@sha256:79636246d69ee9d285c87af8a078d2dcc1c893d75e40c581da3284da6cf1841c -#FROM ocaml/opam2:debian-10-opam -ENV DEBIAN_FRONTEND=noninteractive -RUN sudo apt-get -y update && sudo apt-get -y install aspcud zip m4 autoconf build-essential gcc-multilib ca-certificates git rsync time --no-install-recommends -RUN opam init --comp=4.05.0+32bit --disable-sandboxing +FROM ocurrent/opam:debian-10-ocaml-4.07@sha256:2f9a9fc195b29f1006d0f97ae4c6300fb175800703b12a15b51583a1f7a547b7 +#FROM ocurrent/opam:debian-10-ocaml-4.07 RUN opam pin add -yn reactiveData https://github.com/hhugo/reactiveData.git RUN opam pin add -yn irmin-git.1.4.0 https://github.com/talex5/irmin.git#1.4.0-cuekeeper RUN opam pin add -yn irmin-indexeddb.1.3 https://github.com/talex5/irmin-indexeddb.git#irmin-1.3 RUN mkdir /home/opam/cuekeeper COPY --chown=opam cuekeeper.opam /home/opam/cuekeeper/ WORKDIR /home/opam/cuekeeper -RUN opam install --solver=aspcud -y -t --deps-only . +RUN opam pin add -yn cuekeeper.dev . +RUN opam depext -t cuekeeper +RUN opam install -t --deps-only cuekeeper ENTRYPOINT ["opam", "config", "exec", "--"] diff --git a/README.md b/README.md index 457b7cd..b826a85 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ CueKeeper ========= -Copyright Thomas Leonard, 2019 +Copyright Thomas Leonard, 2020 CueKeeper is a web-based [GTD][] system (a fancy TODO list) that runs entirely in your browser (the data is stored on your computer, in your browser). @@ -46,10 +46,10 @@ Building (without Docker) ------------------------- You'll need the [opam](http://opam.ocaml.org/) package manager. -It should be available through your distribution, but you can use a [generic opam binary](http://tools.ocaml.org/opam.xml) if it's missing or too old (I use opam 1.2.2). -Ensure you're using OCaml 4.05.0 (check with `ocaml -version`). If not, switch to that version: +It should be available through your distribution, but you can use a [generic opam binary](http://tools.ocaml.org/opam.xml) if it's missing or too old (I use opam 2.0.4). +Ensure you're using OCaml 4.07.1 (check with `ocaml -version`). If not, switch to that version: - opam switch create 4.05.0 + opam switch create 4.07.1 Pin a few patches we require: @@ -59,7 +59,9 @@ Pin a few patches we require: Install the dependencies (`-t` includes the test dependencies too): - opam install --deps-only -t . + opam pin add -yn cuekeeper.dev . + opam depext -t cuekeeper + opam install --deps-only -t cuekeeper Build: @@ -68,7 +70,7 @@ Build: Load `test.html` in a browser to test locally (no server required). Note that this defaults to "dev" mode, where the Javascript generated will be very large (about 9 MB) and not optimised. -To get a smaller file, use `dune build --profile=release ./js/client.bc.js` (should be about 950 KB). +To get a smaller file, use `dune build --profile=release ./js/client.bc.js` (should be about 980 KB). Running a server @@ -107,7 +109,7 @@ Make sure the `None` line comes last - this rejects all unknown tokens. To build the server component: - opam pin add mirage 3.5.2 + opam pin mirage 3.7.3 make server You will be prompted to create a self-signed X.509 certificate. Just enter your server's hostname @@ -148,7 +150,7 @@ Deploying as a Xen VM In fact, the server is a [Mirage unikernel][mirage] and can also be compiled and booted as a Xen virtual machine: - make server MIRAGE_FLAGS="--xen" + make server MIRAGE_FLAGS="-t xen" cd server xl create -c cuekeeper.xl diff --git a/lib/utils/git_storage.ml b/lib/utils/git_storage.ml index 930adc5..da9c83f 100644 --- a/lib/utils/git_storage.ml +++ b/lib/utils/git_storage.ml @@ -8,7 +8,7 @@ module IO = struct type out_channel = Buffer.t let really_input _ch _buf _pos _len = failwith "unused" let input = really_input - let output = Buffer.add_substring + let output = Buffer.add_subbytes let close_out _ = () end diff --git a/server/.gitignore b/server/.gitignore new file mode 100644 index 0000000..bc556dc --- /dev/null +++ b/server/.gitignore @@ -0,0 +1,21 @@ +conf +config +cuekeeper +cuekeeper_libvirt.xml +cuekeeper.xl.in +devices.ml +dune +dune.build +dune.config +dune-project +*.install +key_gen.ml +main.ml +main.native +Makefile +.mirage.config +mir-cuekeeper +myocamlbuild.ml +*.opam +static1.ml* +static.ml diff --git a/server/unikernel.ml b/server/unikernel.ml index 03c457d..269df87 100644 --- a/server/unikernel.ml +++ b/server/unikernel.ml @@ -23,9 +23,9 @@ module Store = Irmin_git.Mem.Make(IO)(Git.Inflate.None) (Irmin.Contents.String)(Irmin.Path.String_list)(Irmin.Branch.String) module Main - (Stack:Mirage_stack_lwt.V4) - (Conf:Mirage_kv_lwt.RO) - (Clock:Mirage_clock_lwt.PCLOCK) = struct + (Stack:Mirage_stack.V4) + (Conf:Mirage_kv.RO) + (Clock:Mirage_clock.PCLOCK) = struct module TCP = Stack.TCPV4 module TLS = Tls_mirage.Make (TCP) module X509 = Tls_mirage.X509 (Conf) (Clock)