Skip to content

Commit

Permalink
Simplify postgres setup
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Matthias Guenzel committed Jun 19, 2024
1 parent 50159c0 commit 367e73e
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 9 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/bash
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 hstore;
EOSQL
7 changes: 0 additions & 7 deletions configuration/postgresql/initdb/001-init-chirpstack.sh

This file was deleted.

4 changes: 3 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,9 @@ services:
- ./configuration/postgresql/initdb:/docker-entrypoint-initdb.d
- postgresqldata:/var/lib/postgresql/data
environment:
- POSTGRES_PASSWORD=root
- POSTGRES_USER=chirpstack
- POSTGRES_PASSWORD=chirpstack
- POSTGRES_DB=chirpstack

redis:
image: redis:7-alpine
Expand Down

0 comments on commit 367e73e

Please sign in to comment.