From 45837241ed72c48a725cc5850941b3605e99356f Mon Sep 17 00:00:00 2001 From: Leo Date: Sat, 28 Nov 2020 01:33:57 +0100 Subject: [PATCH] devnet: add readiness checks to most components --- Dockerfile.agent | 2 +- Tiltfile | 6 +++++- devnet/eth-devnet.yaml | 10 +++++++++- devnet/solana-devnet.yaml | 9 +++++++++ devnet/terra-devnet.yaml | 7 ++++++- devnet/web.yaml | 3 +++ solana/devnet_setup.sh | 3 +++ 7 files changed, 36 insertions(+), 4 deletions(-) diff --git a/Dockerfile.agent b/Dockerfile.agent index 6ed2c4c15..a9c9b92db 100644 --- a/Dockerfile.agent +++ b/Dockerfile.agent @@ -1,7 +1,7 @@ # syntax=docker/dockerfile:experimental FROM rust:1.45 -RUN apt-get update && apt-get install -y libssl-dev libudev-dev pkg-config zlib1g-dev llvm clang +RUN apt-get update && apt-get install -y libssl-dev libudev-dev pkg-config zlib1g-dev llvm clang ncat RUN rustup component add rustfmt WORKDIR /usr/src/solana diff --git a/Tiltfile b/Tiltfile index 71deaacbd..14d999d19 100644 --- a/Tiltfile +++ b/Tiltfile @@ -161,4 +161,8 @@ k8s_resource( objects=["terra-lcd-cm0"] ) -k8s_resource("terra-terrad", objects=["terra-terrad-cm0"]) +k8s_resource( + "terra-terrad", + objects=["terra-terrad-cm0"], + port_forwards=[port_forward(26657, name="Terra RPC [:26657]")] +) diff --git a/devnet/eth-devnet.yaml b/devnet/eth-devnet.yaml index 8d5ef14fb..ab9a2c3c3 100644 --- a/devnet/eth-devnet.yaml +++ b/devnet/eth-devnet.yaml @@ -43,12 +43,20 @@ spec: - containerPort: 8545 name: rpc protocol: TCP + readinessProbe: + tcpSocket: + port: rpc - name: tests image: eth-node command: - /bin/sh - -c - - "npm run migrate && sleep infinity" + - "npm run migrate && nc -l -p 2000 && sleep infinity" + startupProbe: + periodSeconds: 1 + failureThreshold: 60 + tcpSocket: + port: 2000 - name: mine image: eth-node command: diff --git a/devnet/solana-devnet.yaml b/devnet/solana-devnet.yaml index a409b7697..411d29689 100644 --- a/devnet/solana-devnet.yaml +++ b/devnet/solana-devnet.yaml @@ -67,7 +67,16 @@ spec: - containerPort: 9900 name: faucet protocol: TCP + readinessProbe: + httpGet: + port: rpc + path: /health - name: setup image: solana-agent command: - /usr/src/solana/devnet_setup.sh + startupProbe: + tcpSocket: + port: 2000 + periodSeconds: 1 + failureThreshold: 300 diff --git a/devnet/terra-devnet.yaml b/devnet/terra-devnet.yaml index f6862e1ce..91d25a329 100644 --- a/devnet/terra-devnet.yaml +++ b/devnet/terra-devnet.yaml @@ -55,7 +55,9 @@ spec: name: terra-lcd ports: - containerPort: 1317 - resources: {} + readinessProbe: + tcpSocket: + port: 1317 volumeMounts: - mountPath: /root/.terrad/config name: terra-lcd-cm0 @@ -90,6 +92,9 @@ spec: name: terra-terrad ports: - containerPort: 26657 + readinessProbe: + httpGet: + port: 26657 resources: {} volumeMounts: - mountPath: /root/.terrad/config diff --git a/devnet/web.yaml b/devnet/web.yaml index 908c7bc92..949cbbf30 100644 --- a/devnet/web.yaml +++ b/devnet/web.yaml @@ -41,3 +41,6 @@ spec: - containerPort: 3000 name: react-devserver protocol: TCP + readinessProbe: + httpGet: + port: react-devserver diff --git a/solana/devnet_setup.sh b/solana/devnet_setup.sh index a8ccdf8c8..3dd7f3a2e 100755 --- a/solana/devnet_setup.sh +++ b/solana/devnet_setup.sh @@ -49,5 +49,8 @@ echo "Created wrapped token $token" wrapped_account=$(cli create-account --seed=934893 "$wrapped_token" | grep 'Creating account' | awk '{ print $3 }') echo "Created wrapped token account $wrapped_account" +# Let k8s startup probe succeed +nc -l -p 2000 + # Keep the container alive for interactive CLI usage sleep infinity