From 4437f4e3da9dc5eaf39d960a4acf6845445b2b61 Mon Sep 17 00:00:00 2001 From: wdhowe Date: Tue, 22 Sep 2020 14:29:36 -0500 Subject: [PATCH] issue/99/dev-mesos-version: Update Meson Dev Mesos to a newer version Changed project's development mesos version to mesos-mini. (https://mesos.apache.org/blog/mesos-mini/) This is similar to minikube (self-contained cluster), but the Mesos version. --- dev-resources/src/meson/ops/mesos.clj | 42 +++++++++++++-------------- project.clj | 7 +++-- src/meson/config.clj | 9 +++--- 3 files changed, 30 insertions(+), 28 deletions(-) diff --git a/dev-resources/src/meson/ops/mesos.clj b/dev-resources/src/meson/ops/mesos.clj index e924106..31d10bc 100644 --- a/dev-resources/src/meson/ops/mesos.clj +++ b/dev-resources/src/meson/ops/mesos.clj @@ -1,6 +1,5 @@ (ns meson.ops.mesos - (:require [clojure.pprint :refer [pprint]] - [meson.config :as config] + (:require [meson.config :as config] [meson.util.shell :as util] [taoensso.timbre :as log] [trifl.docs :as docs])) @@ -18,11 +17,12 @@ [] (log/info "Starting local docker cluster ...") (log/debugf "Using image '%s'" config/docker-image-name) - (util/shellf-silent "rm -f %s" config/docker-container-id-file) + (util/shellf-silent "rm -f %s" config/docker-container-name) (util/shellf "docker pull %s" config/docker-image-name) - (util/shellf-silent "docker run -d --cidfile %s --publish %s %s" - config/docker-container-id-file - config/docker-port-mappings + (util/shellf-silent "docker run --detach --privileged --publish %s --publish %s --name %s %s" + config/docker-mesos-ports + config/docker-marathon-ports + config/docker-container-name config/docker-image-name) (log/info "Done.")) @@ -30,7 +30,7 @@ "" [] (log/info "Stoping local docker cluster ...") - (let [id (util/shellf-silent "cat %s" config/docker-container-id-file)] + (let [id config/docker-container-name] (util/shellf-silent "docker stop %s" id)) (log/info "Done.")) @@ -45,11 +45,11 @@ [] (log/warn "Note that clojure.java.shell doesn't directly support TTY" "connections.") - (let [id (util/shellf-silent "cat %s" config/docker-container-id-file)] + (let [id config/docker-container-name] (log/info - (format (str "To connect to the running docker container, execute the " - "following:\n\n docker exec -it %s bash\n") - id)))) + (format (str "To connect to the running docker container, execute the " + "following:\n\n docker exec -it %s bash\n") + id)))) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;; Dispatch Functions ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; @@ -100,14 +100,14 @@ connect Get command to connect to running Docker container ```" ([] - (docs/print-docstring #'run)) + (docs/print-docstring #'run)) ([[subcmd & args]] - (log/trace "Got subcmd:" subcmd) - (log/trace "Got args:" args) - (case (keyword subcmd) - nil (docs/print-docstring #'run) - :start (start) - :stop (stop) - :restart (restart) - :connect (connect) - :help (docs/print-docstring #'run)))) + (log/trace "Got subcmd:" subcmd) + (log/trace "Got args:" args) + (case (keyword subcmd) + nil (docs/print-docstring #'run) + :start (start) + :stop (stop) + :restart (restart) + :connect (connect) + :help (docs/print-docstring #'run)))) diff --git a/project.clj b/project.clj index 07c77ed..c0e2f6f 100644 --- a/project.clj +++ b/project.clj @@ -22,11 +22,12 @@ :cluster-deployment :local :cluster-type :docker :docker { - :container-id-file "/tmp/meson-mesos-container-id" - :image-name "clojusc/mesos:1.0.1" + :container-name "meson-mesos" + :image-name "mesos/mesos-mini:1.9.x" :master "localhost:5050" :agent "localhost:5051" - :port-mappings "5050-5051:5050-5051"}}} + :mesos-ports "5050-5051:5050-5051" + :marathon-ports "8080:8080"}}} :profiles { :uberjar { :aot :all} diff --git a/src/meson/config.clj b/src/meson/config.clj index 18f5084..8f920a4 100644 --- a/src/meson/config.clj +++ b/src/meson/config.clj @@ -1,6 +1,5 @@ (ns meson.config - (:require [leiningen.core.project :as project] - [taoensso.timbre :as log]) + (:require [leiningen.core.project :as project]) (:refer-clojure :exclude [name])) (def all (project/read)) @@ -23,11 +22,13 @@ (def docker (:docker mesos)) -(def docker-container-id-file (:container-id-file docker)) +(def docker-container-name (:container-name docker)) (def docker-image-name (:image-name docker)) -(def docker-port-mappings (:port-mappings docker)) +(def docker-mesos-ports (:mesos-ports docker)) + +(def docker-marathon-ports (:marathon-ports docker)) (def docker-agent (:agent docker))