aboutsummaryrefslogtreecommitdiff
path: root/arch-base-postgresql
diff options
context:
space:
mode:
authorMhd Sulhan <ms@kilabit.info>2015-11-20 01:56:51 +0700
committerMhd Sulhan <ms@kilabit.info>2015-11-20 01:56:51 +0700
commitb7156deafad00dbd1438244f243f6f8348365a1b (patch)
tree53205f7d055862620f8a9cd26a063a4216cf82d0 /arch-base-postgresql
parentaf075d74485161f6ff6a94db2d0c5272197a4601 (diff)
downloadarch-docker-b7156deafad00dbd1438244f243f6f8348365a1b.tar.xz
Create build script for postgresql image.
Diffstat (limited to 'arch-base-postgresql')
-rwxr-xr-xarch-base-postgresql/bootstrap_postgresql.sh9
l---------arch-base-postgresql/clean.sh1
l---------arch-base-postgresql/create_image.sh1
l---------arch-base-postgresql/create_rootfs.sh1
-rwxr-xr-xarch-base-postgresql/init.sh11
-rw-r--r--arch-base-postgresql/pg_hba.conf8
-rw-r--r--arch-base-postgresql/postgresql.conf10
-rwxr-xr-xarch-base-postgresql/vars.sh17
8 files changed, 58 insertions, 0 deletions
diff --git a/arch-base-postgresql/bootstrap_postgresql.sh b/arch-base-postgresql/bootstrap_postgresql.sh
new file mode 100755
index 0000000..b8e94c3
--- /dev/null
+++ b/arch-base-postgresql/bootstrap_postgresql.sh
@@ -0,0 +1,9 @@
+#!/bin/bash
+
+echo "==> bootstraping postgresql ..."
+
+mkdir -p /var/lib/postgres/data
+mkdir -p /run/postgresql
+
+chown -R postgres:postgres /var/lib/postgres
+chown -R postgres:postgres /run/postgresql
diff --git a/arch-base-postgresql/clean.sh b/arch-base-postgresql/clean.sh
new file mode 120000
index 0000000..1e93f10
--- /dev/null
+++ b/arch-base-postgresql/clean.sh
@@ -0,0 +1 @@
+../scripts/clean.sh \ No newline at end of file
diff --git a/arch-base-postgresql/create_image.sh b/arch-base-postgresql/create_image.sh
new file mode 120000
index 0000000..ec69652
--- /dev/null
+++ b/arch-base-postgresql/create_image.sh
@@ -0,0 +1 @@
+../scripts/create_image.sh \ No newline at end of file
diff --git a/arch-base-postgresql/create_rootfs.sh b/arch-base-postgresql/create_rootfs.sh
new file mode 120000
index 0000000..54a9807
--- /dev/null
+++ b/arch-base-postgresql/create_rootfs.sh
@@ -0,0 +1 @@
+../scripts/create_rootfs.sh \ No newline at end of file
diff --git a/arch-base-postgresql/init.sh b/arch-base-postgresql/init.sh
new file mode 100755
index 0000000..e16dc24
--- /dev/null
+++ b/arch-base-postgresql/init.sh
@@ -0,0 +1,11 @@
+#!/bin/bash
+
+. /bootstrap_postgresql.sh
+
+if [ ! -f /var/lib/postgres/data/pg_hba.conf ]; then
+ su - postgres -c "initdb --locale en_GB.UTF-8 -E UTF8 -D '/var/lib/postgres/data'"
+ su - postgres -c "cp /pg_hba.conf /var/lib/postgres/data/pg_hba.conf"
+ su - postgres -c "cp /postgresql.conf /var/lib/postgres/data/postgresql.conf"
+fi
+
+su - postgres -c "postgres -D '/var/lib/postgres/data'"
diff --git a/arch-base-postgresql/pg_hba.conf b/arch-base-postgresql/pg_hba.conf
new file mode 100644
index 0000000..87998f0
--- /dev/null
+++ b/arch-base-postgresql/pg_hba.conf
@@ -0,0 +1,8 @@
+## "local" is for Unix domain socket connections only
+local all all trust
+## IPv4 local connections:
+host all all 127.0.0.1/32 trust
+## IPv6 local connections:
+host all all ::1/128 trust
+## Allow other docker's containers.
+host all all 172.17.0.0/16 trust
diff --git a/arch-base-postgresql/postgresql.conf b/arch-base-postgresql/postgresql.conf
new file mode 100644
index 0000000..f9cbb31
--- /dev/null
+++ b/arch-base-postgresql/postgresql.conf
@@ -0,0 +1,10 @@
+listen_addresses = '*'
+max_connections = 100
+shared_buffers = 128MB
+dynamic_shared_memory_type = posix
+datestyle = 'iso, dmy'
+lc_messages = 'en_GB.UTF-8'
+lc_monetary = 'en_GB.UTF-8'
+lc_numeric = 'en_GB.UTF-8'
+lc_time = 'en_GB.UTF-8'
+default_text_search_config = 'pg_catalog.english'
diff --git a/arch-base-postgresql/vars.sh b/arch-base-postgresql/vars.sh
new file mode 100755
index 0000000..4c4785e
--- /dev/null
+++ b/arch-base-postgresql/vars.sh
@@ -0,0 +1,17 @@
+#!/bin/zsh
+
+THISD=${0:a:h}
+
+PKGS+=("util-linux")
+PKGS_ADD+=("postgresql")
+PKGS_REMOVED=()
+
+IMAGE_NAME="sulhan/arch-postgresql"
+IMAGE_ARGS=(-c="VOLUME /var/lib/postgres" -c="EXPOSE 5432" -c="CMD /init.sh")
+
+FILES+=("${THISD}/pg_hba.conf" "${ROOTFS}/")
+FILES+=("${THISD}/postgresql.conf" "${ROOTFS}/")
+FILES+=("${THISD}/init.sh" "${ROOTFS}/")
+FILES+=("${THISD}/bootstrap_postgresql.sh" "${ROOTFS}/")
+
+BOOTSTRAP_S+=("/bootstrap_postgresql.sh")