Skip to content

Commit

Permalink
[#1] Init db and pgadmin
Browse files Browse the repository at this point in the history
  • Loading branch information
wayangalihpratama committed Aug 29, 2023
1 parent 2aeee0a commit 3b8754c
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 0 deletions.
12 changes: 12 additions & 0 deletions db/docker-entrypoint-initdb.d/000-init.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
CREATE USER akvo WITH CREATEDB PASSWORD 'password';

CREATE DATABASE "afs"
WITH OWNER = akvo
TEMPLATE = template0
ENCODING = 'UTF8'
LC_COLLATE = 'en_US.UTF-8'
LC_CTYPE = 'en_US.UTF-8';

\c afs

CREATE EXTENSION IF NOT EXISTS ltree WITH SCHEMA public;
6 changes: 6 additions & 0 deletions db/script/dump-db.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/usr/bin/env bash
#shellcheck disable=SC2016

set -eu

docker-compose exec -T db bash -c 'pg_dump --user akvo --clean --create --format plain afs > /docker-entrypoint-initdb.d/001-init.sql; echo "Export done"'
18 changes: 18 additions & 0 deletions pgadmin4/servers.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"Servers": {
"1": {
"Name": "db",
"Group": "Servers",
"Host": "db",
"Port": 5432,
"MaintenanceDB": "postgres",
"Username": "postgres",
"SSLMode": "allow",
"SSLCompression": 0,
"Timeout": 10,
"UseSSHTunnel": 0,
"TunnelPort": "22",
"TunnelAuthentication": 0
}
}
}

0 comments on commit 3b8754c

Please sign in to comment.