eth-devnet deployment

This commit is contained in:
Leo 2020-08-16 01:38:10 +02:00
parent fc7c020553
commit 4d1610d9f0
4 changed files with 92 additions and 0 deletions

View File

@ -38,3 +38,17 @@ docker_build(
k8s_yaml("devnet/solana-devnet.yaml")
k8s_resource("solana-devnet")
# eth devnet
# TODO: Slow - takes ~30s to rebuild on a no-op, even with caching, because npm sucks.
# We might wamt to add excludes here and use file sync for smart contract developmeent.
docker_build(
ref = "eth-node",
context = "ethereum",
dockerfile = "ethereum/Dockerfile",
)
k8s_yaml("devnet/eth-devnet.yaml")
k8s_resource("eth-devnet")

56
devnet/eth-devnet.yaml Normal file
View File

@ -0,0 +1,56 @@
---
apiVersion: v1
kind: Service
metadata:
name: eth-devnet
labels:
app: eth-devnet
spec:
ports:
- port: 8545
name: rpc
protocol: TCP
clusterIP: None
selector:
app: eth-devnet
---
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: eth-devnet
spec:
selector:
matchLabels:
app: eth-devnet
serviceName: eth-devnet
replicas: 1
template:
metadata:
labels:
app: eth-devnet
spec:
terminationGracePeriodSeconds: 1
containers:
- name: eth-devnet
image: eth-node
command:
- npx
- ganache-cli
- --deterministic
- --time="1970-01-01T00:00:00+00:00"
- --host=0.0.0.0
ports:
- containerPort: 8545
name: rpc
protocol: TCP
# volumeMounts:
# - name: eth-devnet-data
# mountPath: /data
# volumeClaimTemplates:
# - metadata:
# name: eth-devnet-data
# spec:
# accessModes: [ "ReadWriteOnce" ]
# resources:
# requests:
# storage: 1Gi

21
ethereum/Dockerfile Normal file
View File

@ -0,0 +1,21 @@
# syntax=docker/dockerfile:experimental
FROM node:lts-alpine
# Run as user, otherwise, npx explodes.
USER 1000
RUN mkdir -p /home/node/app
RUN mkdir -p /home/node/.npm
WORKDIR /home/node/app
ADD --chown=node:node . .
# We want to cache node_modules *and* incorporate it into the final image.
RUN --mount=type=cache,uid=1000,gid=1000,target=/home/node/.npm \
--mount=type=cache,uid=1000,gid=1000,target=node_modules \
npm install && \
cp -r node_modules node_modules_cache
# Amusingly, Debian's coreutils version has a bug where mv believes that
# the target is on a different fs and does a full recursive copy for what
# could be a renameat syscall. Alpine does not have this bug.
RUN rmdir node_modules && mv node_modules_cache node_modules

View File

@ -21,6 +21,7 @@
"author": "",
"license": "ISC",
"dependencies": {
"ganache-cli": "^6.10.1",
"truffle": "^5.1.37"
}
}