A db/config/pg/inputrc => db/config/pg/inputrc +25 -0
@@ 0,0 1,25 @@
+# use vi key bindings, see
+# http://blog.sanctum.geek.nz/vi-mode-in-bash/
+set editing-mode vi
+
+# show mode, see
+# http://stackoverflow.com/questions/1039713/different-bash-prompt-for-different-vi-editing-mode
+set show-mode-in-prompt on
+# https://stackoverflow.com/questions/7888387/the-way-to-distinguish-command-mode-and-insert-mode-in-bashs-vi-command-line-ed
+set vi-ins-mode-string "+"
+set vi-cmd-mode-string ":"
+
+# smarter tab completion, see
+# http://mrzool.cc/writing/sensible-bash/
+set completion-ignore-case on
+set completion-map-case on
+set show-all-if-ambiguous on
+
+# arrow up
+"\e[A":history-search-backward
+# arrow down
+"\e[B":history-search-forward
+
+# no bell sound
+set bell-style none
+
A db/config/pg/psqlrc => db/config/pg/psqlrc +17 -0
@@ 0,0 1,17 @@
+--
+-- system-wide psql configuration file
+--
+-- This file is read before the .psqlrc file in the user's home directory.
+--
+-- Copy this to your installation's sysconf directory and rename it psqlrc.
+-- The sysconf directory can be identified via "pg_config --sysconfdir".
+--
+
+-- See https://www.digitalocean.com/community/tutorials/how-to-customize-the-postgresql-prompt-with-psqlrc-on-ubuntu-14-04
+
+\set PROMPT1 '%M:%> %n@%/%R%#%x '
+\set PROMPT2 '%R %# '
+\pset null 'ΓΈ'
+\set COMP_KEYWORD_CASE upper
+\x auto
+\set QUIET 0
M docker-compose.yml => docker-compose.yml +2 -0
@@ 12,6 12,8 @@ services:
- POSTGRES_INITDB_ARGS=--encoding=UTF8 --locale=en_US
volumes:
- ./db/config/pg/pg.conf:/etc/postgresql/postgresql.conf:ro
+ - ./db/config/pg/psqlrc:/usr/local/etc/postgresql/psqlrc:ro
+ - ./db/config/pg/inputrc:/etc/inputrc:ro
- ./db/data/pg:/var/lib/postgresql/data
secrets:
- root_pwd
A scripts/sh.sh => scripts/sh.sh +15 -0
@@ 0,0 1,15 @@
+#!/usr/bin/env bash
+
+set -euo pipefail
+
+function run {
+ local pwd=""; pwd="$(pwd)"
+ if [[ ${pwd} != *hockeypg ]]; then
+ echo "must be run from the root of the repository"
+ exit 1
+ fi
+
+ docker-compose exec db bash
+}
+
+run