Simplify postgres setup
If POSTGRES_USER, POSTGRES_PASSWORD and POSTGRES_DB are set, the postgres container automatically creates the database and role with the set name and password.
This commit is contained in:
parent
50159c0e19
commit
07ba67ce41
@ -1,7 +1,7 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
psql -v ON_ERROR_STOP=1 --username "$POSTGRES_USER" --dbname="chirpstack" <<-EOSQL
|
psql -v ON_ERROR_STOP=1 --username "$POSTGRES_USER" --dbname="$POSTGRES_DB" <<-EOSQL
|
||||||
create extension pg_trgm;
|
create extension pg_trgm;
|
||||||
create extension hstore;
|
create extension hstore;
|
||||||
EOSQL
|
EOSQL
|
@ -1,7 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
set -e
|
|
||||||
|
|
||||||
psql -v ON_ERROR_STOP=1 --username "$POSTGRES_USER" <<-EOSQL
|
|
||||||
create role chirpstack with login password 'chirpstack';
|
|
||||||
create database chirpstack with owner chirpstack;
|
|
||||||
EOSQL
|
|
@ -60,7 +60,9 @@ services:
|
|||||||
- ./configuration/postgresql/initdb:/docker-entrypoint-initdb.d
|
- ./configuration/postgresql/initdb:/docker-entrypoint-initdb.d
|
||||||
- postgresqldata:/var/lib/postgresql/data
|
- postgresqldata:/var/lib/postgresql/data
|
||||||
environment:
|
environment:
|
||||||
- POSTGRES_PASSWORD=root
|
- POSTGRES_USER=chirpstack
|
||||||
|
- POSTGRES_PASSWORD=chirpstack
|
||||||
|
- POSTGRES_DB=chirpstack
|
||||||
|
|
||||||
redis:
|
redis:
|
||||||
image: redis:7-alpine
|
image: redis:7-alpine
|
||||||
|
Loading…
Reference in New Issue
Block a user