WH-1945: Tilt integration @ Closes #1945 (#1950)

This commit is contained in:
jumpsiegel 2022-11-17 12:43:15 -06:00 committed by GitHub
parent 2f0cb19a0a
commit aabe1ca420
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 144 additions and 0 deletions

View File

@ -39,6 +39,7 @@ config.define_string("webHost", False, "Public hostname for port forwards")
# Components
config.define_bool("near", False, "Enable Near component")
config.define_bool("sui", False, "Enable Sui component")
config.define_bool("btc", False, "Enable BTC component")
config.define_bool("aptos", False, "Enable Aptos component")
config.define_bool("algorand", False, "Enable Algorand component")
@ -64,6 +65,7 @@ ci = cfg.get("ci", False)
algorand = cfg.get("algorand", ci)
near = cfg.get("near", ci)
aptos = cfg.get("aptos", ci)
sui = cfg.get("sui", ci)
evm2 = cfg.get("evm2", ci)
solana = cfg.get("solana", ci)
terra_classic = cfg.get("terra_classic", ci)
@ -266,6 +268,8 @@ if aptos:
guardian_resource_deps = guardian_resource_deps + ["aptos"]
if wormchain:
guardian_resource_deps = guardian_resource_deps + ["guardian-validator"]
if sui:
guardian_resource_deps = guardian_resource_deps + ["sui"]
k8s_resource(
"guardian",
@ -646,6 +650,29 @@ if algorand:
trigger_mode = trigger_mode,
)
if sui:
k8s_yaml_with_ns("devnet/sui-devnet.yaml")
docker_build(
ref = "sui-node",
context = "sui",
dockerfile = "sui/Dockerfile",
ignore = ["./sui/sui.log*", "sui/sui.log*", "sui.log.*"],
only = ["Dockerfile", "scripts"],
)
k8s_resource(
"sui",
port_forwards = [
port_forward(9001, name = "WS [:9001]", host = webHost),
port_forward(9002, name = "RPC [:9002]", host = webHost),
port_forward(5003, name = "Faucet [:5003]", host = webHost),
port_forward(9184, name = "Prometheus [:9184]", host = webHost),
],
# resource_deps = ["const-gen"],
labels = ["sui"],
trigger_mode = trigger_mode,
)
if near:
k8s_yaml_with_ns("devnet/near-devnet.yaml")

65
devnet/sui-devnet.yaml Normal file
View File

@ -0,0 +1,65 @@
apiVersion: v1
kind: Service
metadata:
labels:
app: sui
name: sui
spec:
ports:
- name: node
port: 9002
targetPort: node
- name: ws
port: 9001
targetPort: ws
- name: prometheus
port: 9184
targetPort: prometheus
- name: faucet
port: 5003
targetPort: faucet
selector:
app: sui
---
apiVersion: apps/v1
kind: StatefulSet
metadata:
labels:
app: sui
name: sui
spec:
replicas: 1
selector:
matchLabels:
app: sui
serviceName: sui
template:
metadata:
labels:
app: sui
spec:
containers:
- name: sui-node
image: sui-node
command:
- /bin/sh
- -c
- /tmp/start_node.sh
ports:
- containerPort: 9002
name: node
protocol: TCP
- containerPort: 9001
name: ws
protocol: TCP
- containerPort: 9184
name: prometheus
protocol: TCP
- containerPort: 5003
name: faucet
protocol: TCP
readinessProbe:
tcpSocket:
port: 9002
restartPolicy: Always

8
sui/Docker.md Normal file
View File

@ -0,0 +1,8 @@
# first build the image
(cd ..; DOCKER_BUILDKIT=1 docker build --progress plain -f sui/Dockerfile.base -t sui .)
# tag the image with the appropriate version
docker tag sui:latest ghcr.io/wormhole-foundation/sui:0.15.0
# push to ghcr
docker push ghcr.io/wormhole-foundation/sui:0.15.0
echo remember to update both Dockerfile and Dockerfile.export

4
sui/Dockerfile Normal file
View File

@ -0,0 +1,4 @@
FROM ghcr.io/wormhole-foundation/sui:0.15.0@sha256:ba5740e42ac41306719114ce96d9752a12bbfa500749ede64fa76a250113993b as sui-node
RUN sui genesis -f
COPY scripts/start_node.sh /tmp
COPY scripts/funder.sh /tmp

22
sui/Dockerfile.base Normal file
View File

@ -0,0 +1,22 @@
FROM docker.io/redhat/ubi8@sha256:56c374376a42da40f3aec753c4eab029b5ea162d70cb5f0cda24758780c31d81 as sui-node
# RUN apt-get update && apt-get -y install libclang-dev jq cmake curl npm --no-install-recommends
RUN dnf -y update
RUN dnf -y install jq cmake curl npm git gcc openssl-devel gcc-c++ clang make git
COPY sui/scripts/setup_rust.sh /tmp
RUN /tmp/setup_rust.sh
WORKDIR /tmp
COPY sui/scripts/node_builder.sh /tmp
RUN /tmp/node_builder.sh
WORKDIR /tmp
FROM docker.io/redhat/ubi8@sha256:56c374376a42da40f3aec753c4eab029b5ea162d70cb5f0cda24758780c31d81 as export-stage
COPY --from=sui-node /root/.cargo/bin/sui /bin/sui
COPY --from=sui-node /root/.cargo/bin/sui-faucet /bin/sui-faucet
COPY --from=sui-node /root/.cargo/bin/sui-node /bin/sui-node

3
sui/scripts/funder.sh Executable file
View File

@ -0,0 +1,3 @@
#!/bin/bash -f
sui client transfer-sui --to 0x2acab6bb0e4722e528291bc6ca4f097e18ce9331 --sui-coin-object-id `sui client objects | grep sui::SUI | tail -1 | sed -e 's/|.*//'` --gas-budget 10000

15
sui/scripts/start_node.sh Executable file
View File

@ -0,0 +1,15 @@
#!/bin/bash
set -x
sui start &
sleep 10
#sleep infinity
sui client object --id 0x5
#sui-faucet --host-ip 0.0.0.0&
#sleep 2
#curl -X POST -d '{"FixedAmountRequest":{"recipient": "'"0x2acab6bb0e4722e528291bc6ca4f097e18ce9331"'"}}' -H 'Content-Type: application/json' http://127.0.0.1:5003/gas
sed -i -e 's/:9000/:9002/' ~/.sui/sui_config/fullnode.yaml
sui-node --config-path ~/.sui/sui_config/fullnode.yaml
#sleep infinity