[RFC PATCH lotide 1/1] Add script to boot up prepared postgres docker container
Export this patch
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
---
scripts/boot-pg-dev.sh | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
create mode 100644 scripts/boot-pg-dev.sh
diff --git a/scripts/boot-pg-dev.sh b/scripts/boot-pg-dev.sh
new file mode 100644
index 0000000..031dcea
--- /dev/null
+++ b/scripts/boot-pg-dev.sh
@@ -0,0 +1,20 @@
+#!/usr/bin/env bash
+
+CONTAINER_NAME=lotide-pg-dev
+DB_PW=password
+DB_USER=dbuser
+DB_NAME=lotidedev
+
+docker run \
+ --name "${CONTAINER_NAME}" \
+ -e POSTGRES_PASSWORD=${DB_PW} \
+ -p 5432:5432 \
+ -m 512m \
+ -d \
+ --rm \
+ postgres
+
+sleep 2
+docker exec -it "${CONTAINER_NAME}" psql -U postgres -c "CREATE USER ${DB_USER} PASSWORD '${DB_PW}' SUPERUSER CREATEDB INHERIT LOGIN"
+docker exec -it "${CONTAINER_NAME}" psql -U postgres -c "CREATE DATABASE ${DB_NAME}"
+
--
2.29.2