Skip to content

Commit 7eec058

Browse files
committed
Use init.sh to create stellar user and core/horizon db at startup
1 parent 14507f6 commit 7eec058

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

Dockerfile

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
FROM postgres:9.6
2+
3+
COPY init.sh /docker-entrypoint-initdb.d/

init.sh

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#!/bin/bash
2+
set -ue
3+
4+
psql -v ON_ERROR_STOP=1 --username "${POSTGRES_USER}" <<-EOSQL
5+
CREATE USER ${STELLAR_DB_USER} WITH PASSWORD '${STELLAR_DB_PASSWORD}';
6+
CREATE DATABASE core;
7+
CREATE DATABASE horizon;
8+
GRANT ALL PRIVILEGES ON DATABASE core TO ${STELLAR_DB_USER};
9+
GRANT ALL PRIVILEGES ON DATABASE horizon TO ${STELLAR_DB_USER};
10+
EOSQL

0 commit comments

Comments
 (0)