Mercurial > gemma
annotate docker/Dockerfile.db @ 2130:f3aabc05f9b2
Fix constraints on waterway profiles
staging_done in the UNIQUE constraint had no effect, because the
exclusion constraint prevented two rows with equal location and
validity anyhow. Adding staging_done to the exclusion constraint
makes the UNIQUE constraint checking only a corner case of what
the exclusion constraint checks. Thus, remove the UNIQUE constraint.
Casting staging_done to int is needed because there is no appropriate
operator class for booleans. Casting to smallint or even bit would have
been better (i.e. should result in smaller index size), but that would
have required creating such a CAST, in addition.
author | Tom Gottfried <tom@intevation.de> |
---|---|
date | Wed, 06 Feb 2019 15:42:32 +0100 |
parents | 8ed3a8fd2d2f |
children | 39586a34979c |
rev | line source |
---|---|
1108
5adee8b0e29f
Migrate database Dockerfile to bionic and upgrade database
Tom Gottfried <tom@intevation.de>
parents:
524
diff
changeset
|
1 FROM ubuntu:bionic |
157
a85c44438d48
fix: Replaced MAINTAINER by LABEL
Thomas Junk <thomas.junk@intevation.de>
parents:
156
diff
changeset
|
2 LABEL authors="tom.gottfried@intevation.de" |
1356
ce24990b3d5c
add licensing hint to docker files
Bernhard Reiter <bernhard@intevation.de>
parents:
1108
diff
changeset
|
3 LABEL description="Contains software from gemma, for right holders and\ |
ce24990b3d5c
add licensing hint to docker files
Bernhard Reiter <bernhard@intevation.de>
parents:
1108
diff
changeset
|
4 licensing infos, see https://hg.intevation.de/gemma ." |
35
62e14b4d25fc
First working draft of schema for bottlenecks.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
5 |
1577 | 6 ENV DEBIAN_FRONTEND noninteractive |
7 | |
1108
5adee8b0e29f
Migrate database Dockerfile to bionic and upgrade database
Tom Gottfried <tom@intevation.de>
parents:
524
diff
changeset
|
8 RUN apt-get update &&\ |
1577 | 9 apt-get -y install --no-install-recommends curl ca-certificates gnupg |
1108
5adee8b0e29f
Migrate database Dockerfile to bionic and upgrade database
Tom Gottfried <tom@intevation.de>
parents:
524
diff
changeset
|
10 |
5adee8b0e29f
Migrate database Dockerfile to bionic and upgrade database
Tom Gottfried <tom@intevation.de>
parents:
524
diff
changeset
|
11 # Add PostgreSQL's repository for current PostgreSQL release and extensions: |
5adee8b0e29f
Migrate database Dockerfile to bionic and upgrade database
Tom Gottfried <tom@intevation.de>
parents:
524
diff
changeset
|
12 RUN echo 'deb http://apt.postgresql.org/pub/repos/apt/ bionic-pgdg main' \ |
5adee8b0e29f
Migrate database Dockerfile to bionic and upgrade database
Tom Gottfried <tom@intevation.de>
parents:
524
diff
changeset
|
13 >> /etc/apt/sources.list &&\ |
5adee8b0e29f
Migrate database Dockerfile to bionic and upgrade database
Tom Gottfried <tom@intevation.de>
parents:
524
diff
changeset
|
14 curl https://www.postgresql.org/media/keys/ACCC4CF8.asc | \ |
1577 | 15 apt-key add - &&\ |
1108
5adee8b0e29f
Migrate database Dockerfile to bionic and upgrade database
Tom Gottfried <tom@intevation.de>
parents:
524
diff
changeset
|
16 apt-get update &&\ |
5adee8b0e29f
Migrate database Dockerfile to bionic and upgrade database
Tom Gottfried <tom@intevation.de>
parents:
524
diff
changeset
|
17 apt-get -y install postgresql-11-postgis-2.5 postgresql-11-pgtap |
5adee8b0e29f
Migrate database Dockerfile to bionic and upgrade database
Tom Gottfried <tom@intevation.de>
parents:
524
diff
changeset
|
18 |
35
62e14b4d25fc
First working draft of schema for bottlenecks.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
19 USER postgres |
1108
5adee8b0e29f
Migrate database Dockerfile to bionic and upgrade database
Tom Gottfried <tom@intevation.de>
parents:
524
diff
changeset
|
20 ENV PGBIN /usr/lib/postgresql/11/bin |
5adee8b0e29f
Migrate database Dockerfile to bionic and upgrade database
Tom Gottfried <tom@intevation.de>
parents:
524
diff
changeset
|
21 ENV PGDATA /var/lib/postgresql/11/main |
5adee8b0e29f
Migrate database Dockerfile to bionic and upgrade database
Tom Gottfried <tom@intevation.de>
parents:
524
diff
changeset
|
22 ENV PGCONF /etc/postgresql/11/main/postgresql.conf |
35
62e14b4d25fc
First working draft of schema for bottlenecks.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
23 |
1108
5adee8b0e29f
Migrate database Dockerfile to bionic and upgrade database
Tom Gottfried <tom@intevation.de>
parents:
524
diff
changeset
|
24 RUN \ |
5adee8b0e29f
Migrate database Dockerfile to bionic and upgrade database
Tom Gottfried <tom@intevation.de>
parents:
524
diff
changeset
|
25 # Adjust PostgreSQL configuration to allow remote connections |
5adee8b0e29f
Migrate database Dockerfile to bionic and upgrade database
Tom Gottfried <tom@intevation.de>
parents:
524
diff
changeset
|
26 echo "host all all 0.0.0.0/0 md5" \ |
5adee8b0e29f
Migrate database Dockerfile to bionic and upgrade database
Tom Gottfried <tom@intevation.de>
parents:
524
diff
changeset
|
27 >> /etc/postgresql/11/main/pg_hba.conf &&\ |
306
70592a18c5c6
Keep log on stderr to be able to use docker logs
Tom Gottfried <tom@intevation.de>
parents:
246
diff
changeset
|
28 echo "listen_addresses='*'" >> $PGCONF &&\ |
1108
5adee8b0e29f
Migrate database Dockerfile to bionic and upgrade database
Tom Gottfried <tom@intevation.de>
parents:
524
diff
changeset
|
29 # Set port to standard value |
5adee8b0e29f
Migrate database Dockerfile to bionic and upgrade database
Tom Gottfried <tom@intevation.de>
parents:
524
diff
changeset
|
30 sed -i '/port/s/543./5432/' $PGCONF &&\ |
306
70592a18c5c6
Keep log on stderr to be able to use docker logs
Tom Gottfried <tom@intevation.de>
parents:
246
diff
changeset
|
31 # Keep log on stderr to be able to use docker logs |
70592a18c5c6
Keep log on stderr to be able to use docker logs
Tom Gottfried <tom@intevation.de>
parents:
246
diff
changeset
|
32 sed -i '/logging_collector/s/on/off/' $PGCONF |
1108
5adee8b0e29f
Migrate database Dockerfile to bionic and upgrade database
Tom Gottfried <tom@intevation.de>
parents:
524
diff
changeset
|
33 |
35
62e14b4d25fc
First working draft of schema for bottlenecks.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
34 # Expose the PostgreSQL port |
62e14b4d25fc
First working draft of schema for bottlenecks.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
35 EXPOSE 5432 |
62e14b4d25fc
First working draft of schema for bottlenecks.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
36 |
116
dad6cf39691e
Renamed remaining wamos stuff to gemma.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
113
diff
changeset
|
37 # Create GEMMA role and database |
173
2b04de578be0
Use COPY in a way that allows replacing by a volume
Tom Gottfried <tom@intevation.de>
parents:
172
diff
changeset
|
38 WORKDIR /opt/gemma |
524
156a805941b5
Move docker stuff from schema to dedicated docker directory
Tom Gottfried <tom@intevation.de>
parents:
478
diff
changeset
|
39 COPY schema/*.sql schema/*.sh ./ |
156a805941b5
Move docker stuff from schema to dedicated docker directory
Tom Gottfried <tom@intevation.de>
parents:
478
diff
changeset
|
40 COPY schema/demo-data ./demo-data/ |
35
62e14b4d25fc
First working draft of schema for bottlenecks.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
41 RUN $PGBIN/pg_ctl start -wo "--config_file=$PGCONF" && \ |
478
3af7ca761f6a
Purge password reset role
Tom Gottfried <tom@intevation.de>
parents:
463
diff
changeset
|
42 ./install-db.sh --demo --metapw "geo2Serv" && \ |
35
62e14b4d25fc
First working draft of schema for bottlenecks.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
43 $PGBIN/pg_ctl stop -m smart |
62e14b4d25fc
First working draft of schema for bottlenecks.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
44 |
62e14b4d25fc
First working draft of schema for bottlenecks.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
45 # Set the default command to run when starting the container |
1108
5adee8b0e29f
Migrate database Dockerfile to bionic and upgrade database
Tom Gottfried <tom@intevation.de>
parents:
524
diff
changeset
|
46 CMD ["/usr/lib/postgresql/11/bin/postgres", "-D", "/etc/postgresql/11/main"] |