This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-05-18
Channels
- # aws (3)
- # beginners (18)
- # boot (3)
- # cider (47)
- # clara (54)
- # cljs-dev (62)
- # clojure (104)
- # clojure-berlin (1)
- # clojure-denver (1)
- # clojure-italy (1)
- # clojure-nl (22)
- # clojure-russia (30)
- # clojure-spec (28)
- # clojure-uk (95)
- # clojurescript (31)
- # cloverage (1)
- # cursive (1)
- # datomic (17)
- # duct (4)
- # emacs (27)
- # fulcro (36)
- # graphql (1)
- # hoplon (1)
- # jobs-discuss (1)
- # lein-figwheel (1)
- # lumo (2)
- # off-topic (44)
- # om-next (5)
- # onyx (29)
- # precept (1)
- # re-frame (8)
- # reagent (7)
- # ring (1)
- # ring-swagger (2)
- # schema (4)
- # shadow-cljs (185)
- # spacemacs (21)
- # specter (59)
- # tools-deps (7)
- # vim (15)
- # yada (1)
Hi I have a pretty 101 question lol. I’ve been through the learn-onyx, etc stuff (great material BTW), but one thing that’s not clear is the best, or just a simple way to set stuff for a ‘typical’ deployment. When deploying and uberjar one would conceivably just set everything up then kick off the job. The onyx-app template seems like more of a generic job runner. trying to hack it down to just startup and run the configured job. Is something like this ‘right’?
(defn -main [& args]
(let [onyx-id (java.util.UUID/randomUUID)
env-config (assoc (-> "config.edn" io/resource slurp read-string :env-config)
:onyx/tenancy-id onyx-id)
peer-config (assoc (-> "config.edn"
io/resource slurp read-string :peer-config) :onyx/tenancy-id onyx-id)
env (onyx.api/start-env env-config)
peer-group (onyx.api/start-peer-group peer-config)
peers (onyx.api/start-peers 5 peer-group)
job-id (:job-id
(onyx.api/submit-job peer-config
(onyx.job/register-job "basic-job" nil)))]
(print job-id)
#_(onyx.api/await-job-completion peer-config)
#_(assoc component :env env :peer-group peer-group
:peers peers :onyx-id onyx-id)))
The way it used to work was by using CLI params. So one set of params would essentially just spin up your peers. If you run it with a job name it would it would submit the job to the peers
yeah I’m trying to figure out the best approach if say this guy is in a docker container, etc in my case this is a ‘forever’ job, part of a cqrs-style system. So it should just come up and start processing commands
We ended up combining the startup of the peers and the job in the main function, not perfect but it handled the job in hand perfectly.
Wrapped in a Docker container and there's also a Marathon config template too so you can deploy via DCOS
There is a heartbeat server baked in there too so marathon could check the state of the container.
The only gotcha if you submit when you startup the peers is you should use a stable job id to make the job submission idempotent
i have a cli tool myself, that has options to start peers, submit jobs, kill jobs and perform gc
hi, do you normally set the consumer group.id via the consumer opts with onyx-kafka or is it doing something internally ?
@eoliphant Onyx is managing the Kafka consumer state on its own. You can set it if you want, but if I recall right, it’s not doing anything.
It’s mostly useful if you’re monitoring consumers on the kafka side
ah ok, so say separate jobs, that are reading from the same topic, onyx is taking care of offset mgmt, etc
Correct. You can set it with :kafka/group-id
in the catalog if you like.
It defaults to "onyx"
.