forked from blockscout/blockscout-rs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjustfile
53 lines (37 loc) · 1.95 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
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', "postgres")
db-password := env_var_or_default('DB_PASSWORD', "admin")
db-name := env_var_or_default('DB_NAME', "da_indexer")
export DATABASE_URL := "postgres://" + db-user + ":" + db-password + "@" + db-host + ":" + db-port + "/" + db-name
docker-name := env_var_or_default('DOCKER_NAME', "da-indexer-postgres")
test-db-port := env_var_or_default('TEST_DB_PORT', "9433")
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 postgres -c "create database {{db-name}};"'
stop-postgres:
docker kill {{docker-name}}
test *args:
cargo test {{args}} -- --include-ignored
test-with-db *args:
-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}}
stop-test-postgres:
just docker-name="{{docker-name}}-test" stop-postgres
run:
DA_INDEXER__DATABASE__CONNECT__URL={{DATABASE_URL}} DA_INDEXER__CONFIG=./da-indexer-server/config/celestia.toml cargo run --bin da-indexer-server
run-celestia-router:
DA_INDEXER__CONFIG=./da-indexer-server/config/celestia_standalone_router.toml cargo run --bin da-indexer-server
generate-entities:
sea-orm-cli generate entity --lib -o da-indexer-entity/src
new-migration name:
sea-orm-cli migrate generate -d da-indexer-migration {{name}}
migrate-up:
sea-orm-cli migrate -d da-indexer-migration up
migrate-down:
sea-orm-cli migrate -d da-indexer-migration down