summaryrefslogtreecommitdiff
path: root/postgres/bootstrap.sh
diff options
context:
space:
mode:
Diffstat (limited to 'postgres/bootstrap.sh')
-rw-r--r--postgres/bootstrap.sh20
1 files changed, 20 insertions, 0 deletions
diff --git a/postgres/bootstrap.sh b/postgres/bootstrap.sh
new file mode 100644
index 0000000..03f7eef
--- /dev/null
+++ b/postgres/bootstrap.sh
@@ -0,0 +1,20 @@
+#!/bin/bash
+
+# prepare deps
+export DEBIAN_FRONTEND=noninteractive
+apt-get update
+apt-get upgrade -y
+apt-get install -y xauth
+
+# deps
+apt-get install -y postgresql postgresql-client
+
+# set up db
+sudo -u postgres psql -c "CREATE USER space WITH PASSWORD 'space';"
+sudo -u postgres psql -c "CREATE DATABASE space_db WITH OWNER space;"
+
+# copy configs
+cp /vagrant/postgres/*conf /etc/postgresql/9.6/main/
+
+# systemd
+systemctl restart postgresql