Skip to content

Commit 4adfcb8

Browse files
committed
Try: healthcheck without and full nix-store paths
1 parent 6f3e2f7 commit 4adfcb8

File tree

7 files changed

+1012
-1032
lines changed

7 files changed

+1012
-1032
lines changed

nix/haskell.nix

+1
Original file line numberDiff line numberDiff line change
@@ -440,6 +440,7 @@ project.appendOverlays (with haskellLib.projectOverlays; [
440440
profiled = lib.getAttrFromPath path final.profiled.hsPkgs;
441441
asserted = lib.getAttrFromPath path final.asserted.hsPkgs;
442442
eventlogged = lib.getAttrFromPath path final.eventlogged.hsPkgs;
443+
noGitRev = value;
443444
};
444445
}
445446
else value)

nix/workbench/backend/nomad-job.nix

+10-10
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
, stateDir
99
, profileBundle
1010
, generatorTaskName
11-
, containerPkgs
11+
, installables
1212
, oneTracerPerNode ? false
1313
, withSsh ? false
1414
}:
@@ -75,8 +75,8 @@ let
7575

7676
entrypoint =
7777
let
78-
coreutils = containerPkgs.coreutils.nix-store-path;
79-
supervisor = containerPkgs.supervisor.nix-store-path;
78+
coreutils = installables.coreutils.nix-store-path;
79+
supervisor = installables.supervisor.nix-store-path;
8080
in escapeTemplate
8181
''
8282
# Store entrypoint's envars and "uname" in a file for debugging purposes.
@@ -510,7 +510,7 @@ let
510510
# ERROR: cannot verify iog-cardano-perf.s3.eu-central-1.amazonaws.com's certificate, issued by 'CN=Amazon RSA 2048 M01,O=Amazon,C=US':
511511
# Unable to locally verify the issuer's authority.
512512
# To connect to iog-cardano-perf.s3.eu-central-1.amazonaws.com insecurely, use `--no-check-certificate'.
513-
SSL_CERT_FILE = "${containerPkgs.cacert.nix-store-path}/etc/ssl/certs/ca-bundle.crt";
513+
SSL_CERT_FILE = "${installables.cacert.nix-store-path}/etc/ssl/certs/ca-bundle.crt";
514514
};
515515

