run bridge_ui in devnet

Change-Id: Id48de471bffda421a6ae70d15c66e7c5477fc1d1
This commit is contained in:
justinschuldt 2021-10-26 05:02:59 -05:00 committed by Justin Schuldt
parent e5045f1c8c
commit a956e570fb
6 changed files with 88 additions and 16 deletions

View File

@ -90,3 +90,10 @@ Guardian events can be persisted to a cloud BigTable instance by passing a GCP p
Launch the devnet with flags supplying your database info to forward events to your cloud BigTable, rather than the local devnet BigTable emulator: Launch the devnet with flags supplying your database info to forward events to your cloud BigTable, rather than the local devnet BigTable emulator:
tilt up -- --num=1 --gcpProject=your-project-id --bigTableKeyPath=./your-service-account-key.json tilt up -- --num=1 --gcpProject=your-project-id --bigTableKeyPath=./your-service-account-key.json
## bridge UI
Run the bridge UI in devnet by supplying the `--bridge_ui` flag:
tilt up -- --bridge_ui

View File

@ -32,6 +32,7 @@ config.define_string("bigTableKeyPath", False, "Path to BigTable json key file")
# Components # Components
config.define_bool("pyth", False, "Enable Pyth-to-Wormhole component") config.define_bool("pyth", False, "Enable Pyth-to-Wormhole component")
config.define_bool("explorer", False, "Enable explorer component") config.define_bool("explorer", False, "Enable explorer component")
config.define_bool("bridge_ui", False, "Enable bridge UI component")
cfg = config.parse() cfg = config.parse()
num_guardians = int(cfg.get("num", "1")) num_guardians = int(cfg.get("num", "1"))
@ -41,6 +42,7 @@ bigTableKeyPath = cfg.get("bigTableKeyPath", "./event_database/devnet_key.json")
ci = cfg.get("ci", False) ci = cfg.get("ci", False)
pyth = cfg.get("pyth", ci) pyth = cfg.get("pyth", ci)
explorer = cfg.get("explorer", ci) explorer = cfg.get("explorer", ci)
bridge_ui = cfg.get("bridge_ui", ci)
# namespace # namespace
@ -230,6 +232,28 @@ k8s_resource("eth-devnet2", port_forwards = [
port_forward(8546, name = "Ganache RPC [:8546]"), port_forward(8546, name = "Ganache RPC [:8546]"),
]) ])
if bridge_ui:
docker_build(
ref = "bridge-ui",
context = ".",
only = ["./ethereum", "./sdk", "./bridge_ui"],
dockerfile = "bridge_ui/Dockerfile",
live_update = [
sync("./bridge_ui/src", "/app/bridge_ui/src"),
],
)
k8s_yaml_with_ns("devnet/bridge-ui.yaml")
k8s_resource(
"bridge-ui",
resource_deps = ["proto-gen-web", "wasm-gen"],
port_forwards = [
port_forward(5000, name = "Bridge UI [:5000]"),
],
)
# bigtable # bigtable
def build_cloud_function(container_name, go_func_name, path, builder): def build_cloud_function(container_name, go_func_name, path, builder):

1
bridge_ui/.env.sample Normal file
View File

@ -0,0 +1 @@
REACT_APP_COVALENT_API_KEY=

29
bridge_ui/Dockerfile Normal file
View File

@ -0,0 +1,29 @@
# syntax=docker.io/docker/dockerfile:experimental@sha256:de85b2f3a3e8a2f7fe48e8e84a65f6fdd5cd5183afa6412fff9caa6871649c44
# Derivative of ethereum/Dockerfile, look there for an explanation on how it works.
FROM node:16-alpine@sha256:004dbac84fed48e20f9888a23e32fa7cf83c2995e174a78d41d9a9dd1e051a20
RUN mkdir -p /app
WORKDIR /app
ADD . .
RUN --mount=type=cache,uid=1000,gid=1000,target=/home/node/.npm \
npm ci --prefix ethereum
RUN --mount=type=cache,uid=1000,gid=1000,target=/home/node/.npm \
npm ci --prefix sdk/js
RUN --mount=type=cache,uid=1000,gid=1000,target=/home/node/.npm \
npm run build --prefix sdk/js
WORKDIR ./bridge_ui
RUN --mount=type=cache,uid=1000,gid=1000,target=/home/node/.npm \
npm ci
RUN --mount=type=cache,uid=1000,gid=1000,target=/home/node/.npm \
npm i serve
RUN --mount=type=cache,uid=1000,gid=1000,target=/home/node/.npm \
npm run build

View File

@ -53,3 +53,11 @@ REACT_APP_CLUSTER=mainnet REACT_APP_COVALENT_API_KEY=YOUR_API_KEY REACT_APP_SOLA
```bash ```bash
npx serve -s build npx serve -s build
``` ```
## Environment Variables (optional)
Create `.env` from the sample file, then add your Covalent API key:
```bash
cp .env.sample .env
```

View File

@ -2,45 +2,48 @@
apiVersion: v1 apiVersion: v1
kind: Service kind: Service
metadata: metadata:
name: web name: bridge-ui
labels: labels:
app: web app: bridge-ui
spec: spec:
ports: ports:
- port: 3000 - port: 8001
name: rpc name: http
protocol: TCP protocol: TCP
clusterIP: None clusterIP: None
selector: selector:
app: web app: bridge-ui
--- ---
apiVersion: apps/v1 apiVersion: apps/v1
kind: StatefulSet kind: StatefulSet
metadata: metadata:
name: web name: bridge-ui
spec: spec:
selector: selector:
matchLabels: matchLabels:
app: web app: bridge-ui
serviceName: web serviceName: bridge-ui
replicas: 1 replicas: 1
template: template:
metadata: metadata:
labels: labels:
app: web app: bridge-ui
spec: spec:
terminationGracePeriodSeconds: 1 terminationGracePeriodSeconds: 1
containers: containers:
- name: web - name: bridge-ui
image: web image: bridge-ui
command: command:
- /usr/local/bin/npm - /app/bridge_ui/node_modules/.bin/serve
- start - -s
- build
- -n
tty: true tty: true
ports: ports:
- containerPort: 3000 - containerPort: 5000
name: react-devserver name: npxserver
protocol: TCP protocol: TCP
readinessProbe: readinessProbe:
httpGet: httpGet:
port: react-devserver port: npxserver
path: /