Fork me on GitHub

Hey @weavejester! I was just wondering, how would you go about using values read from the environment in duct? I’m deploying my microservice to GKE, and I’d love to take advantage of K8s secrets!


@arundilipan I just asked abut using env vars, the answer will apply to you.


You have to expose the secret in the container env spec to make it available, but that’s really on the k8s side of things


i just stumbled on the docs @kardan, i was looking more along the lines of how to read from something like environ, but i think i found my answer


so in the config.edn you have to specify something like :password #env "PASSWORD" right?


Ah! I just saw the convo, my bad i’ll check myself out


No worries. You got the k8s side figured out?


I believe so haha


I just tried to run my first duct app as an uberjar but found two problems so far: 1. lein uberjar fails with error java.lang.ClassNotFoundException: duct.database.sql.Boundary, compiling:(db.clj:1:1) -> this can be solved either by adding explicit (:require [duct.database.sql :as dsql]) before (:import (duct.database.sql Boundary))) or by AOT-compiling only the my main app namespace 2. DB migrations weren't executed when I run uberjar - app failed because expected tables aren't there. Is the behavior of ragtime migration module different in prod/ubejar env?


@jumar Yes, you need to require the namespace that records are in. DB migrations can be run via lein run :duct/migrator or calling your uberjar with the same arguments.


By default in production Duct only runs keys deriving from :duct/daemon. If you have multiple web servers, having all of them run the migrations simultaneously would lead to a mess, so unlike in development it’s not run automatically.


I still need to add a note about that to the migrator.ragtime README as well as the duct/core README


@weavejester great, thanks a lot! 🙂 As regards to requiring namespace with records it would be nice to have that in the code generated by leiningen template.


@jumar Oh, it isn’t? Yikes! I’ll be sure to fix that when I update the template (which should be soon!)