Skip to content

Instantly share code, notes, and snippets.

@justinschuldt
Created March 18, 2022 09:48
Show Gist options
  • Save justinschuldt/7b413ff54ce3ff3a0003b5e41214a310 to your computer and use it in GitHub Desktop.
Save justinschuldt/7b413ff54ce3ff3a0003b5e41214a310 to your computer and use it in GitHub Desktop.
local Ethereum explorer for wormhole - WIP
---
apiVersion: v1
kind: Service
metadata:
labels:
app: eth-ui-redis
name: eth-ui-redis
spec:
ports:
- name: redis
port: 6379
protocol: TCP
selector:
app: eth-ui-redis
---
apiVersion: v1
kind: Service
metadata:
labels:
app: eth-ui-postgres
name: eth-ui-postgres
spec:
ports:
- name: postgres
port: 5432
protocol: TCP
selector:
app: eth-ui-postgres
---
apiVersion: v1
kind: Service
metadata:
labels:
app: eth-ui-memento
name: eth-ui-memento
spec:
ports:
- name: webapp
port: 3000
protocol: TCP
- name: api
port: 3001
protocol: TCP
selector:
app: eth-ui-memento
---
apiVersion: v1
kind: Service
metadata:
labels:
app: eth-ui-explorer
name: eth-ui-explorer
spec:
ports:
- name: webapp
port: 3002
protocol: TCP
selector:
app: eth-ui-explorer
---
apiVersion: apps/v1
kind: StatefulSet
metadata:
labels:
app: eth-ui-redis
name: eth-ui-redis
spec:
replicas: 1
selector:
matchLabels:
app: eth-ui-redis
template:
metadata:
labels:
app: eth-ui-redis
spec:
containers:
- image: redis:5.0.5-alpine
name: eth-ui-redis
ports:
- containerPort: 6379
command: ["/bin/sh", "-c", "redis-server", "--appendonly", "yes"]
restartPolicy: Always
serviceName: eth-ui-redis
---
apiVersion: apps/v1
kind: StatefulSet
metadata:
labels:
app: eth-ui-postgres
name: eth-ui-postgres
spec:
replicas: 1
selector:
matchLabels:
app: eth-ui-postgres
template:
metadata:
labels:
app: eth-ui-postgres
spec:
containers:
- image: postgres:11.5-alpine
name: eth-ui-postgres
ports:
- containerPort: 5432
resources: {}
env:
- name: POSTGRES_USER
value: memento
- name: POSTGRES_PASSWORD
value: password
- name: POSTGRES_DB
value: memento
restartPolicy: Always
serviceName: eth-ui-postgres
---
apiVersion: apps/v1
kind: StatefulSet
metadata:
labels:
app: eth-ui-memento
name: eth-ui-memento
spec:
replicas: 1
selector:
matchLabels:
app: eth-ui-memento
template:
metadata:
labels:
app: eth-ui-memento
spec:
containers:
- image: alethio/memento:latest
name: eth-ui-memento
volumeMounts:
- name: config-volume
mountPath: /config/config.yaml
subPath: config.yaml
ports:
- containerPort: 3000
- containerPort: 3001
resources: {}
env:
- name: PG_PASSWORD
value: password
restartPolicy: Always
volumes:
- name: config-volume
configMap:
name: eth-ui-memento
serviceName: eth-ui-memento
---
apiVersion: apps/v1
kind: StatefulSet
metadata:
labels:
app: eth-ui-explorer
name: eth-ui-explorer
spec:
replicas: 1
selector:
matchLabels:
app: eth-ui-explorer
template:
metadata:
labels:
app: eth-ui-explorer
spec:
containers:
- image: alethio/ethereum-lite-explorer:latest
name: eth-ui-explorer
volumeMounts:
- name: config-volume
mountPath: /usr/share/nginx/html/config.json
subPath: config.json
ports:
- containerPort: 80
name: webapp
protocol: TCP
resources: {}
restartPolicy: Always
volumes:
- name: config-volume
configMap:
name: eth-ui-explorer
serviceName: eth-ui-explorer
---
kind: ConfigMap
apiVersion: v1
metadata:
name: eth-ui-memento
labels:
app: eth-ui-memento
selector:
matchLabels:
app: eth-ui-memento
data:
config.yaml: |
# api-related fields
api:
# The port on which the API will be exposed (default:3001)
port: 3001
# Enable/disable development CORS
dev-cors: true
# Allowed hosts for HTTP API development CORS
dev-cors-host: "*"
# Dashboard-related fields
dashboard:
# The port on which the Dashboard will be exposed (default:3000)
# WARNING: it must not be the same as api.port!
port: 3000
config-management:
enabled: true
# database fields
db:
# Database host
host: "eth-ui-postgres"
# Database port
port: 5432
# Database sslmode
sslmode: "disable"
# Database name
dbname: "memento"
# Database user (also allowed via PG_USER env var)
user: "memento"
# ethereum-related fields
eth:
client:
# HTTP endpoint of a web3-compatible node (mandatory)
http: "http://eth-devnet:8545"
# Websockets endpoint of JSON-RPC enabled node (optional)
# if this is present, the task manager will use a newHeads subscription to watch for new blocks
# if not present, the task manager will use polling to get the highest block
ws: "ws://eth-devnet:8545"
# The interval at which the task manager will poll the node for best block (default:"15s")
# optional, only used if `ws` url is not specified
poll-interval: "2s"
# feature flags
feature:
# Backfilling
backfill:
# Enable/disable the backfilling feature
enabled: true
# Lag feature
lag:
# Enable/disable the lag feature
enabled: false
# The amount of blocks to lag behind the tip of the chain if the lag feature is enabled
value: 10
# Automatic migrations
automigrate:
# Enable/disable the automatic migrations
enabled: true
# Uncles scraping
uncles:
# Enable/disabled the uncles scraping
enabled: false
# Control what to be logged using format "module=level,module=level"; `*` means all other modules
logging: "*=info"
# redis-related fields
redis:
# URL of redis server (default:"localhost:6379")
server: "eth-ui-redis:6379"
# The name of the redis list the scraper will use for task management (default: "todo")
list: "todo"
---
kind: ConfigMap
apiVersion: v1
metadata:
name: eth-ui-explorer
labels:
app: eth-ui-explorer
selector:
matchLabels:
app: eth-ui-explorer
data:
config.json: |
{
"GOOGLE_ANALYTICS_ID": null,
"HOTJAR_ID": null,
"SENTRY_ENABLED": false,
"pluginsUrl": "plugins",
"plugins": [{
"uri": "plugin://aleth.io/eth-common?v=4.0.0"
}, {
"uri": "plugin://aleth.io/3box?v=1.1.1",
"config": {
"ipfsUrlMask": "https://ipfs.infura.io/ipfs/%s"
}
}, {
"uri": "plugin://aleth.io/eth-memento?v=2.0.2",
"config": {
"apiBasePath": "http://localhost:3001/api/explorer"
}
}],
"pages": [{
"def": "page://aleth.io/block",
"children": {
"sidebar": [{
"def": "context://aleth.io/block/list",
"children": [
{ "def": "module://aleth.io/block/list" }
]
}],
"content": [{
"def": "module://aleth.io/memento/block/basic",
"pageCritical": true,
"children": {
"confirmations": [
{ "def": "module://aleth.io/block/confirmations" }
]
}
}, {
"def": "module://aleth.io/memento/block/txs",
"pageCritical": true
}, {
"def": "module://aleth.io/memento/block/advanced",
"pageCritical": true
}, {
"def": "module://aleth.io/memento/block/logs-bloom",
"pageCritical": true
}]
}
}, {
"def": "page://aleth.io/uncle",
"children": {
"content": [{
"def": "module://aleth.io/memento/uncle/details",
"pageCritical": true
}]
}
}, {
"def": "page://aleth.io/tx",
"children": {
"sidebar": [{
"def": "context://aleth.io/memento/tx/parentBlock",
"children": [{
"def": "module://aleth.io/tx/list"
}]
}],
"content": [{
"def": "context://aleth.io/memento/tx/parentBlock",
"pageCritical": true,
"children": [{
"def": "module://aleth.io/memento/tx/basic",
"children": {
"blockConfirmations": [{
"def": "context://aleth.io/memento/tx/parentBlock",
"children": [{
"def": "module://aleth.io/block/confirmations"
}]
}]
}
}, {
"def": "module://aleth.io/memento/tx/advanced"
}, {
"def": "module://aleth.io/memento/tx/summary"
}, {
"def": "module://aleth.io/memento/tx/payload"
}]
}]
}
}, {
"def": "page://aleth.io/account",
"children": {
"identicon": [{
"def": "module://aleth.io/3box/profile",
"children": {
"fallback": [{ "def": "module://aleth.io/account/identicon" }]
}
}],
"top": [
{ "def": "module://aleth.io/memento/account/details", "pageCritical": true }
],
"bottom": [
{ "def": "module://aleth.io/memento/account/txs" },
{ "def": "module://aleth.io/memento/account/contract" }
]
}
}, {
"def": "page://aleth.io/dashboard",
"children": {
"content": [
{ "def": "module://aleth.io/search" },
{
"def": "context://aleth.io/dashboard/latestBlockRange",
"children": [
{
"def": "module://aleth.io/dashboard/charts",
"children": {
"content": [{
"def": "module://aleth.io/dashboard/blocksChart",
"children": {
"children": [
{
"def": "context://aleth.io/block/latest",
"children": [
{ "def": "module://aleth.io/dashboard/latestBlockInfo" }
]
}
]
}
}]
}
}
]
}
]
}
}],
"rootModules": {
"toolbarTop": [{
"def": "module://aleth.io/toolbar/search"
}],
"toolbarBottom": [{
"def": "module://aleth.io/toolbar/feedback"
}],
"topbar": [{
"def": "module://aleth.io/topbar/search"
}, {
"def": "module://aleth.io/topbar/feedback"
}]
}
}
config.define_bool("evm_explorer", False, "Enable EVM explorer")
evm_explorer = cfg.get("evm_explorer", False)
if evm_explorer:
k8s_yaml_with_ns("devnet/eth-devnet-ui.yaml")
k8s_resource("eth-ui-redis", resource_deps=["eth-devnet"], labels = ["evm"])
k8s_resource("eth-ui-postgres", resource_deps=["eth-devnet"], labels=["evm"])
k8s_resource("eth-ui-memento", resource_deps=["eth-devnet","eth-ui-redis", "eth-ui-postgres"],
objects=['eth-ui-memento:ConfigMap:wormhole'],
port_forwards=[
port_forward(3000, name="frontend [:3000]"),
port_forward(3001, name="api [:3001]"),
],
labels = ["evm"],
)
k8s_resource("eth-ui-explorer", resource_deps=["eth-devnet","eth-ui-redis", "eth-ui-postgres", "eth-ui-memento"],
objects=['eth-ui-explorer:ConfigMap:wormhole'],
port_forwards=[port_forward(3002, name="frontend? [:3002]")],
labels = ["evm"],
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment