diff --git a/CHANGES.md b/CHANGES.md index bdeed9c7..ecaf09d8 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,5 +1,7 @@ ### unreleased +- Expose the ocluster-worker library in the ocluster-worker package + (@MisterDA @art-w, #219 #217 #151, reviewed by @tmcgilchrist) - Remove corrupted repositories from the cache (@kit-ty-kate #216, reviewed by @talex5) - Allow workers to report additional prometheus metrics (@patricoferris #210, reviewed by @tmcgilchrist, @MisterDA) - Smother Cap'n Proto and TLS debug logs (@MisterDA #213, reviewed by @talex5) diff --git a/Dockerfile b/Dockerfile index 29d44cf2..aa78df5d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,9 +2,10 @@ FROM ocaml/opam:debian-11-ocaml-4.14@sha256:a3b5db3e755e4866ad2c6691d730b1aa2c79 RUN sudo apt-get update && sudo apt-get install libev-dev capnproto libcapnp-dev m4 pkg-config libsqlite3-dev libgmp-dev -y --no-install-recommends RUN sudo ln -f /usr/bin/opam-2.1 /usr/bin/opam && opam init --reinit -ni RUN cd ~/opam-repository && git fetch -q origin master && git reset --hard 59abe7be7457eed1c245c61034a50a1551f235ed && opam update -COPY --chown=opam ocluster-api.opam ocluster.opam /src/ +COPY --chown=opam ocluster-api.opam ocluster-worker.opam ocluster.opam /src/ COPY --chown=opam obuilder/obuilder.opam obuilder/obuilder-spec.opam /src/obuilder/ RUN opam pin -yn /src/obuilder/ +RUN opam pin -yn ocluster-worker.$(opam show ocluster -f version) /src/ # until ocluster-worker is released WORKDIR /src RUN opam install -y --deps-only . ADD --chown=opam . . diff --git a/Dockerfile.worker b/Dockerfile.worker index 0c353a66..92337774 100644 --- a/Dockerfile.worker +++ b/Dockerfile.worker @@ -2,9 +2,10 @@ FROM ocaml/opam:ubuntu-22.04-ocaml-4.14@sha256:cdc3ec85f42f2daaea17db5024405a9f8 RUN sudo apt-get update && sudo apt-get install libev-dev capnproto libcapnp-dev m4 pkg-config libsqlite3-dev libgmp-dev -y --no-install-recommends RUN sudo ln -f /usr/bin/opam-2.1 /usr/bin/opam && opam init --reinit -ni RUN cd ~/opam-repository && git fetch -q origin master && git reset --hard 59abe7be7457eed1c245c61034a50a1551f235ed && opam update -COPY --chown=opam ocluster-api.opam ocluster.opam /src/ +COPY --chown=opam ocluster-api.opam ocluster-worker.opam ocluster.opam /src/ COPY --chown=opam obuilder/obuilder.opam obuilder/obuilder-spec.opam /src/obuilder/ RUN opam pin -yn /src/obuilder/ +RUN opam pin -yn ocluster-worker.$(opam show ocluster -f version) /src/ # until ocluster-worker is released WORKDIR /src RUN opam install -y --deps-only . ADD --chown=opam . . diff --git a/bin/dune b/bin/dune index bc16a27e..33402073 100644 --- a/bin/dune +++ b/bin/dune @@ -2,7 +2,7 @@ (public_names ocluster-scheduler ocluster-client ocluster-worker ocluster-admin) (package ocluster) (names scheduler client worker admin) - (libraries dune-build-info ocluster-api logs.cli logs.fmt fmt.cli fmt.tty capnp-rpc-unix cluster_scheduler cluster_worker prometheus-app.unix db + (libraries dune-build-info ocluster-api logs.cli logs.fmt fmt.cli fmt.tty capnp-rpc-unix cluster_scheduler ocluster-worker prometheus-app.unix db (select winsvc_wrapper.ml from (winsvc -> winsvc_wrapper.winsvc.ml) ( -> winsvc_wrapper..ml)))) diff --git a/dune-project b/dune-project index 24513586..a9cbe659 100644 --- a/dune-project +++ b/dune-project @@ -18,12 +18,30 @@ (capnp-rpc-lwt (>= 1.2)) fmt ppx_deriving_yojson)) - + +(package + (name ocluster-worker) + (synopsis "OCluster library for defining workers") + (description "OCluster library for defining workers") + (depends + (ocluster-api (= :version)) + (ocaml (>= 4.12.0)) + (obuilder (>= 0.5.1)) + (digestif (>= 0.8)) + fpath + logs + (lwt (>= 5.6.1)) + (prometheus-app (>= 1.2)) + (capnp-rpc-lwt (>= 1.2)) + (cohttp-lwt-unix (>= 4.0)) + (extunix (>= 0.4.1)))) + (package (name ocluster) (synopsis "Distribute build jobs to workers") (description "OCluster manages a pool of build workers.\nA build scheduler service accepts build jobs from clients and distributes them to worker machines using Cap'n Proto.\nWorkers register themselves by connecting to the scheduler (and workers do not need to be able to accept incoming network connections).\n\nThe scheduler can manage multiple pools (e.g. `linux-x86_64` and `linux-arm32`).\nClients say which pool should handle their requests.\nAt the moment, two build types are provided: building a Dockerfile, or building an OBuilder spec.\nIn either case, the build may done in the context of some Git commit.\nThe scheduler tries to schedule similar builds on the same machine, to benefit from caching.") (depends + (ocluster-worker (= :version)) (ocaml (>= 4.12.0)) (ppx_expect (>= v0.14.1)) prometheus @@ -34,7 +52,6 @@ capnp-rpc-lwt capnp-rpc-net (capnp-rpc-unix (>= 1.2)) - (extunix (>= 0.3.2)) (winsvc (and (>= 1.0.1) (= :os "win32"))) (cmdliner (>= 1.1.0)) logs @@ -44,7 +61,6 @@ fpath lwt-dllist (prometheus-app (>= 1.2)) - cohttp-lwt-unix sqlite3 (obuilder (>= 0.5.1)) (psq (>= 0.2.1)) diff --git a/ocluster-worker.opam b/ocluster-worker.opam new file mode 100644 index 00000000..f8d372fa --- /dev/null +++ b/ocluster-worker.opam @@ -0,0 +1,39 @@ +# This file is generated by dune, edit dune-project instead +opam-version: "2.0" +synopsis: "OCluster library for defining workers" +description: "OCluster library for defining workers" +maintainer: ["talex5@gmail.com"] +authors: ["talex5@gmail.com"] +license: "Apache-2.0" +homepage: "https://github.com/ocurrent/ocluster" +bug-reports: "https://github.com/ocurrent/ocluster/issues" +depends: [ + "dune" {>= "3.3"} + "ocluster-api" {= version} + "ocaml" {>= "4.12.0"} + "obuilder" {>= "0.5.1"} + "digestif" {>= "0.8"} + "fpath" + "logs" + "lwt" {>= "5.6.1"} + "prometheus-app" {>= "1.2"} + "capnp-rpc-lwt" {>= "1.2"} + "cohttp-lwt-unix" {>= "4.0"} + "extunix" {>= "0.4.1"} + "odoc" {with-doc} +] +build: [ + ["dune" "subst"] {dev} + [ + "dune" + "build" + "-p" + name + "-j" + jobs + "@install" + "@runtest" {with-test} + "@doc" {with-doc} + ] +] +dev-repo: "git+https://github.com/ocurrent/ocluster.git" diff --git a/ocluster.opam b/ocluster.opam index e04a78b0..35291970 100644 --- a/ocluster.opam +++ b/ocluster.opam @@ -18,6 +18,7 @@ homepage: "https://github.com/ocurrent/ocluster" bug-reports: "https://github.com/ocurrent/ocluster/issues" depends: [ "dune" {>= "3.3"} + "ocluster-worker" {= version} "ocaml" {>= "4.12.0"} "ppx_expect" {>= "v0.14.1"} "prometheus" @@ -28,7 +29,6 @@ depends: [ "capnp-rpc-lwt" "capnp-rpc-net" "capnp-rpc-unix" {>= "1.2"} - "extunix" {>= "0.3.2"} "winsvc" {>= "1.0.1" & os = "win32"} "cmdliner" {>= "1.1.0"} "logs" @@ -38,7 +38,6 @@ depends: [ "fpath" "lwt-dllist" "prometheus-app" {>= "1.2"} - "cohttp-lwt-unix" "sqlite3" "obuilder" {>= "0.5.1"} "psq" {>= "0.2.1"} diff --git a/worker/dune b/worker/dune index 6ce4cfb9..528787cd 100644 --- a/worker/dune +++ b/worker/dune @@ -12,4 +12,5 @@ (library (name cluster_worker) + (public_name ocluster-worker) (libraries ocluster-api digestif fpath logs capnp-rpc-lwt lwt.unix prometheus-app cohttp-lwt-unix obuilder extunix))