516516
# Sensible defaults.
@@ -946,9 +946,9 @@ let
946946
../service/ssh.nix
947947
{
948948
inherit pkgs;
949-
bashInteractive = containerPkgs.bashInteractive.nix-store-path;
950-
coreutils = containerPkgs.coreutils.nix-store-path;
951-
sshdExecutable = "${containerPkgs.openssh_hacks.nix-store-path}/bin/sshd";
949+
bashInteractive = installables.bashInteractive.nix-store-path;
950+
coreutils = installables.coreutils.nix-store-path;
951+
sshdExecutable = "${installables.openssh_hacks.nix-store-path}/bin/sshd";
952952
}
953953
;
954954
in [
@@ -1002,12 +1002,12 @@ let
10021002
{
10031003
driver = "exec";
10041004
config = {
1005-
command = "${containerPkgs.bashInteractive.nix-store-path}/bin/bash";
1005+
command = "${installables.bashInteractive.nix-store-path}/bin/bash";
10061006
args = ["local/entrypoint.sh"];
10071007
nix_installables =
10081008
(lib.attrsets.mapAttrsToList
1009-
(name: attr: attr.installable)
1010-
containerPkgs
1009+
(name: attr: attr.nix-store-path)
1010+
installables
10111011
)
10121012
;
10131013
};

nix/workbench/backend/nomad.nix

+83-103
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@ let
1313
# Intermediate / workbench-adhoc container specifications
1414
let containerSpecs = rec {
1515
##########################################################################
16-
# The actual commit. The one used when entering the workbench.
17-
gitrev = pkgs.gitrev;
1816
# Where to deploy inside the Task, needed to send commands (`nomad exec`).
1917
diretories = rec {
2018
work = "/local";
@@ -28,10 +26,8 @@ let
2826
[ diretories.run "supervisor" "supervisord.conf"]
2927
;
3028
};
31-
# Binaries. Flake references to the local nix store or remote repos.
32-
containerPkgs = installables {inherit gitrev;};
3329
# The Nomad Job description for the requested sub-backend.
34-
nomadJob = nomad-job {inherit profileBundle containerPkgs;};
30+
nomadJob = nomad-job {inherit profileBundle installables;};
3531
##########################################################################
3632
};
3733
in pkgs.runCommand "workbench-backend-data-${profileBundle.profile.value.name}-nomad"
@@ -55,91 +51,81 @@ let
5551
# The workbench will by default insert in the Nomad Job description the
5652
# "installable" property as defined here while keeping the extra details as a
5753
# `jq` friendly reference that are used to change it later.
58-
installables = {gitrev}:
59-
############################################################################
60-
# The "default" / basic environment where the node will run. ###############
61-
# This pkgs rarely change and are almost always cached. ###############
62-
############################################################################
63-
(lib.attrsets.mapAttrs
64-
(name: attr:
65-
# The installable property is always the same.
66-
let flakeReference = attr.flake-reference;
67-
flakeOutput = attr.flake-output;
68-
# The commit must come from `pkgs` because all script are using
69-
# this for the shebang and other basic tools ("coreutils") and are
70-
# also the dependencies used inside the workbench, like `jq`.
71-
commit = pkgs.gitrev;
72-
in attr // {installable="${flakeReference}/${commit}#${flakeOutput}";}
73-
)
74-
{
75-
coreutils = {
76-
nix-store-path = pkgs.coreutils;
77-
flake-reference = "github:intersectmbo/cardano-node";
78-
flake-output = "legacyPackages.x86_64-linux.coreutils";
79-
installable = null;
80-
};
81-
bashInteractive = {
82-
nix-store-path = pkgs.bashInteractive;
83-
flake-reference = "github:intersectmbo/cardano-node";
84-
flake-output = "legacyPackages.x86_64-linux.bashInteractive";
85-
installable = null;
86-
};
87-
findutils = {
88-
nix-store-path = pkgs.findutils;
89-
flake-reference = "github:intersectmbo/cardano-node";
90-
flake-output = "legacyPackages.x86_64-linux.findutils";
91-
installable = null;
92-
};
93-
iputils = {
94-
nix-store-path = pkgs.iputils;
95-
flake-reference = "github:intersectmbo/cardano-node";
96-
flake-output = "legacyPackages.x86_64-linux.iputils";
97-
installable = null;
98-
};
99-
gnutar = {
100-
nix-store-path = pkgs.gnutar;
101-
flake-reference = "github:intersectmbo/cardano-node";
102-
flake-output = "legacyPackages.x86_64-linux.gnutar";
103-
installable = null;
104-
};
105-
zstd = {
106-
nix-store-path = pkgs.zstd;
107-
flake-reference = "github:intersectmbo/cardano-node";
108-
flake-output = "legacyPackages.x86_64-linux.zstd";
109-
installable = null;
110-
};
111-
wget = {
112-
nix-store-path = pkgs.wget;
113-
flake-reference = "github:intersectmbo/cardano-node";
114-
flake-output = "legacyPackages.x86_64-linux.wget";
115-
installable = null;
116-
};
117-
cacert = {
118-
nix-store-path = pkgs.cacert;
119-
flake-reference = "github:intersectmbo/cardano-node";
120-
flake-output = "legacyPackages.x86_64-linux.cacert";
121-
installable = null;
122-
};
123-
supervisor = {
124-
nix-store-path = pkgs.python3Packages.supervisor;
125-
flake-reference = "github:intersectmbo/cardano-node";
126-
flake-output = "legacyPackages.x86_64-linux.python3Packages.supervisor";
127-
installable = null;
128-
};
129-
gnugrep = {
130-
nix-store-path = pkgs.gnugrep;
131-
flake-reference = "github:intersectmbo/cardano-node";
132-
flake-output = "legacyPackages.x86_64-linux.gnugrep";
133-
installable = null;
134-
};
135-
jq = {
136-
nix-store-path = pkgs.jq;
137-
flake-reference = "github:intersectmbo/cardano-node";
138-
flake-output = "legacyPackages.x86_64-linux.jq";
139-
installable = null;
140-
};
141-
}
142-
)
54+
55+
# (lib.attrsets.mapAttrs
56+
# (name: attr:
57+
# # The installable property is always the same.
58+
# let flakeReference = attr.flake-reference;
59+
# flakeOutput = attr.flake-output;
60+
# # The commit must come from `pkgs` because all script are using
61+
# # this for the shebang and other basic tools ("coreutils") and are
62+
# # also the dependencies used inside the workbench, like `jq`.
63+
# commit = pkgs.gitrev;
64+
# in attr // {installable="${flakeReference}/${commit}#${flakeOutput}";}
65+
# )
66+
67+
installables =
68+
{
69+
############################################################################
70+
# The "default" / basic environment where the node will run. ###############
71+
# This pkgs rarely change and are almost always cached. ###############
72+
############################################################################
73+
coreutils = {
74+
nix-store-path = pkgs.coreutils;
75+
flake-reference = "github:intersectmbo/cardano-node";
76+
flake-output = "legacyPackages.x86_64-linux.coreutils";
77+
};
78+
bashInteractive = {
79+
nix-store-path = pkgs.bashInteractive;
80+
flake-reference = "github:intersectmbo/cardano-node";
81+
flake-output = "legacyPackages.x86_64-linux.bashInteractive";
82+
};
83+
findutils = {
84+
nix-store-path = pkgs.findutils;
85+
flake-reference = "github:intersectmbo/cardano-node";
86+
flake-output = "legacyPackages.x86_64-linux.findutils";
87+
};
88+
iputils = {
89+
nix-store-path = pkgs.iputils;
90+
flake-reference = "github:intersectmbo/cardano-node";
91+
flake-output = "legacyPackages.x86_64-linux.iputils";
92+
};
93+
gnutar = {
94+
nix-store-path = pkgs.gnutar;
95+
flake-reference = "github:intersectmbo/cardano-node";
96+
flake-output = "legacyPackages.x86_64-linux.gnutar";
97+
};
98+
zstd = {
99+
nix-store-path = pkgs.zstd;
100+
flake-reference = "github:intersectmbo/cardano-node";
101+
flake-output = "legacyPackages.x86_64-linux.zstd";
102+
};
103+
wget = {
104+
nix-store-path = pkgs.wget;
105+
flake-reference = "github:intersectmbo/cardano-node";
106+
flake-output = "legacyPackages.x86_64-linux.wget";
107+
};
108+
cacert = {
109+
nix-store-path = pkgs.cacert;
110+
flake-reference = "github:intersectmbo/cardano-node";
111+
flake-output = "legacyPackages.x86_64-linux.cacert";
112+
};
113+
supervisor = {
114+
nix-store-path = pkgs.python3Packages.supervisor;
115+
flake-reference = "github:intersectmbo/cardano-node";
116+
flake-output = "legacyPackages.x86_64-linux.python3Packages.supervisor";
117+
};
118+
gnugrep = {
119+
nix-store-path = pkgs.gnugrep;
120+
flake-reference = "github:intersectmbo/cardano-node";
121+
flake-output = "legacyPackages.x86_64-linux.gnugrep";
122+
};
123+
jq = {
124+
nix-store-path = pkgs.jq;
125+
flake-reference = "github:intersectmbo/cardano-node";
126+
flake-output = "legacyPackages.x86_64-linux.jq";
127+
};
128+
}
143129
//
144130
############################################################################
145131
# Optional container enabled OpenSSH to properly fetch ~1TB cloud logs. ####
@@ -157,8 +143,6 @@ let
157143
nix-store-path = pkgs.rsync; # Not used locally.
158144
flake-reference = "github:intersectmbo/cardano-node";
159145
flake-output = "legacyPackages.x86_64-linux.rsync";
160-
# Same commit as the basic packages.
161-
installable = "${flake-reference}/${pkgs.gitrev}#${flake-output}";
162146
};
163147
}
164148
//
@@ -187,34 +171,30 @@ let
187171
then "cardanoNodePackages.cardano-node.passthru.eventlogged"
188172
else "cardanoNodePackages.cardano-node"
189173
;
190-
installable = "${flake-reference}/${gitrev}#${flake-output}";
191174
};
192175
cardano-cli = rec {
193176
# Local reference only used if not "cloud".
194-
nix-store-path = pkgs.cardanoNodePackages.cardano-cli;
177+
nix-store-path = pkgs.cardanoNodePackages.cardano-cli.passthru.noGitRev;
195178
flake-reference = "github:input-output-hk/cardano-cli";
196-
flake-output = "cardanoNodePackages.cardano-cli";
197-
installable = "${flake-reference}/${gitrev}#${flake-output}";
179+
flake-output = "cardanoNodePackages.cardano-cli.passthru.noGitRev";
198180
};
199181
cardano-tracer = rec {
200182
# Local reference only used if not "cloud".
201183
nix-store-path = pkgs.cardanoNodePackages.cardano-tracer;
202184
flake-reference = "github:intersectmbo/cardano-node";
203185
flake-output = "cardanoNodePackages.cardano-tracer";
204-
installable = "${flake-reference}/${gitrev}#${flake-output}";
205186
};
206187
tx-generator = rec {
207188
# Local reference only used if not "cloud".
208189
nix-store-path = pkgs.cardanoNodePackages.tx-generator;
209190
flake-reference = "github:intersectmbo/cardano-node";
210191
flake-output = "cardanoNodePackages.tx-generator";
211-
installable = "${flake-reference}/${gitrev}#${flake-output}";
212192
};
213193
}
214194
;
215195

