-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
scripts to init / rollback the database for e2e tests (#136)
scripts to init / rollback the database for e2e tests loads fixtures by default executes codegen log ps & give the graph node some seconds to spin up upgrades ipfs kubo node adds ipfs configuration to node so it can be used by local websites removes formatting from docker commands container node naming (maybe just mac) consolidated fixture rolling scripts roll zero tty fix renames dump file uses node 18 for gh actions uses an earlier nightly version of foundry stores current snapshot locally Signed-off-by: stadolf <[email protected]> --------- Signed-off-by: Stefan Adolf <[email protected]> Signed-off-by: stadolf <[email protected]>
- Loading branch information
1 parent
c4edb42
commit 81f9157
Showing
8 changed files
with
108 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
SNAPSHOT |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#!/bin/sh | ||
|
||
# https://docs.ipfs.tech/install/run-ipfs-inside-docker/#customizing-your-node | ||
|
||
set -ex | ||
|
||
ipfs config --json API.HTTPHeaders.Access-Control-Allow-Origin '["*"]' | ||
ipfs config --json API.HTTPHeaders.Access-Control-Allow-Methods '["GET", "POST"]' | ||
ipfs config --json API.HTTPHeaders.Access-Control-Allow-Headers '["Authorization"]' | ||
ipfs config --json API.HTTPHeaders.Access-Control-Expose-Headers '["Location"]' | ||
ipfs config --json API.HTTPHeaders.Access-Control-Allow-Credentials '["true"]' | ||
|
||
ipfs config --json Gateway.HTTPHeaders.Access-Control-Allow-Origin '["*"]' | ||
ipfs config --json Gateway.HTTPHeaders.Access-Control-Allow-Methods '["GET", "POST"]' | ||
ipfs config --json Gateway.HTTPHeaders.Access-Control-Allow-Headers '["Authorization"]' | ||
ipfs config --json Gateway.HTTPHeaders.Access-Control-Expose-Headers '["Location"]' | ||
ipfs config --json Gateway.HTTPHeaders.Access-Control-Allow-Credentials '["true"]' | ||
|
||
# https://web3.storage/docs/reference/peering/ | ||
# allows us to also pull w3s content from our local machine | ||
ipfs config --json Peering.Peers '[{"ID": "bafzbeibhqavlasjc7dvbiopygwncnrtvjd2xmryk5laib7zyjor6kf3avm","Addrs": ["/dnsaddr/elastic.dag.house"]}]' | ||
|
||
#https://github.com/ipfs/kubo/blob/master/docs/config.md#implicit-defaults-of-gatewaypublicgateways | ||
#axios is confused with local ipfs subdomains | ||
ipfs config --json Gateway.PublicGateways '{"localhost":{"Paths": ["/ipfs", "/ipns"],"UseSubdomains":false}}' |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
#!/usr/bin/env bash | ||
|
||
if command -v docker-compose &> /dev/null | ||
then | ||
DC="docker-compose" | ||
else | ||
DC="docker compose" | ||
fi | ||
|
||
$DC down --remove-orphans | ||
sleep 5 | ||
$DC up -d | ||
$DC ps | ||
./setupLocal.sh -f | ||
|
||
cd subgraph | ||
yarn prepare:local | ||
yarn codegen | ||
yarn create:local | ||
yarn deploy:local -l v0.0.1 | ||
cd .. | ||
|
||
$DC exec -T postgres pg_dump -Fc -U graph-node -w graph-node -f after_setup.dump | ||
cast rpc evm_snapshot | ||
echo "0x0" > ./deploy/SNAPSHOT | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
#!/usr/bin/env bash | ||
|
||
if command -v docker-compose &> /dev/null | ||
then | ||
DC="docker-compose --ansi=never" | ||
else | ||
DC="docker compose --progress=plain --ansi=never" | ||
fi | ||
|
||
CURRENT_SNAPSHOT=$(<./deploy/SNAPSHOT) | ||
|
||
#todo check whether docker is operational & cast is available here. | ||
|
||
# if [[ "$OSTYPE" == "darwin"* ]]; then | ||
# GRAPH_CONTAINER=ipnft-graph-node-1 | ||
# else | ||
# GRAPH_CONTAINER=ipnft_graph-node_1 | ||
# fi | ||
|
||
#GRAPH_CONTAINER="ipnft_graph-node_1" | ||
|
||
# we can only *wait* for a *container name* but must address the container by its compose service name... | ||
# earn a beer by making this work: | ||
scname=`docker inspect -f '{{.Name}}' $(docker compose ps -q graph-node)` | ||
GRAPH_CONTAINER=${scname:1} | ||
|
||
$DC stop graph-node | ||
docker container wait $GRAPH_CONTAINER | ||
cast rpc evm_revert $CURRENT_SNAPSHOT | ||
|
||
$DC exec -T postgres dropdb -U graph-node -w graph-node | ||
$DC exec -T postgres createdb -U graph-node -w graph-node | ||
$DC exec -T postgres pg_restore -U graph-node -w -d graph-node after_setup.dump | ||
|
||
# alternatively | ||
# $DC exec postgres psql -U graph-node -d postgres -c 'ALTER DATABASE "graph-node" WITH ALLOW_CONNECTIONS false;' | ||
# $DC exec postgres psql -U graph-node -d postgres -c "SELECT pg_terminate_backend(pid) FROM pg_stat_activity WHERE datname='graph-node'"; | ||
# $DC exec postgres psql -U graph-node -d postgres -c 'ALTER DATABASE "graph-node" WITH ALLOW_CONNECTIONS true;' | ||
# $DC restart graph-node | ||
|
||
$DC start graph-node | ||
#wait for graph-node to be alive again | ||
curl --retry-connrefused --retry-all-errors --max-time 30 --retry 10 --retry-delay 3 --retry-max-time 60 http://127.0.0.1:8030 | ||
|
||
cast rpc evm_snapshot > ./deploy/SNAPSHOT | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters