Skip to content

Commit

Permalink
Add pghero cell
Browse files Browse the repository at this point in the history
  • Loading branch information
Shay Bergmann authored and womfoo committed Sep 30, 2022
1 parent 10464b0 commit fb73eac
Showing 1 changed file with 37 additions and 0 deletions.
37 changes: 37 additions & 0 deletions cells/pghero/nomadTask.nix
@@ -0,0 +1,37 @@
{
inputs,
cell,
}: {
default = {patroniNamespace, dbName}: let
dbSecrets = {
__toString = _: "kv/nomad-cluster/${patroniNamespace}/database";
pgUser = ".Data.data.patroniSuper";
pgPass = ".Data.data.patroniSuperPass";
};
in {
task.pghero = {
driver = "docker";
lifecycle.sidecar = false;
config.image = "ankane/pghero";

template = [
{
change_mode = "restart";
data = ''
DATABASE_URL="postgres://{{ with secret "${dbSecrets}" }}{{ ${
dbSecrets.pgUser
} }}:{{ ${
dbSecrets.pgPass
} }}@master.${patroniNamespace}-database.service.consul:5432/${dbName}{{ end }}"
'';
destination = "secrets/env.txt";
env = true;
left_delimiter = "{{";
perms = "0644";
right_delimiter = "}}";
splay = "5s";
}
];
};
};
}

0 comments on commit fb73eac

Please sign in to comment.