commit
a9263d6008
18
README.md
18
README.md
@ -37,7 +37,7 @@ Example:
|
|||||||
export RPC_URL="http://111.111.111.111:8546"
|
export RPC_URL="http://111.111.111.111:8546"
|
||||||
```
|
```
|
||||||
|
|
||||||
**Note: mev-inspect-py currently requires an RPC with support for OpenEthereum / Erigon traces (not geth 😔)**
|
**Note: mev-inspect-py currently requires an RPC with support for Erigon traces and receipts (not geth 😔)**
|
||||||
|
|
||||||
Next, start all services with:
|
Next, start all services with:
|
||||||
```
|
```
|
||||||
@ -48,7 +48,7 @@ Press "space" to see a browser of the services starting up
|
|||||||
|
|
||||||
On first startup, you'll need to apply database migrations. Apply with:
|
On first startup, you'll need to apply database migrations. Apply with:
|
||||||
```
|
```
|
||||||
kubectl exec deploy/mev-inspect-deployment -- alembic upgrade head
|
kubectl exec deploy/mev-inspect -- alembic upgrade head
|
||||||
```
|
```
|
||||||
|
|
||||||
## Inspecting
|
## Inspecting
|
||||||
@ -57,21 +57,21 @@ kubectl exec deploy/mev-inspect-deployment -- alembic upgrade head
|
|||||||
|
|
||||||
Inspecting block [12914944](https://twitter.com/mevalphaleak/status/1420416437575901185)
|
Inspecting block [12914944](https://twitter.com/mevalphaleak/status/1420416437575901185)
|
||||||
```
|
```
|
||||||
kubectl exec deploy/mev-inspect-deployment -- poetry run inspect-block 12914944
|
kubectl exec deploy/mev-inspect -- poetry run inspect-block 12914944
|
||||||
```
|
```
|
||||||
|
|
||||||
### Inspect many blocks
|
### Inspect many blocks
|
||||||
|
|
||||||
Inspecting blocks 12914944 to 12914954
|
Inspecting blocks 12914944 to 12914954
|
||||||
```
|
```
|
||||||
kubectl exec deploy/mev-inspect-deployment -- poetry run inspect-many-blocks 12914944 12914954
|
kubectl exec deploy/mev-inspect -- poetry run inspect-many-blocks 12914944 12914954
|
||||||
```
|
```
|
||||||
|
|
||||||
### Inspect all incoming blocks
|
### Inspect all incoming blocks
|
||||||
|
|
||||||
Start a block listener with
|
Start a block listener with
|
||||||
```
|
```
|
||||||
kubectl exec deploy/mev-inspect-deployment -- /app/listener start
|
kubectl exec deploy/mev-inspect -- /app/listener start
|
||||||
```
|
```
|
||||||
|
|
||||||
By default, it will pick up wherever you left off.
|
By default, it will pick up wherever you left off.
|
||||||
@ -79,12 +79,12 @@ If running for the first time, listener starts at the latest block
|
|||||||
|
|
||||||
See logs for the listener with
|
See logs for the listener with
|
||||||
```
|
```
|
||||||
kubectl exec deploy/mev-inspect-deployment -- tail -f listener.log
|
kubectl exec deploy/mev-inspect -- tail -f listener.log
|
||||||
```
|
```
|
||||||
|
|
||||||
And stop the listener with
|
And stop the listener with
|
||||||
```
|
```
|
||||||
kubectl exec deploy/mev-inspect-deployment -- /app/listener stop
|
kubectl exec deploy/mev-inspect -- /app/listener stop
|
||||||
```
|
```
|
||||||
|
|
||||||
## Exploring
|
## Exploring
|
||||||
@ -143,7 +143,7 @@ poetry run pre-commit install
|
|||||||
|
|
||||||
Run tests with
|
Run tests with
|
||||||
```
|
```
|
||||||
kubectl exec deploy/mev-inspect-deployment -- poetry run pytest --cov=mev_inspect tests
|
kubectl exec deploy/mev-inspect -- poetry run pytest --cov=mev_inspect tests
|
||||||
```
|
```
|
||||||
|
|
||||||
## FAQ
|
## FAQ
|
||||||
@ -167,7 +167,7 @@ tilt up
|
|||||||
|
|
||||||
And rerun migrations to create the tables again
|
And rerun migrations to create the tables again
|
||||||
```
|
```
|
||||||
kubectl exec deploy/mev-inspect-deployment -- alembic upgrade head
|
kubectl exec deploy/mev-inspect -- alembic upgrade head
|
||||||
```
|
```
|
||||||
|
|
||||||
### I was using the docker-compose setup and want to switch to kube, now what?
|
### I was using the docker-compose setup and want to switch to kube, now what?
|
||||||
|
4
Tiltfile
4
Tiltfile
@ -27,5 +27,5 @@ docker_build_with_restart("mev-inspect-py", ".",
|
|||||||
trigger="./pyproject.toml"),
|
trigger="./pyproject.toml"),
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
k8s_yaml("k8s/app.yaml")
|
k8s_yaml(helm('./k8s/mev-inspect', name='mev-inspect'))
|
||||||
k8s_resource(workload="mev-inspect-deployment", resource_deps=["postgresql-postgresql"])
|
k8s_resource(workload="mev-inspect", resource_deps=["postgresql-postgresql"])
|
||||||
|
48
k8s/app.yaml
48
k8s/app.yaml
@ -1,48 +0,0 @@
|
|||||||
apiVersion: apps/v1
|
|
||||||
kind: Deployment
|
|
||||||
metadata:
|
|
||||||
name: mev-inspect-deployment
|
|
||||||
labels:
|
|
||||||
app: mev-inspect
|
|
||||||
spec:
|
|
||||||
replicas: 1
|
|
||||||
selector:
|
|
||||||
matchLabels:
|
|
||||||
app: mev-inspect
|
|
||||||
template:
|
|
||||||
metadata:
|
|
||||||
labels:
|
|
||||||
app: mev-inspect
|
|
||||||
spec:
|
|
||||||
containers:
|
|
||||||
- name: mev-inspect
|
|
||||||
image: mev-inspect-py
|
|
||||||
command: [ "/app/entrypoint.sh" ]
|
|
||||||
env:
|
|
||||||
- name: POSTGRES_HOST
|
|
||||||
valueFrom:
|
|
||||||
secretKeyRef:
|
|
||||||
name: mev-inspect-db-credentials
|
|
||||||
key: host
|
|
||||||
- name: POSTGRES_USER
|
|
||||||
valueFrom:
|
|
||||||
secretKeyRef:
|
|
||||||
name: mev-inspect-db-credentials
|
|
||||||
key: username
|
|
||||||
- name: POSTGRES_PASSWORD
|
|
||||||
valueFrom:
|
|
||||||
secretKeyRef:
|
|
||||||
name: mev-inspect-db-credentials
|
|
||||||
key: password
|
|
||||||
- name: RPC_URL
|
|
||||||
valueFrom:
|
|
||||||
configMapKeyRef:
|
|
||||||
name: mev-inspect-rpc
|
|
||||||
key: url
|
|
||||||
livenessProbe:
|
|
||||||
exec:
|
|
||||||
command:
|
|
||||||
- ls
|
|
||||||
- /
|
|
||||||
initialDelaySeconds: 20
|
|
||||||
periodSeconds: 5
|
|
23
k8s/mev-inspect/.helmignore
Normal file
23
k8s/mev-inspect/.helmignore
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
# Patterns to ignore when building packages.
|
||||||
|
# This supports shell glob matching, relative path matching, and
|
||||||
|
# negation (prefixed with !). Only one pattern per line.
|
||||||
|
.DS_Store
|
||||||
|
# Common VCS dirs
|
||||||
|
.git/
|
||||||
|
.gitignore
|
||||||
|
.bzr/
|
||||||
|
.bzrignore
|
||||||
|
.hg/
|
||||||
|
.hgignore
|
||||||
|
.svn/
|
||||||
|
# Common backup files
|
||||||
|
*.swp
|
||||||
|
*.bak
|
||||||
|
*.tmp
|
||||||
|
*.orig
|
||||||
|
*~
|
||||||
|
# Various IDEs
|
||||||
|
.project
|
||||||
|
.idea/
|
||||||
|
*.tmproj
|
||||||
|
.vscode/
|
24
k8s/mev-inspect/Chart.yaml
Normal file
24
k8s/mev-inspect/Chart.yaml
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
apiVersion: v2
|
||||||
|
name: mev-inspect
|
||||||
|
description: A Helm chart for Kubernetes
|
||||||
|
|
||||||
|
# A chart can be either an 'application' or a 'library' chart.
|
||||||
|
#
|
||||||
|
# Application charts are a collection of templates that can be packaged into versioned archives
|
||||||
|
# to be deployed.
|
||||||
|
#
|
||||||
|
# Library charts provide useful utilities or functions for the chart developer. They're included as
|
||||||
|
# a dependency of application charts to inject those utilities and functions into the rendering
|
||||||
|
# pipeline. Library charts do not define any templates and therefore cannot be deployed.
|
||||||
|
type: application
|
||||||
|
|
||||||
|
# This is the chart version. This version number should be incremented each time you make changes
|
||||||
|
# to the chart and its templates, including the app version.
|
||||||
|
# Versions are expected to follow Semantic Versioning (https://semver.org/)
|
||||||
|
version: 0.1.0
|
||||||
|
|
||||||
|
# This is the version number of the application being deployed. This version number should be
|
||||||
|
# incremented each time you make changes to the application. Versions are not expected to
|
||||||
|
# follow Semantic Versioning. They should reflect the version the application is using.
|
||||||
|
# It is recommended to use it with quotes.
|
||||||
|
appVersion: "1.16.0"
|
62
k8s/mev-inspect/templates/_helpers.tpl
Normal file
62
k8s/mev-inspect/templates/_helpers.tpl
Normal file
@ -0,0 +1,62 @@
|
|||||||
|
{{/*
|
||||||
|
Expand the name of the chart.
|
||||||
|
*/}}
|
||||||
|
{{- define "mev-inspect.name" -}}
|
||||||
|
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
|
||||||
|
{{- end }}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Create a default fully qualified app name.
|
||||||
|
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
|
||||||
|
If release name contains chart name it will be used as a full name.
|
||||||
|
*/}}
|
||||||
|
{{- define "mev-inspect.fullname" -}}
|
||||||
|
{{- if .Values.fullnameOverride }}
|
||||||
|
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
|
||||||
|
{{- else }}
|
||||||
|
{{- $name := default .Chart.Name .Values.nameOverride }}
|
||||||
|
{{- if contains $name .Release.Name }}
|
||||||
|
{{- .Release.Name | trunc 63 | trimSuffix "-" }}
|
||||||
|
{{- else }}
|
||||||
|
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Create chart name and version as used by the chart label.
|
||||||
|
*/}}
|
||||||
|
{{- define "mev-inspect.chart" -}}
|
||||||
|
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
|
||||||
|
{{- end }}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Common labels
|
||||||
|
*/}}
|
||||||
|
{{- define "mev-inspect.labels" -}}
|
||||||
|
helm.sh/chart: {{ include "mev-inspect.chart" . }}
|
||||||
|
{{ include "mev-inspect.selectorLabels" . }}
|
||||||
|
{{- if .Chart.AppVersion }}
|
||||||
|
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
|
||||||
|
{{- end }}
|
||||||
|
app.kubernetes.io/managed-by: {{ .Release.Service }}
|
||||||
|
{{- end }}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Selector labels
|
||||||
|
*/}}
|
||||||
|
{{- define "mev-inspect.selectorLabels" -}}
|
||||||
|
app.kubernetes.io/name: {{ include "mev-inspect.name" . }}
|
||||||
|
app.kubernetes.io/instance: {{ .Release.Name }}
|
||||||
|
{{- end }}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Create the name of the service account to use
|
||||||
|
*/}}
|
||||||
|
{{- define "mev-inspect.serviceAccountName" -}}
|
||||||
|
{{- if .Values.serviceAccount.create }}
|
||||||
|
{{- default (include "mev-inspect.fullname" .) .Values.serviceAccount.name }}
|
||||||
|
{{- else }}
|
||||||
|
{{- default "default" .Values.serviceAccount.name }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
74
k8s/mev-inspect/templates/deployment.yaml
Normal file
74
k8s/mev-inspect/templates/deployment.yaml
Normal file
@ -0,0 +1,74 @@
|
|||||||
|
apiVersion: apps/v1
|
||||||
|
kind: Deployment
|
||||||
|
metadata:
|
||||||
|
name: {{ include "mev-inspect.fullname" . }}
|
||||||
|
labels:
|
||||||
|
{{- include "mev-inspect.labels" . | nindent 4 }}
|
||||||
|
spec:
|
||||||
|
replicas: 1
|
||||||
|
selector:
|
||||||
|
matchLabels:
|
||||||
|
{{- include "mev-inspect.selectorLabels" . | nindent 6 }}
|
||||||
|
template:
|
||||||
|
metadata:
|
||||||
|
{{- with .Values.podAnnotations }}
|
||||||
|
annotations:
|
||||||
|
{{- toYaml . | nindent 8 }}
|
||||||
|
{{- end }}
|
||||||
|
labels:
|
||||||
|
{{- include "mev-inspect.selectorLabels" . | nindent 8 }}
|
||||||
|
spec:
|
||||||
|
{{- with .Values.imagePullSecrets }}
|
||||||
|
imagePullSecrets:
|
||||||
|
{{- toYaml . | nindent 8 }}
|
||||||
|
{{- end }}
|
||||||
|
securityContext:
|
||||||
|
{{- toYaml .Values.podSecurityContext | nindent 8 }}
|
||||||
|
containers:
|
||||||
|
- name: {{ .Chart.Name }}
|
||||||
|
securityContext:
|
||||||
|
{{- toYaml .Values.securityContext | nindent 12 }}
|
||||||
|
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
|
||||||
|
imagePullPolicy: {{ .Values.image.pullPolicy }}
|
||||||
|
livenessProbe:
|
||||||
|
exec:
|
||||||
|
command:
|
||||||
|
- ls
|
||||||
|
- /
|
||||||
|
initialDelaySeconds: 20
|
||||||
|
periodSeconds: 5
|
||||||
|
resources:
|
||||||
|
{{- toYaml .Values.resources | nindent 12 }}
|
||||||
|
env:
|
||||||
|
- name: POSTGRES_HOST
|
||||||
|
valueFrom:
|
||||||
|
secretKeyRef:
|
||||||
|
name: mev-inspect-db-credentials
|
||||||
|
key: host
|
||||||
|
- name: POSTGRES_USER
|
||||||
|
valueFrom:
|
||||||
|
secretKeyRef:
|
||||||
|
name: mev-inspect-db-credentials
|
||||||
|
key: username
|
||||||
|
- name: POSTGRES_PASSWORD
|
||||||
|
valueFrom:
|
||||||
|
secretKeyRef:
|
||||||
|
name: mev-inspect-db-credentials
|
||||||
|
key: password
|
||||||
|
- name: RPC_URL
|
||||||
|
valueFrom:
|
||||||
|
configMapKeyRef:
|
||||||
|
name: mev-inspect-rpc
|
||||||
|
key: url
|
||||||
|
{{- with .Values.nodeSelector }}
|
||||||
|
nodeSelector:
|
||||||
|
{{- toYaml . | nindent 8 }}
|
||||||
|
{{- end }}
|
||||||
|
{{- with .Values.affinity }}
|
||||||
|
affinity:
|
||||||
|
{{- toYaml . | nindent 8 }}
|
||||||
|
{{- end }}
|
||||||
|
{{- with .Values.tolerations }}
|
||||||
|
tolerations:
|
||||||
|
{{- toYaml . | nindent 8 }}
|
||||||
|
{{- end }}
|
43
k8s/mev-inspect/values.yaml
Normal file
43
k8s/mev-inspect/values.yaml
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
# Default values for mev-inspect.
|
||||||
|
# This is a YAML-formatted file.
|
||||||
|
# Declare variables to be passed into your templates.
|
||||||
|
|
||||||
|
image:
|
||||||
|
repository: mev-inspect-py
|
||||||
|
pullPolicy: IfNotPresent
|
||||||
|
tag: "latest"
|
||||||
|
|
||||||
|
imagePullSecrets: []
|
||||||
|
nameOverride: ""
|
||||||
|
fullnameOverride: ""
|
||||||
|
|
||||||
|
podAnnotations: {}
|
||||||
|
|
||||||
|
podSecurityContext: {}
|
||||||
|
# fsGroup: 2000
|
||||||
|
|
||||||
|
securityContext: {}
|
||||||
|
# capabilities:
|
||||||
|
# drop:
|
||||||
|
# - ALL
|
||||||
|
# readOnlyRootFilesystem: true
|
||||||
|
# runAsNonRoot: true
|
||||||
|
# runAsUser: 1000
|
||||||
|
|
||||||
|
resources: {}
|
||||||
|
# We usually recommend not to specify default resources and to leave this as a conscious
|
||||||
|
# choice for the user. This also increases chances charts run on environments with little
|
||||||
|
# resources, such as Minikube. If you do want to specify resources, uncomment the following
|
||||||
|
# lines, adjust them as necessary, and remove the curly braces after 'resources:'.
|
||||||
|
# limits:
|
||||||
|
# cpu: 100m
|
||||||
|
# memory: 128Mi
|
||||||
|
# requests:
|
||||||
|
# cpu: 100m
|
||||||
|
# memory: 128Mi
|
||||||
|
|
||||||
|
nodeSelector: {}
|
||||||
|
|
||||||
|
tolerations: []
|
||||||
|
|
||||||
|
affinity: {}
|
4
mev
4
mev
@ -27,11 +27,11 @@ case "$1" in
|
|||||||
inspect)
|
inspect)
|
||||||
block_number=$2
|
block_number=$2
|
||||||
echo "Inspecting block $block_number"
|
echo "Inspecting block $block_number"
|
||||||
kubectl exec -ti deploy/mev-inspect-deployment -- poetry run inspect-block $block_number
|
kubectl exec -ti deploy/mev-inspect -- poetry run inspect-block $block_number
|
||||||
;;
|
;;
|
||||||
test)
|
test)
|
||||||
echo "Running tests"
|
echo "Running tests"
|
||||||
kubectl exec -ti deploy/mev-inspect-deployment -- poetry run pytest tests
|
kubectl exec -ti deploy/mev-inspect -- poetry run pytest tests
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
echo "Usage: "$1" {inspect|test}"
|
echo "Usage: "$1" {inspect|test}"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user