216196
# The "exec" or "cloud" Nomad Job description.
217-
nomad-job = {profileBundle, containerPkgs}:
197+
nomad-job = {profileBundle, installables}:
218198
# TODO: Repeated code, add the generator's node name to profile.json
219199
let generatorTaskName = if builtins.hasAttr "explorer" profileBundle.node-specs.value
220200
then "explorer"
@@ -230,15 +210,15 @@ let
230210
{ inherit pkgs lib stateDir;
231211
inherit profileBundle;
232212
inherit generatorTaskName;
233-
inherit containerPkgs;
213+
inherit installables;
234214
oneTracerPerNode = false;
235215
withSsh = false;
236216
};
237217
oneTracerPerNode = import ./nomad-job.nix
238218
{ inherit pkgs lib stateDir;
239219
inherit profileBundle;
240220
inherit generatorTaskName;
241-
inherit containerPkgs;
221+
inherit installables;
242222
oneTracerPerNode = true;
243223
withSsh = false;
244224
};
@@ -253,15 +233,15 @@ let
253233
{ inherit pkgs lib stateDir;
254234
inherit profileBundle;
255235
inherit generatorTaskName;
256-
inherit containerPkgs;
236+
inherit installables;
257237
oneTracerPerNode = true;
258238
withSsh = false;
259239
};
260240
ssh = import ./nomad-job.nix
261241
{ inherit pkgs lib stateDir;
262242
inherit profileBundle;
263243
inherit generatorTaskName;
264-
inherit containerPkgs;
244+
inherit installables;
265245
oneTracerPerNode = true;
266246
withSsh = true;
267247
};

