-
Notifications
You must be signed in to change notification settings - Fork 0
/
init-db.sh
executable file
·21 lines (18 loc) · 1.1 KB
/
init-db.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#!/bin/bash
# PROGNAME=$(basename $0)
# RELEASE="Revision 1.0"
# AUTHOR="Paul Bargewell <[email protected]>"
# COPYTRIGHT="Copyright 2021, Opus Vision Limited T/A OpusVL"
# LICENSE="SPDX-License-Identifier: AGPL-3.0-or-later"
set -e
psql -v ON_ERROR_STOP=1 --username "$POSTGRES_USER" --dbname "$POSTGRES_DB" <<-EOSQL
CREATE USER ${KEYCLOAK_POSTGRES_USER} WITH ENCRYPTED PASSWORD '${KEYCLOAK_POSTGRES_PASSWORD}' CREATEDB;
CREATE DATABASE ${KEYCLOAK_DATABASE} OWNER=${KEYCLOAK_POSTGRES_USER};
GRANT ALL PRIVILEGES ON DATABASE ${KEYCLOAK_DATABASE} TO ${KEYCLOAK_POSTGRES_USER};
CREATE USER ${MOVIM_POSTGRES_USER} WITH ENCRYPTED PASSWORD '${MOVIM_POSTGRES_PASSWORD}' CREATEDB;
CREATE DATABASE ${MOVIM_DATABASE} OWNER=${MOVIM_POSTGRES_USER};
GRANT ALL PRIVILEGES ON DATABASE ${MOVIM_DATABASE} TO ${MOVIM_POSTGRES_USER};
CREATE USER ${PROSODY_POSTGRES_USER} WITH ENCRYPTED PASSWORD '${PROSODY_POSTGRES_PASSWORD}' CREATEDB;
CREATE DATABASE ${PROSODY_DATABASE} OWNER=${PROSODY_POSTGRES_USER};
GRANT ALL PRIVILEGES ON DATABASE ${PROSODY_DATABASE} TO ${PROSODY_POSTGRES_USER};
EOSQL