-
Notifications
You must be signed in to change notification settings - Fork 124
/
justfile
63 lines (46 loc) · 2.14 KB
/
justfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
default:
just --list --unsorted
db-host := env_var_or_default('DB_HOST', "localhost")
db-port := env_var_or_default('DB_PORT', "5432")
db-user := env_var_or_default('DB_USER', "graph-node")
db-password := env_var_or_default('DB_PASSWORD', "let-me-in")
db-name := env_var_or_default('DB_NAME', "graph-node")
export DATABASE_URL := "postgres://" + db-user + ":" + db-password + "@" + db-host + ":" + db-port + "/" + db-name
docker-name := env_var_or_default('DOCKER_NAME', "bens-postgres")
test-db-port := env_var_or_default('TEST_DB_PORT', "9433")
docker-build *args:
docker build --build-context proto=../proto . {{args}}
start-postgres:
# we run it in --rm mode, so all data will be deleted after stopping
docker run -p {{db-port}}:5432 --name {{docker-name}} -e POSTGRES_PASSWORD={{db-password}} -e POSTGRES_USER={{db-user}} --rm -d postgres -N 500
sleep 3
# wait for postgres to start, but only if db_name is not empty
$SHELL -c '[[ -z "{{db-name}}" ]] || docker exec -it {{docker-name}} psql -U {{db-user}} -c "create database {{db-name}};"'
stop-postgres:
docker rm -f {{docker-name}}
graph-node-start:
docker-compose --file graph-node/docker-compose.yml up -d
sleep 6
./graph-node/rainbow.small.sh
graph-node-clean:
rm -rf graph-node/data
graph-node-stop:
docker-compose --file graph-node/docker-compose.yml down
deploy-subgraph *args:
(cd graph-node/deployer && python3 deployer.py {{args}})
stop-test-postgres:
just docker-name="{{docker-name}}-test" stop-postgres
test *args:
SQLX_OFFLINE=true RUST_LOG=info cargo test {{args}} -- --nocapture
test-with-db *args:
-just stop-test-postgres 2> /dev/null
-just db-port="{{test-db-port}}" db-name="" docker-name="{{docker-name}}-test" start-postgres
just db-port="{{test-db-port}}" db-name="" test {{args}}
add-test-migration name:
sqlx migrate add {{name}} --source bens-logic/tests/migrations/
benchmark:
cargo run --example resolve_benchmark
run:
cargo run --bin bens-server
run-dev:
dotenv -e .env.dev -- just run