From 635287d394608d05ace2ae6037e358cd1ca43ad9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antonin=20D=C3=A9cimo?= Date: Tue, 12 Dec 2023 15:07:39 +0100 Subject: [PATCH 1/7] Update to latest Dream --- mirageio.opam | 8 ++++---- mirageio.opam.template | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/mirageio.opam b/mirageio.opam index f526226d..5eae1db3 100644 --- a/mirageio.opam +++ b/mirageio.opam @@ -55,9 +55,9 @@ build: [ ] dev-repo: "git+https://github.com/mirage/mirage-www.git" pin-depends: [ - ["dream-pure.dev" "git+https://github.com/tmcgilchrist/dream.git#fcc20d00bf61a1c417aa38e18b62aa3d0962704e"] - ["dream.dev" "git+https://github.com/tmcgilchrist/dream.git#fcc20d00bf61a1c417aa38e18b62aa3d0962704e"] - ["dream-mirage.dev" "git+https://github.com/tmcgilchrist/dream.git#fcc20d00bf61a1c417aa38e18b62aa3d0962704e"] - ["dream-httpaf.dev" "git+https://github.com/tmcgilchrist/dream.git#fcc20d00bf61a1c417aa38e18b62aa3d0962704e"] + ["dream-pure.dev" "git+https://github.com/aantron/dream.git#337a35fb1238b86f10f57d7aacb20003bc0486ba"] + ["dream.dev" "git+https://github.com/aantron/dream.git#337a35fb1238b86f10f57d7aacb20003bc0486ba"] + ["dream-mirage.dev" "git+https://github.com/aantron/dream.git#337a35fb1238b86f10f57d7aacb20003bc0486ba"] + ["dream-httpaf.dev" "git+https://github.com/aantron/dream.git#337a35fb1238b86f10f57d7aacb20003bc0486ba"] ["tailwindcss.dev" "https://github.com/tmattio/opam-tailwindcss/archive/3e60fc32bbcf82525999d83ad0f395e16107026b.tar.gz"] ] diff --git a/mirageio.opam.template b/mirageio.opam.template index 85c5699d..bec5e7a2 100644 --- a/mirageio.opam.template +++ b/mirageio.opam.template @@ -1,7 +1,7 @@ pin-depends: [ - ["dream-pure.dev" "git+https://github.com/tmcgilchrist/dream.git#fcc20d00bf61a1c417aa38e18b62aa3d0962704e"] - ["dream.dev" "git+https://github.com/tmcgilchrist/dream.git#fcc20d00bf61a1c417aa38e18b62aa3d0962704e"] - ["dream-mirage.dev" "git+https://github.com/tmcgilchrist/dream.git#fcc20d00bf61a1c417aa38e18b62aa3d0962704e"] - ["dream-httpaf.dev" "git+https://github.com/tmcgilchrist/dream.git#fcc20d00bf61a1c417aa38e18b62aa3d0962704e"] + ["dream-pure.dev" "git+https://github.com/aantron/dream.git#337a35fb1238b86f10f57d7aacb20003bc0486ba"] + ["dream.dev" "git+https://github.com/aantron/dream.git#337a35fb1238b86f10f57d7aacb20003bc0486ba"] + ["dream-mirage.dev" "git+https://github.com/aantron/dream.git#337a35fb1238b86f10f57d7aacb20003bc0486ba"] + ["dream-httpaf.dev" "git+https://github.com/aantron/dream.git#337a35fb1238b86f10f57d7aacb20003bc0486ba"] ["tailwindcss.dev" "https://github.com/tmattio/opam-tailwindcss/archive/3e60fc32bbcf82525999d83ad0f395e16107026b.tar.gz"] ] From 1fb7b9b3932017c83a60fb95c68a515bf456dc8b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antonin=20D=C3=A9cimo?= Date: Tue, 12 Dec 2023 15:07:54 +0100 Subject: [PATCH 2/7] Link with Dream in templates --- template/dune | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/template/dune b/template/dune index 8631de4a..05957f3d 100644 --- a/template/dune +++ b/template/dune @@ -1,6 +1,6 @@ (library (name mirageio_template) - (libraries dream-mirage mirageio_data)) + (libraries dream dream-mirage mirageio_data)) (rule (targets atom.ml) From bc4e92d0ecf0b525040dfda4b0b5e365892f4991 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antonin=20D=C3=A9cimo?= Date: Tue, 12 Dec 2023 15:11:50 +0100 Subject: [PATCH 3/7] Bump omd lower-bound --- dune-project | 2 +- mirageio.opam | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/dune-project b/dune-project index cf3e5d1a..24c0e54c 100644 --- a/dune-project +++ b/dune-project @@ -44,7 +44,7 @@ (ptime (>= 0.8.1)) (tailwindcss :build) (crunch (and :build (>= 3.1.0))) - (omd (and :build (< 2.0.0~alpha3))) + (omd (>= 2.0.0~alpha4)) (yaml :build) (fmt :build) (ppx_deriving_yaml (and :build (>= 0.2.1))))) diff --git a/mirageio.opam b/mirageio.opam index 5eae1db3..6742d614 100644 --- a/mirageio.opam +++ b/mirageio.opam @@ -33,7 +33,7 @@ depends: [ "ptime" {>= "0.8.1"} "tailwindcss" {build} "crunch" {build & >= "3.1.0"} - "omd" {build & < "2.0.0~alpha3"} + "omd" {>= "2.0.0~alpha4"} "yaml" {build} "fmt" {build} "ppx_deriving_yaml" {build & >= "0.2.1"} From dab6333d69cb8951b44b14724416990a246466b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antonin=20D=C3=A9cimo?= Date: Tue, 12 Dec 2023 15:46:26 +0100 Subject: [PATCH 4/7] Update opam-repository and mirage-dev in deploy --- Dockerfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 79ddc6ac..1721389b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,9 +2,9 @@ FROM ocaml/opam:debian-12-ocaml-4.14 RUN sudo apt-get update && sudo apt-get install autoconf automake -y --no-install-recommends RUN mkdir -p /home/opam/www/mirage WORKDIR /home/opam/www -RUN sudo ln -f /usr/bin/opam-2.1 /usr/bin/opam && cd ~/opam-repository && git pull origin master && git reset --hard 297ab9ebb38254eee222f5bb4365ae80baa9caa1 && opam update +RUN sudo ln -f /usr/bin/opam-2.1 /usr/bin/opam && cd ~/opam-repository && git pull origin master && git reset --hard 30b1b97d735732e40996cf2e6b06d478ac40633f && opam update RUN opam pin tailwindcss.dev https://github.com/tmattio/opam-tailwindcss/archive/3e60fc32bbcf82525999d83ad0f395e16107026b.tar.gz -RUN opam repo add mirage-dev git+https://github.com/mirage/mirage-dev.git#842c55556ffd0950d21141d6ab99e52a8d88a50f +RUN opam repo add mirage-dev git+https://github.com/mirage/mirage-dev.git#749c02302f8f15e609332edbe827541558554a80 RUN opam install mirage COPY --chown=opam:root mirage/config.ml /home/opam/www/mirage/ COPY --chown=opam:root mirageio.opam /home/opam/www/ From fa758f6bdbce62fdb4d5fd098085ca537ac1864c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antonin=20D=C3=A9cimo?= Date: Tue, 12 Dec 2023 16:34:40 +0100 Subject: [PATCH 5/7] Update to mirage.4.4.1 --- Makefile | 58 +++++++++++++++++++++++++++++++++++++++++++++++- dune-project | 1 + mirage/config.ml | 10 ++++++++- mirageio.opam | 1 + 4 files changed, 68 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 1c82456f..ad043cfc 100644 --- a/Makefile +++ b/Makefile @@ -1,3 +1,59 @@ -# Generated by mirage +# Generated by mirage.v4.4.1 -include Makefile.user +BUILD_DIR = mirage/ +MIRAGE_DIR = mirage/mirage +UNIKERNEL_NAME = www-unix +OPAM = opam + +all:: + @$(MAKE) --no-print-directory depends + @$(MAKE) --no-print-directory build + +.PHONY: all lock install-switch pull clean depend depends build repo-add repo-rm depext-lockfile + +repo-add: + @printf "\033[2musing overlay repository mirage: [opam-overlays, mirage-overlays] \033[0m\n" + $(OPAM) repo add opam-overlays https://github.com/dune-universe/opam-overlays.git || $(OPAM) repo set-url opam-overlays https://github.com/dune-universe/opam-overlays.git + $(OPAM) repo add mirage-overlays https://github.com/dune-universe/mirage-opam-overlays.git || $(OPAM) repo set-url mirage-overlays https://github.com/dune-universe/mirage-opam-overlays.git + + +repo-rm: + @printf "\033[2mremoving overlay repository [opam-overlays, mirage-overlays]\033[0m\n" + $(OPAM) repo remove opam-overlays https://github.com/dune-universe/opam-overlays.git + $(OPAM) repo remove mirage-overlays https://github.com/dune-universe/mirage-opam-overlays.git + + + +depext-lockfile: $(MIRAGE_DIR)/$(UNIKERNEL_NAME).opam.locked + echo " ↳ install external dependencies for monorepo" + env OPAMVAR_monorepo="opam-monorepo" $(OPAM) monorepo depext -y -l $< + + +$(MIRAGE_DIR)/$(UNIKERNEL_NAME).opam.locked: $(MIRAGE_DIR)/$(UNIKERNEL_NAME).opam + @$(MAKE) -s repo-add + @echo " ↳ generate lockfile for monorepo dependencies" + @env OPAMVAR_monorepo="opam-monorepo" $(OPAM) monorepo lock --require-cross-compile --build-only $(UNIKERNEL_NAME) -l $@ --ocaml-version $(shell ocamlc --version); (ret=$$?; $(MAKE) -s repo-rm && exit $$ret) + +lock:: + @$(MAKE) -B $(MIRAGE_DIR)/$(UNIKERNEL_NAME).opam.locked + +pull:: $(MIRAGE_DIR)/$(UNIKERNEL_NAME).opam.locked + @echo " ↳ fetch monorepo dependencies in the duniverse folder" + @env OPAMVAR_monorepo="opam-monorepo" $(OPAM) monorepo pull -l $< -r $(abspath $(BUILD_DIR)) + +install-switch:: $(MIRAGE_DIR)/$(UNIKERNEL_NAME).opam + @echo " ↳ opam install switch dependencies" + @$(OPAM) install $< --deps-only --yes + @$(MAKE) -s depext-lockfile + +depends depend:: + @$(MAKE) --no-print-directory lock + @$(MAKE) --no-print-directory install-switch + @$(MAKE) --no-print-directory pull + +build:: + mirage build -f mirage/config.ml + +clean:: + mirage clean diff --git a/dune-project b/dune-project index 24c0e54c..fc458553 100644 --- a/dune-project +++ b/dune-project @@ -37,6 +37,7 @@ dream dream-mirage (tcpip (>= 8.0)) + (mirage (>= 4.4.1)) (mirage-time (>= 3.0)) (mirage-kv-mem (>= 3.2.1)) (mirage-clock-unix (>= 3.0)) diff --git a/mirage/config.ml b/mirage/config.ml index 49e376fb..f4b48f49 100644 --- a/mirage/config.ml +++ b/mirage/config.ml @@ -202,10 +202,18 @@ let enable_metrics = let doc = Key.Arg.info ~doc:"Enable metrics reporting" [ "metrics" ] in Key.(create "metrics" Arg.(flag doc)) +type i0 = I0 +let i0 = Functoria.Type.v I0 +let no0 = Functoria.impl "Int" job + +type n1 = N1 +let n1 = Functoria.Type.v N1 +let noop1 = Functoria.impl "Set.Make" (job @-> job) + let optional_monitoring time pclock stack = if_impl (Key.value enable_metrics) (mirage_monitoring $ time $ pclock $ stack) - noop + (noop1 $ no0) let () = register "www" diff --git a/mirageio.opam b/mirageio.opam index 6742d614..5867ce76 100644 --- a/mirageio.opam +++ b/mirageio.opam @@ -26,6 +26,7 @@ depends: [ "dream" "dream-mirage" "tcpip" {>= "8.0"} + "mirage" {>= "4.4.1"} "mirage-time" {>= "3.0"} "mirage-kv-mem" {>= "3.2.1"} "mirage-clock-unix" {>= "3.0"} From 85a8348d0729af0ba16de45cae1c7d60c3a875c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antonin=20D=C3=A9cimo?= Date: Tue, 12 Dec 2023 17:23:38 +0100 Subject: [PATCH 6/7] Remove mirage opam-repository overlay in deploy --- Dockerfile | 1 - 1 file changed, 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 1721389b..9d39fdc1 100644 --- a/Dockerfile +++ b/Dockerfile @@ -4,7 +4,6 @@ RUN mkdir -p /home/opam/www/mirage WORKDIR /home/opam/www RUN sudo ln -f /usr/bin/opam-2.1 /usr/bin/opam && cd ~/opam-repository && git pull origin master && git reset --hard 30b1b97d735732e40996cf2e6b06d478ac40633f && opam update RUN opam pin tailwindcss.dev https://github.com/tmattio/opam-tailwindcss/archive/3e60fc32bbcf82525999d83ad0f395e16107026b.tar.gz -RUN opam repo add mirage-dev git+https://github.com/mirage/mirage-dev.git#749c02302f8f15e609332edbe827541558554a80 RUN opam install mirage COPY --chown=opam:root mirage/config.ml /home/opam/www/mirage/ COPY --chown=opam:root mirageio.opam /home/opam/www/ From 0488633dee1e69afbde359cd046734f4c46bc4bb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antonin=20D=C3=A9cimo?= Date: Tue, 12 Dec 2023 17:34:35 +0100 Subject: [PATCH 7/7] Try installing opam dependencies for pin-depends in deploy --- Dockerfile | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 9d39fdc1..a234608d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -3,10 +3,9 @@ RUN sudo apt-get update && sudo apt-get install autoconf automake -y --no-instal RUN mkdir -p /home/opam/www/mirage WORKDIR /home/opam/www RUN sudo ln -f /usr/bin/opam-2.1 /usr/bin/opam && cd ~/opam-repository && git pull origin master && git reset --hard 30b1b97d735732e40996cf2e6b06d478ac40633f && opam update -RUN opam pin tailwindcss.dev https://github.com/tmattio/opam-tailwindcss/archive/3e60fc32bbcf82525999d83ad0f395e16107026b.tar.gz -RUN opam install mirage COPY --chown=opam:root mirage/config.ml /home/opam/www/mirage/ COPY --chown=opam:root mirageio.opam /home/opam/www/ +RUN opam install -y --deps-only . ARG TARGET=unix ARG EXTRA_FLAGS= RUN opam exec -- mirage configure -f mirage/config.ml -t $TARGET $EXTRA_FLAGS