-
Notifications
You must be signed in to change notification settings - Fork 2
/
start-pqs.sh
executable file
·36 lines (29 loc) · 1.09 KB
/
start-pqs.sh
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
#!/usr/bin/env bash
# Copyright (c) 2024 ASX Operations Pty Ltd. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
set -eu
db_name=wallet_views
set +e
psql -h localhost -p 5432 -U postgres -c "drop database $db_name"
set -e
psql -h localhost -p 5432 -U postgres -c "create database $db_name"
# The below command is a workaround due to the fact that when running the script multiple times, flyway (used by scribe)
# may complain about conflicts with the previous versions of the schema
set +e
psql -h localhost -p 5432 -U postgres -c "drop schema public" $db_name
set -e
psql -h localhost -p 5432 -U postgres -c "create schema public" $db_name
nohup $SCRIBE_LOCATION pipeline ledger postgres-document \
--pipeline-filter-parties $(./party-id-from-label.sh WalletOperator) \
--target-postgres-database $db_name \
--health-port 8081 > scribe.log 2>&1 &
scribe_pid=$!
scribe_pg_id=$(ps --pid $scribe_pid -o "pgid" --no-headers)
echo $scribe_pg_id > scribe.pgid
sleep 30s
psql \
-h localhost \
-p 5432 \
-U postgres \
-d $db_name \
-f wallet-views/java/src/main/resources/db/functions.sql