nix/workbench/backend/nomad.sh

+4-1
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,10 @@ backend_nomad() {
270270
then
271271
installables_array=$(jq '.containerPkgs | map(."nix-store-path")' "${dir}"/container-specs.json)
272272
else
273-
installables_array=$(jq '.containerPkgs | map(.installable)' "${dir}"/container-specs.json)
273+
# "${flakeReference}/${commit}#${flakeOutput}"
274+
local commit
275+
commit="$(git rev-parse HEAD)"
276+
installables_array=$(jq ".containerPkgs | map(.flakeReference + \"${commit}\"+ .flakeOutput)" "${dir}"/container-specs.json)
274277
fi
275278
# nix_installables
276279
local groups_array=$(jq -r ".[\"job\"][\"${nomad_job_name}\"][\"group\"] | keys | join (\" \")" "${dir}"/nomad/nomad-job.json)

nix/workbench/profile/profile.nix

+1-2
Original file line numberDiff line numberDiff line change
@@ -107,12 +107,11 @@ let
107107
)
108108
tracer-service
109109
;
110-
inherit
110+
healthcheck-service =
111111
(pkgs.callPackage
112112
../service/healthcheck.nix
113113
{inherit backend profile nodeSpecs;}
114114
)
115-
healthcheck-service
116115
;
117116
in {
118117
profile = {

0 commit comments

Comments
 (0)