[PATCH] Add demodata and fix server startup in DB Dockerfile

Wald Commits scm-commit at wald.intevation.org
Wed May 10 12:09:30 CEST 2017


# HG changeset patch
# User Tom Gottfried <tom at intevation.de>
# Date 1494410954 -7200
# Node ID 8927ec8a3c32983f1171af7d4c1f3caa9c3356b2
# Parent  f5e126739c36fcdff11585af648cb639da74ce85
Add demodata and fix server startup in DB Dockerfile.

diff -r f5e126739c36 -r 8927ec8a3c32 backend/doc/schema/Dockerfile
--- a/backend/doc/schema/Dockerfile	Tue May 09 18:42:56 2017 +0200
+++ b/backend/doc/schema/Dockerfile	Wed May 10 12:09:14 2017 +0200
@@ -25,7 +25,7 @@
 # Install packages
 #
 RUN apt-get update && \
-    apt-get install -y postgresql-9.4-postgis-2.1 postgis
+    apt-get install -y postgresql-9.4-postgis-2.1 postgis curl
 
 #
 # Use user postgres to run the next commands
@@ -42,7 +42,8 @@
 RUN echo "host all  all    0.0.0.0/0  md5" >> \
     /etc/postgresql/9.4/main/pg_hba.conf
 
-RUN echo "listen_addresses='*'" >> /etc/postgresql/9.4/main/postgresql.conf
+ENV PGCONF /etc/postgresql/9.4/main/postgresql.conf
+RUN echo "listen_addresses='*'" >> $PGCONF
 
 #
 # Expose the PostgreSQL port
@@ -58,8 +59,20 @@
 #
 ADD . /opt/d4eriver_db
 
-RUN /usr/lib/postgresql/9.4/bin/pg_ctl start -wD /etc/postgresql/9.4/main/ && \
-    /opt/d4eriver_db/postgresql-setup.sh
+# Go to postgres home for write permissions
+WORKDIR /var/lib/postgresql
+ENV DATA_ARCH demodaten_3.1.10-bis-3.2.x.tar.gz
+RUN curl -k "https://wald.intevation.org/frs/download.php/2282/$DATA_ARCH" | \
+    tar xz
+
+ENV PGDATA /var/lib/postgresql/9.4/main
+RUN /usr/lib/postgresql/9.4/bin/pg_ctl start -wo "--config_file=$PGCONF" && \
+    /opt/d4eriver_db/postgresql-setup.sh && \
+    psql -f demodaten/d4e_demodata.dump.sql d4e && \
+    createuser -S -D -R seddb && \
+    createdb seddb && \
+    psql -f demodaten/seddb_demodata.dump.sql seddb && \
+    /usr/lib/postgresql/9.4/bin/pg_ctl stop
 
 #
 # Set the default command to run when starting the container


More information about the Dive4Elements-commits mailing list