16 lines
684 B
Bash
16 lines
684 B
Bash
#!/bin/bash
|
|
set -e
|
|
|
|
# This file is executed INSIDE the postgres container, but only the very first time
|
|
# the database is created. If any side-effects of this script need to be performed
|
|
# again, execute into the container and try again. There is no need for authentication
|
|
# inside the container, the connection is trusted
|
|
|
|
psql -v ON_ERROR_STOP=1 --username "$POSTGRES_USER" --dbname "$POSTGRES_DB" <<-EOSQL
|
|
CREATE USER zabbix WITH PASSWORD 'zabbix';
|
|
CREATE DATABASE zabbix;
|
|
GRANT ALL PRIVILEGES ON DATABASE zabbix TO zabbix;
|
|
EOSQL
|
|
psql -v ON_ERROR_STOP=1 --username "$POSTGRES_USER" --dbname zabbix <<-EOSQL
|
|
GRANT ALL PRIVILEGES ON SCHEMA public TO zabbix;
|
|
EOSQL
|