item-atlas/deploy/local/init-db.sh

13 lines
568 B
Bash
Executable File

#!/bin/sh
set -eu
psql --username postgres --dbname postgres --set ON_ERROR_STOP=1 \
--set inventory_password="$ATLAS_INVENTORY_DB_PASSWORD" \
--set intake_password="$ATLAS_INTAKE_DB_PASSWORD" <<'SQL'
CREATE ROLE atlas_inventory LOGIN PASSWORD :'inventory_password';
CREATE ROLE atlas_intake LOGIN PASSWORD :'intake_password';
CREATE DATABASE itematlas_inventory OWNER atlas_inventory;
CREATE DATABASE itematlas_intake OWNER atlas_intake;
REVOKE CONNECT ON DATABASE itematlas_inventory FROM PUBLIC;
REVOKE CONNECT ON DATABASE itematlas_intake FROM PUBLIC;
SQL