forked from folio-org/mod-inventory-storage
-
Notifications
You must be signed in to change notification settings - Fork 0
/
start-managed-demo.sh
executable file
·46 lines (32 loc) · 1.21 KB
/
start-managed-demo.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
37
38
39
40
41
42
43
44
45
46
#!/usr/bin/env bash
storage=${1:-"external"}
okapi_proxy_address=${2:-http://localhost:9130}
create_environment_variable() {
environment_value_json_file=${1:-}
environment_json=$(cat ${environment_value_json_file})
curl -w '\n' -X POST -D - \
-H "Content-type: application/json" \
-d "${environment_json}" \
"${okapi_proxy_address}/_/env"
}
echo "Check if Okapi is contactable"
curl -w '\n' -X GET -D - \
"${okapi_proxy_address}/_/env" || exit 1
echo "Building Inventory Storage"
mvn package -q -Dmaven.test.skip=true || exit 1
echo "Creating Tenant"
./create-tenant.sh
if [ "${storage}" = "external" ]; then
echo "Running Inventory Storage module using external PostgreSQL storage"
# setup Okapi environment variables
create_environment_variable ./okapi-setup/environment/db-host.json
create_environment_variable ./okapi-setup/environment/db-port.json
./setup-demo-db.sh
./register-managed.sh target/DeploymentDescriptor-environment.json
elif [ "${storage}" = "embedded" ]; then
echo "Running Inventory Storage module using embedded PostgreSQL storage"
./register-managed.sh target/DeploymentDescriptor.json
else
echo "Unknown storage mechanism: ${storage}"
exit 1
fi