Merge pull request #101 from flashbots/mev-backfill
Add `mev` command for easy inspect use
This commit is contained in:
commit
24951891ca
1
Tiltfile
1
Tiltfile
@ -16,6 +16,7 @@ k8s_yaml(configmap_from_dict("mev-inspect-rpc", inputs = {
|
|||||||
k8s_yaml(secret_from_dict("mev-inspect-db-credentials", inputs = {
|
k8s_yaml(secret_from_dict("mev-inspect-db-credentials", inputs = {
|
||||||
"username" : "postgres",
|
"username" : "postgres",
|
||||||
"password": "password",
|
"password": "password",
|
||||||
|
"host": "postgresql",
|
||||||
}))
|
}))
|
||||||
|
|
||||||
docker_build_with_restart("mev-inspect-py", ".",
|
docker_build_with_restart("mev-inspect-py", ".",
|
||||||
|
@ -19,6 +19,11 @@ spec:
|
|||||||
image: mev-inspect-py
|
image: mev-inspect-py
|
||||||
command: [ "/app/entrypoint.sh" ]
|
command: [ "/app/entrypoint.sh" ]
|
||||||
env:
|
env:
|
||||||
|
- name: POSTGRES_HOST
|
||||||
|
valueFrom:
|
||||||
|
secretKeyRef:
|
||||||
|
name: mev-inspect-db-credentials
|
||||||
|
key: host
|
||||||
- name: POSTGRES_USER
|
- name: POSTGRES_USER
|
||||||
valueFrom:
|
valueFrom:
|
||||||
secretKeyRef:
|
secretKeyRef:
|
||||||
@ -29,8 +34,6 @@ spec:
|
|||||||
secretKeyRef:
|
secretKeyRef:
|
||||||
name: mev-inspect-db-credentials
|
name: mev-inspect-db-credentials
|
||||||
key: password
|
key: password
|
||||||
- name: POSTGRES_HOST
|
|
||||||
value: postgresql
|
|
||||||
- name: RPC_URL
|
- name: RPC_URL
|
||||||
valueFrom:
|
valueFrom:
|
||||||
configMapKeyRef:
|
configMapKeyRef:
|
||||||
|
41
mev
Executable file
41
mev
Executable file
@ -0,0 +1,41 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
DB_NAME=mev_inspect
|
||||||
|
|
||||||
|
function get_kube_db_secret(){
|
||||||
|
kubectl get secrets mev-inspect-db-credentials -o jsonpath="{.data.$1}" | base64 --decode
|
||||||
|
}
|
||||||
|
|
||||||
|
function db(){
|
||||||
|
host=$(get_kube_db_secret "host")
|
||||||
|
username=$(get_kube_db_secret "username")
|
||||||
|
password=$(get_kube_db_secret "password")
|
||||||
|
|
||||||
|
kubectl run -i --rm --tty postgres-client \
|
||||||
|
--env="PGPASSWORD=$password" \
|
||||||
|
--image=jbergknoff/postgresql-client \
|
||||||
|
-- $DB_NAME --host=$host --user=$username
|
||||||
|
}
|
||||||
|
|
||||||
|
case "$1" in
|
||||||
|
db)
|
||||||
|
echo "Connecting to $DB_NAME"
|
||||||
|
db
|
||||||
|
;;
|
||||||
|
inspect)
|
||||||
|
block_number=$2
|
||||||
|
echo "Inspecting block $block_number"
|
||||||
|
kubectl exec -ti deploy/mev-inspect-deployment -- poetry run inspect-block $block_number
|
||||||
|
;;
|
||||||
|
test)
|
||||||
|
echo "Running tests"
|
||||||
|
kubectl exec -ti deploy/mev-inspect-deployment -- poetry run pytest tests
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "Usage: "$1" {inspect|test}"
|
||||||
|
exit 1
|
||||||
|
esac
|
||||||
|
|
||||||
|
exit 0
|
Loading…
x
Reference in New Issue
Block a user