summaryrefslogtreecommitdiffstats
path: root/openecomp-be/dist/sdc-onboard-db-init-docker/artifacts/startup.sh
blob: 2f398b2f916456f21c6514e5c96be42c27afbc20 (plain)
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
#!/bin/bash

cd /home/sdc

CS_PORT=""
CS_HOST=127.0.0.1

if [ ! -z "${CS_HOST_IP}" ]; then
    CS_HOST=$CS_HOST_IP
fi

if [ ! -z "${CS_HOST_PORT}" ]; then
    CS_PORT=$CS_HOST_PORT
fi

echo "[Info] Going to initialize sdc onboard cassandra: user=$SDC_USER; host=$CS_HOST; port=$CS_PORT"

echo "[Info] Initializing onboard keyspaces"
date;
cqlsh -u $SDC_USER -p $SDC_PASSWORD -f init_keyspaces.cql $CS_HOST $CS_PORT
rc=$?
date;

if [[ $rc != 0 ]]; then
	echo "[Error] Failed to initialize onboard keyspaces";
	exit $rc;
fi

echo "[Info] Initializing onboard schemas"
date;
cqlsh -u $SDC_USER -p $SDC_PASSWORD -f init_schemas.cql $CS_HOST $CS_PORT
rc=$?
date;

if [[ $rc != 0 ]]; then
	echo "[Error] Failed to initialize onboard schemas";
	exit $rc;
fi