Skip to content

Commit

Permalink
Merge pull request #8 from Smorci/nix-packaging
Browse files Browse the repository at this point in the history
Add nix shell apps and hardcode number of nodes to 3
  • Loading branch information
Smorci authored Sep 5, 2024
2 parents af64f69 + fb58bda commit b820ed3
Show file tree
Hide file tree
Showing 4 changed files with 65 additions and 4 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
.direnv
.env
64 changes: 62 additions & 2 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,68 @@
in
{
devShell = with pkgs; mkShell {
buildInputs = [ fluxcd fluxctl kind kubectx kubectl git openssl ];
buildInputs = [ fluxcd fluxctl kind kubectx kubectl openssl ];
};
}

packages = rec {
default = with pkgs; writeShellApplication {
name = "bootstrap-ethereum-cluster";

runtimeInputs = [ kind fluxcd kubectl kubectx openssl ];

text = ''
set -e
# shellcheck source=/dev/null
source .env
kind create cluster --name ethereum-nodes
kubectl create namespace ethereum-node-automation
kubens ethereum-node-automation
# shellcheck source=/dev/null
source scripts/generate-token.sh
flux bootstrap github \
--owner=Smorci \
--repository=ethereum-node-automation \
--branch=main \
--path=./clusters/ethereum-node-automation \
--personal
flux create source git ethereum-node-automation \
--url=https://github.com/Smorci/ethereum-node-automation \
--branch=main \
--interval=1m \
--export > ./clusters/ethereum-node-automation/ethereum-node-automation-source.yaml
flux create kustomization ethereum-node-automation \
--target-namespace=ethereum-node-automation \
--source=ethereum-node-automation \
--path=./kustomize \
--prune=true \
--wait=true \
--interval=30m \
--retry-interval=2m \
--health-check-timeout=3m \
--export > ./clusters/ethereum-node-automation/ethereum-node-automation-kustomization.yaml
'';

};
delete = with pkgs; writeShellApplication {
name = "delete-ethereum-cluster";

runtimeInputs = [ kind ];

text = ''
set -e
kind delete clusters ethereum-nodes
'';
};
};
}
);
}
2 changes: 1 addition & 1 deletion kustomize/consensus-layer.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ kind: Deployment
metadata:
name: consensus-layer
spec:
replicas: 1
replicas: 3
selector:
matchLabels:
app: consensus-layer
Expand Down
2 changes: 1 addition & 1 deletion kustomize/execution-layer.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ kind: Deployment
metadata:
name: execution-layer
spec:
replicas: 1
replicas: 3
selector:
matchLabels:
app: execution-layer
Expand Down

0 comments on commit b820ed3

Please sign in to comment.