Fork me on GitHub
#duct
<
2018-03-20
>
Arun06:03:19

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!

kardan06:03:17

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

kardan06:03:27

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

Arun06:03:30

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

Arun06:03:06

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

Arun06:03:58

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

kardan06:03:54

No worries. You got the k8s side figured out?

Arun06:03:14

I believe so haha

jumar17:03:12

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?

weavejester18:03:17

@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.

weavejester18:03:34

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.

weavejester18:03:01

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

jumar18:03:12

@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.

weavejester18:03:25

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