Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expose the ocluster-worker library as a standalone package #219

Merged
merged 1 commit into from
Feb 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -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)
Expand Down
3 changes: 2 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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 . .
Expand Down
3 changes: 2 additions & 1 deletion Dockerfile.worker
Original file line number Diff line number Diff line change
Expand Up @@ -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 . .
Expand Down
2 changes: 1 addition & 1 deletion bin/dune
Original file line number Diff line number Diff line change
Expand Up @@ -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))))
Expand Down
22 changes: 19 additions & 3 deletions dune-project
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -44,7 +61,6 @@
fpath
lwt-dllist
(prometheus-app (>= 1.2))
cohttp-lwt-unix
sqlite3
(obuilder (>= 0.5.1))
(psq (>= 0.2.1))
Expand Down
39 changes: 39 additions & 0 deletions ocluster-worker.opam
Original file line number Diff line number Diff line change
@@ -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"
3 changes: 1 addition & 2 deletions ocluster.opam
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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"
Expand All @@ -38,7 +38,6 @@ depends: [
"fpath"
"lwt-dllist"
"prometheus-app" {>= "1.2"}
"cohttp-lwt-unix"
"sqlite3"
"obuilder" {>= "0.5.1"}
"psq" {>= "0.2.1"}
Expand Down
1 change: 1 addition & 0 deletions worker/dune
Original file line number Diff line number Diff line change
Expand Up @@ -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))