Skip to content

Commit 194dda8

Browse files
authored
Merge pull request #41 from input-output-hk/next-2025-02-05
Node-ng 10.2.1, mithril-cli v2506.0, env cleanup
2 parents fe01715 + 21fb905 commit 194dda8

File tree

489 files changed

+1595
-20896
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

489 files changed

+1595
-20896
lines changed

Justfile

Lines changed: 17 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ checkEnv := '''
3535
checkEnvWithoutOverride := '''
3636
ENV="${1:-}"
3737
38-
if ! [[ "$ENV" =~ ^mainnet$|^preprod$|^preview$|^private$|^sanchonet$|^shelley-qa$|^demo$ ]]; then
39-
echo "Error: only node environments for demo, mainnet, preprod, preview, private, sanchonet and shelley-qa are supported"
38+
if ! [[ "$ENV" =~ ^mainnet$|^preprod$|^preview$|^demo$ ]]; then
39+
echo "Error: only node environments for demo, mainnet, preprod and preview are supported"
4040
exit 1
4141
fi
4242
@@ -46,12 +46,6 @@ checkEnvWithoutOverride := '''
4646
MAGIC="1"
4747
elif [ "$ENV" = "preview" ]; then
4848
MAGIC="2"
49-
elif [ "$ENV" = "shelley-qa" ]; then
50-
MAGIC="3"
51-
elif [ "$ENV" = "sanchonet" ]; then
52-
MAGIC="4"
53-
elif [ "$ENV" = "private" ]; then
54-
MAGIC="5"
5549
elif [ "$ENV" = "demo" ]; then
5650
MAGIC="42"
5751
fi
@@ -387,8 +381,8 @@ dedelegate-pools ENV *IDXS=null:
387381
set -euo pipefail
388382
{{checkEnvWithoutOverride}}
389383

390-
if ! [[ "$ENV" =~ ^preprod$|^preview$|^private$|^sanchonet$|^shelley-qa$ ]]; then
391-
echo "Error: only node environments for preprod, preview, private, sanchonet and shelley-qa are supported"
384+
if ! [[ "$ENV" =~ ^preprod$|^preview$ ]]; then
385+
echo "Error: only node environments for preprod and preview are supported"
392386
exit 1
393387
fi
394388

@@ -409,10 +403,8 @@ dedelegate-pools ENV *IDXS=null:
409403
CARDANO_CLI="cardano-cli"
410404
elif [ "${UNSTABLE:-}" = "true" ]; then
411405
CARDANO_CLI="cardano-cli-ng"
412-
elif [[ "$ENV" =~ ^preprod$|^preview$|^shelley-qa$ ]]; then
406+
elif [[ "$ENV" =~ ^preprod$|^preview$ ]]; then
413407
CARDANO_CLI="cardano-cli"
414-
elif [[ "$ENV" =~ ^private$|^sanchonet$ ]]; then
415-
CARDANO_CLI="cardano-cli-ng"
416408
fi
417409

418410
echo
@@ -591,7 +583,7 @@ query-tip-all:
591583
#!/usr/bin/env bash
592584
set -euo pipefail
593585
QUERIED=0
594-
for i in mainnet preprod preview private shelley-qa sanchonet demo; do
586+
for i in mainnet preprod preview demo; do
595587
TIP=$(just query-tip $i 2>&1) && {
596588
echo "Environment: $i"
597589
echo "$TIP"
@@ -614,9 +606,9 @@ query-tip ENV TESTNET_MAGIC=null:
614606
CARDANO_CLI="cardano-cli"
615607
elif [ "${UNSTABLE:-}" = "true" ]; then
616608
CARDANO_CLI="cardano-cli-ng"
617-
elif [[ "$ENV" =~ ^mainnet$|^preprod$|^preview$|^shelley-qa$ ]]; then
609+
elif [[ "$ENV" =~ ^mainnet$|^preprod$|^preview$ ]]; then
618610
CARDANO_CLI="cardano-cli"
619-
elif [[ "$ENV" =~ ^private$|^sanchonet$|^demo$ ]]; then
611+
elif [[ "$ENV" =~ ^demo$ ]]; then
620612
CARDANO_CLI="cardano-cli-ng"
621613
fi
622614

@@ -769,7 +761,7 @@ show-nameservers:
769761
print $"Nameservers for domain: ($domain) \(hosted zone id: ($id)) are:"
770762
print ($ns | to text)
771763

772-
# Decrypt a file to stdout
764+
# Decrypt a file to stdout using .sops.yaml rules
773765
sops-decrypt-binary FILE:
774766
#!/usr/bin/env bash
775767
set -euo pipefail
@@ -780,7 +772,7 @@ sops-decrypt-binary FILE:
780772
# This supports the common use case of obtaining decrypted state for cmd arg input while leaving the encrypted file intact on disk.
781773
sops --config "$(sops_config {{FILE}})" --input-type binary --output-type binary --decrypt {{FILE}}
782774

783-
# Decrypt a file in place
775+
# Decrypt a file in place using .sops.yaml rules
784776
sops-decrypt-binary-in-place FILE:
785777
#!/usr/bin/env bash
786778
set -euo pipefail
@@ -789,7 +781,7 @@ sops-decrypt-binary-in-place FILE:
789781

790782
sops --config "$(sops_config {{FILE}})" --input-type binary --output-type binary --decrypt {{FILE}} | sponge {{FILE}}
791783

792-
# Encrypt a file in place
784+
# Encrypt a file in place using .sops.yaml rules
793785
sops-encrypt-binary FILE:
794786
#!/usr/bin/env bash
795787
set -euo pipefail
@@ -800,7 +792,7 @@ sops-encrypt-binary FILE:
800792
# This supports the common use case of first time encrypting plaintext state for public storage, ex: git repo commit.
801793
sops --config "$(sops_config {{FILE}})" --input-type binary --output-type binary --encrypt {{FILE}} | sponge {{FILE}}
802794

803-
# Rotate sops encryption
795+
# Rotate sops encryption using .sops.yaml rules
804796
sops-rotate-binary FILE:
805797
#!/usr/bin/env bash
806798
set -euo pipefail
@@ -1141,8 +1133,8 @@ start-node ENV:
11411133
set -euo pipefail
11421134
{{stateDir}}
11431135

1144-
if ! [[ "{{ENV}}" =~ ^mainnet$|^preprod$|^preview$|^private$|^sanchonet$|^shelley-qa$ ]]; then
1145-
echo "Error: only node environments for mainnet, preprod, preview, private, sanchonet and shelley-qa are supported for start-node recipe"
1136+
if ! [[ "{{ENV}}" =~ ^mainnet$|^preprod$|^preview$ ]]; then
1137+
echo "Error: only node environments for mainnet, preprod, and preview are supported for start-node recipe"
11461138
exit 1
11471139
fi
11481140

@@ -1178,7 +1170,7 @@ start-node ENV:
11781170
stop-all:
11791171
#!/usr/bin/env bash
11801172
set -euo pipefail
1181-
for i in mainnet preprod preview private shelley-qa sanchonet demo; do
1173+
for i in mainnet preprod preview demo; do
11821174
just stop-node $i
11831175
done
11841176

@@ -1318,8 +1310,8 @@ truncate-chain ENV SLOT:
13181310
[ -n "${DEBUG:-}" ] && set -x
13191311
{{stateDir}}
13201312

1321-
if ! [[ "{{ENV}}" =~ ^mainnet$|^preprod$|^preview$|^private$|^sanchonet$|^shelley-qa$ ]]; then
1322-
echo "Error: only node environments for mainnet, preprod, preview, private, sanchonet and shelley-qa are supported for truncate-chain recipe"
1313+
if ! [[ "{{ENV}}" =~ ^mainnet$|^preprod$|^preview$ ]]; then
1314+
echo "Error: only node environments for mainnet, preprod, and preview are supported for truncate-chain recipe"
13231315
exit 1
13241316
fi
13251317

README.md

Lines changed: 79 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -37,45 +37,17 @@ cardano-playground organization, then store your access key in
3737
aws_access_key_id = XXXXXXXXXXXXXXXXXXXX
3838
aws_secret_access_key = XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
3939

40-
## AGE
40+
## AGE Admin
4141

42-
While cluster secrets are handled using AWS KMS, per machine secrets are
43-
handled using sops-nix age. For sops-nix age secrets access, place the
44-
SRE cluster secret in `~/.age/credentials`:
42+
While cluster secrets shared by all machines are generally handled using AWS
43+
KMS, per machine secrets are handled using sops-nix age. However, an admin age
44+
key is still typically desired so that all per machine secrets can be decrypted
45+
by an admin or SRE. A new age admin key can be generated with `age-keygen` and
46+
this should be placed in `~/.age/credentials`:
4547

4648
# cardano-playground: sre
4749
AGE-SECRET-KEY-***********************************************************
4850

49-
If needed, a new secret can be generated with `age-keygen`.
50-
51-
## SSH
52-
53-
If your credentials are correct, and the cluster is already provisioned with
54-
openTofu infrastructure, you will be able to access SSH after creating an
55-
`./.ssh_config` using:
56-
57-
just save-ssh-config
58-
59-
With that you can then get started with:
60-
61-
# List machines
62-
just list-machines
63-
64-
# Ssh to a newly provisioned machine
65-
just ssh-bootstrap $MACHINE
66-
67-
# Deploy to a newly provisioned machine
68-
just apply-bootstrap $MACHINE
69-
70-
# Ssh to a machine already deployed
71-
just ssh $MACHINE
72-
73-
# Deploy to a machine already deployed
74-
just apply $MACHINE
75-
76-
# Find many other operations recipes to use
77-
just --list
78-
7951
## Cloudformation
8052

8153
We bootstrap our infrastructure using AWS Cloudformation, it creates resources
@@ -116,6 +88,29 @@ Similarly, for monitoring resources:
11688
just tofu grafana plan
11789
just tofu grafana apply
11890

91+
## SSH
92+
93+
If your credentials are correct, and the cluster is already provisioned with
94+
openTofu infrastructure, you will be able to access SSH after creating an
95+
`./.ssh_config` and nix ip module information using:
96+
97+
just save-ssh-config
98+
just update-ips
99+
100+
With that you can then get started with:
101+
102+
# List machines
103+
just list-machines
104+
105+
# Ssh to a newly provisioned machine
106+
just ssh-bootstrap $MACHINE
107+
108+
# Ssh to a machine already deployed
109+
just ssh $MACHINE
110+
111+
# Find many other operations recipes to use
112+
just --list
113+
119114
## Colmena
120115

121116
To deploy changes on an OS level, we use the excellent
@@ -133,16 +128,62 @@ To subsequently deploy a machine:
133128

134129
## Secrets
135130

136-
Secrets are encrypted using [SOPS](https://github.com/getsops/sops) and [KMS](https://aws.amazon.com/kms/).
131+
Secrets are encrypted using [SOPS](https://github.com/getsops/sops) with
132+
[KMS](https://aws.amazon.com/kms/) and
133+
[AGE](https://github.com/FiloSottile/age).
137134

138135
All secrets live in `./secrets/`
139136

140-
You should be able to edit a KMS or sops age secret using:
137+
KMS encryption is generally used for secrets intended to be consumed by all
138+
machines as it has the benefit over age encryption of not needing re-encryption
139+
every time a machine in the cluster changes. To sops encrypt a secret file
140+
intended for all machines with KMS:
141+
142+
sops --encrypt \
143+
--kms "$KMS" \
144+
--config /dev/null \
145+
--input-type binary \
146+
--output-type binary \
147+
$SECRET_FILE \
148+
> secrets/$SECRET_FILE.enc
149+
150+
rm unencrypted-secret-file
151+
152+
For per-machine secrets, age encryption is preferred, where each secret is
153+
typically encrypted only for the target machine and an admin such as an SRE.
154+
155+
Age public and private keys will be automatically derived for each deployed
156+
machine from the machine's `/etc/ssh/ssh_host_ed25519_key` file. Therefore, no
157+
manual generation of private age keys for machines is required and the public
158+
age key for each machine is printed during each `colmena` deployment, example:
159+
160+
> just apply machine
161+
...
162+
machine | sops-install-secrets: Imported /etc/ssh/ssh_host_ed25519_key as age key with fingerprint $AGE_PUBLIC_KEY
163+
...
164+
165+
These machine public age keys become the basis for access assignment of
166+
per-machine secrets declared in [.sops.yaml](.sops.yaml)
167+
168+
A machine's age public key can also be generated on demand:
169+
170+
just ssh machine -- "'ssh-to-age < /etc/ssh/ssh_host_ed25519_key.pub'"
171+
172+
A KMS or age sops secret file can generally be edited using:
141173

142174
sops ./secrets/github-token.enc
143175

144-
Or simply decrypt a KMS or sops age secret with:
176+
Or simply decrypt a KMS or age sops secret with:
145177

146178
sops -d ./secrets/github-token.enc
147179

148-
See also the `just sops-<encrypt|decrypt>-binary` and similar recipes for encrypting or decrypting age binary blobs.
180+
In cases where the decrypted data is in json format, sops args of `--input-type
181+
binary --output-type binary` may also be required to avoid decryption embedded
182+
in json.
183+
184+
See also related sops encryption and decryption recipes:
185+
186+
just sops-decrypt-binary "$FILE" # Decrypt a file to stdout using .sops.yaml rules
187+
just sops-decrypt-binary-in-place "$FILE" # Decrypt a file in place using .sops.yaml rules
188+
just sops-encrypt-binary "$FILE" # Encrypt a file in place using .sops.yaml rules
189+
just sops-rotate-binary "$FILE" # Rotate sops encryption using .sops.yaml rules

docs/environments-pre/sanchonet

Lines changed: 0 additions & 1 deletion
This file was deleted.

docs/environments/mainnet/config-bp.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"LastKnownBlockVersion-Major": 3,
1111
"LastKnownBlockVersion-Minor": 0,
1212
"MaxKnownMajorProtocolVersion": 2,
13-
"MinNodeVersion": "8.12.0",
13+
"MinNodeVersion": "10.1.4",
1414
"PeerSharing": false,
1515
"Protocol": "Cardano",
1616
"RequiresNetworkMagic": "RequiresNoMagic",

docs/environments/mainnet/config.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"LastKnownBlockVersion-Major": 3,
1111
"LastKnownBlockVersion-Minor": 0,
1212
"MaxKnownMajorProtocolVersion": 2,
13-
"MinNodeVersion": "8.12.0",
13+
"MinNodeVersion": "10.1.4",
1414
"PeerSharing": true,
1515
"Protocol": "Cardano",
1616
"RequiresNetworkMagic": "RequiresNoMagic",

docs/environments/preprod/config-bp.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"LastKnownBlockVersion-Alt": 0,
1010
"LastKnownBlockVersion-Major": 2,
1111
"LastKnownBlockVersion-Minor": 0,
12-
"MinNodeVersion": "8.12.0",
12+
"MinNodeVersion": "10.1.4",
1313
"PeerSharing": false,
1414
"Protocol": "Cardano",
1515
"RequiresNetworkMagic": "RequiresMagic",

docs/environments/preprod/config.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"LastKnownBlockVersion-Alt": 0,
1010
"LastKnownBlockVersion-Major": 2,
1111
"LastKnownBlockVersion-Minor": 0,
12-
"MinNodeVersion": "8.12.0",
12+
"MinNodeVersion": "10.1.4",
1313
"PeerSharing": true,
1414
"Protocol": "Cardano",
1515
"RequiresNetworkMagic": "RequiresMagic",

docs/environments/preview/config-bp.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"LastKnownBlockVersion-Alt": 0,
1212
"LastKnownBlockVersion-Major": 3,
1313
"LastKnownBlockVersion-Minor": 1,
14-
"MinNodeVersion": "8.12.0",
14+
"MinNodeVersion": "10.1.4",
1515
"PeerSharing": false,
1616
"Protocol": "Cardano",
1717
"RequiresNetworkMagic": "RequiresMagic",

docs/environments/preview/config.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"LastKnownBlockVersion-Alt": 0,
1212
"LastKnownBlockVersion-Major": 3,
1313
"LastKnownBlockVersion-Minor": 1,
14-
"MinNodeVersion": "8.12.0",
14+
"MinNodeVersion": "10.1.4",
1515
"PeerSharing": true,
1616
"Protocol": "Cardano",
1717
"RequiresNetworkMagic": "RequiresMagic",

0 commit comments

Comments
 (0)