Mercurial > dive4elements > river
annotate backend/doc/schema/Dockerfile @ 8798:a4d8b3c6fb57
Small corrections and cosmetics for install docs.
author | Tom Gottfried <tom@intevation.de> |
---|---|
date | Thu, 17 Dec 2015 17:07:53 +0100 |
parents | 13d5b6c67cef |
children | 8927ec8a3c32 |
rev | line source |
---|---|
8795
13d5b6c67cef
Add Dockerfile for Postgres-DB setup.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
1 # Docker file for postgresql 9.4 on debain |
13d5b6c67cef
Add Dockerfile for Postgres-DB setup.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
2 # |
13d5b6c67cef
Add Dockerfile for Postgres-DB setup.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
3 # build with e.g. `docker build --force-rm=true -t d4e/river_db .', |
13d5b6c67cef
Add Dockerfile for Postgres-DB setup.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
4 # then run with e.g. |
13d5b6c67cef
Add Dockerfile for Postgres-DB setup.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
5 # `docker run --name d4eriver_db -dp 2345:5432 d4e/river_db:latest' |
13d5b6c67cef
Add Dockerfile for Postgres-DB setup.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
6 # |
13d5b6c67cef
Add Dockerfile for Postgres-DB setup.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
7 |
13d5b6c67cef
Add Dockerfile for Postgres-DB setup.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
8 FROM debian:jessie |
13d5b6c67cef
Add Dockerfile for Postgres-DB setup.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
9 MAINTAINER tom@intevation.de |
13d5b6c67cef
Add Dockerfile for Postgres-DB setup.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
10 |
13d5b6c67cef
Add Dockerfile for Postgres-DB setup.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
11 # |
13d5b6c67cef
Add Dockerfile for Postgres-DB setup.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
12 # Use utf-8 |
13d5b6c67cef
Add Dockerfile for Postgres-DB setup.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
13 # |
13d5b6c67cef
Add Dockerfile for Postgres-DB setup.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
14 RUN echo \ |
13d5b6c67cef
Add Dockerfile for Postgres-DB setup.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
15 "locales locales/locales_to_be_generated multiselect en_US.UTF-8 UTF-8" | \ |
13d5b6c67cef
Add Dockerfile for Postgres-DB setup.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
16 debconf-set-selections && \ |
13d5b6c67cef
Add Dockerfile for Postgres-DB setup.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
17 echo "locales locales/default_environment_locale select en_US.UTF-8" | \ |
13d5b6c67cef
Add Dockerfile for Postgres-DB setup.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
18 debconf-set-selections |
13d5b6c67cef
Add Dockerfile for Postgres-DB setup.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
19 |
13d5b6c67cef
Add Dockerfile for Postgres-DB setup.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
20 RUN apt-get update -y && apt-get install -y locales |
13d5b6c67cef
Add Dockerfile for Postgres-DB setup.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
21 |
13d5b6c67cef
Add Dockerfile for Postgres-DB setup.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
22 ENV LC_ALL en_US.UTF-8 |
13d5b6c67cef
Add Dockerfile for Postgres-DB setup.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
23 |
13d5b6c67cef
Add Dockerfile for Postgres-DB setup.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
24 # |
13d5b6c67cef
Add Dockerfile for Postgres-DB setup.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
25 # Install packages |
13d5b6c67cef
Add Dockerfile for Postgres-DB setup.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
26 # |
13d5b6c67cef
Add Dockerfile for Postgres-DB setup.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
27 RUN apt-get update && \ |
13d5b6c67cef
Add Dockerfile for Postgres-DB setup.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
28 apt-get install -y postgresql-9.4-postgis-2.1 postgis |
13d5b6c67cef
Add Dockerfile for Postgres-DB setup.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
29 |
13d5b6c67cef
Add Dockerfile for Postgres-DB setup.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
30 # |
13d5b6c67cef
Add Dockerfile for Postgres-DB setup.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
31 # Use user postgres to run the next commands |
13d5b6c67cef
Add Dockerfile for Postgres-DB setup.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
32 # |
13d5b6c67cef
Add Dockerfile for Postgres-DB setup.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
33 USER postgres |
13d5b6c67cef
Add Dockerfile for Postgres-DB setup.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
34 |
13d5b6c67cef
Add Dockerfile for Postgres-DB setup.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
35 RUN /etc/init.d/postgresql start && \ |
13d5b6c67cef
Add Dockerfile for Postgres-DB setup.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
36 psql --command "CREATE USER admin WITH SUPERUSER PASSWORD 'secret';" |
13d5b6c67cef
Add Dockerfile for Postgres-DB setup.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
37 |
13d5b6c67cef
Add Dockerfile for Postgres-DB setup.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
38 # |
13d5b6c67cef
Add Dockerfile for Postgres-DB setup.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
39 # Adjust PostgreSQL configuration so that remote connections to the |
13d5b6c67cef
Add Dockerfile for Postgres-DB setup.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
40 # database are possible. |
13d5b6c67cef
Add Dockerfile for Postgres-DB setup.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
41 # |
13d5b6c67cef
Add Dockerfile for Postgres-DB setup.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
42 RUN echo "host all all 0.0.0.0/0 md5" >> \ |
13d5b6c67cef
Add Dockerfile for Postgres-DB setup.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
43 /etc/postgresql/9.4/main/pg_hba.conf |
13d5b6c67cef
Add Dockerfile for Postgres-DB setup.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
44 |
13d5b6c67cef
Add Dockerfile for Postgres-DB setup.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
45 RUN echo "listen_addresses='*'" >> /etc/postgresql/9.4/main/postgresql.conf |
13d5b6c67cef
Add Dockerfile for Postgres-DB setup.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
46 |
13d5b6c67cef
Add Dockerfile for Postgres-DB setup.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
47 # |
13d5b6c67cef
Add Dockerfile for Postgres-DB setup.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
48 # Expose the PostgreSQL port |
13d5b6c67cef
Add Dockerfile for Postgres-DB setup.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
49 # |
13d5b6c67cef
Add Dockerfile for Postgres-DB setup.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
50 EXPOSE 5432 |
13d5b6c67cef
Add Dockerfile for Postgres-DB setup.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
51 |
13d5b6c67cef
Add Dockerfile for Postgres-DB setup.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
52 # |
13d5b6c67cef
Add Dockerfile for Postgres-DB setup.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
53 # Create database |
13d5b6c67cef
Add Dockerfile for Postgres-DB setup.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
54 # |
13d5b6c67cef
Add Dockerfile for Postgres-DB setup.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
55 # Don't mind scary messages like |
13d5b6c67cef
Add Dockerfile for Postgres-DB setup.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
56 # 'FATAL: the database system is starting up'. |
13d5b6c67cef
Add Dockerfile for Postgres-DB setup.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
57 # It's because of the -w |
13d5b6c67cef
Add Dockerfile for Postgres-DB setup.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
58 # |
13d5b6c67cef
Add Dockerfile for Postgres-DB setup.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
59 ADD . /opt/d4eriver_db |
13d5b6c67cef
Add Dockerfile for Postgres-DB setup.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
60 |
13d5b6c67cef
Add Dockerfile for Postgres-DB setup.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
61 RUN /usr/lib/postgresql/9.4/bin/pg_ctl start -wD /etc/postgresql/9.4/main/ && \ |
13d5b6c67cef
Add Dockerfile for Postgres-DB setup.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
62 /opt/d4eriver_db/postgresql-setup.sh |
13d5b6c67cef
Add Dockerfile for Postgres-DB setup.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
63 |
13d5b6c67cef
Add Dockerfile for Postgres-DB setup.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
64 # |
13d5b6c67cef
Add Dockerfile for Postgres-DB setup.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
65 # Set the default command to run when starting the container |
13d5b6c67cef
Add Dockerfile for Postgres-DB setup.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
66 # |
13d5b6c67cef
Add Dockerfile for Postgres-DB setup.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
67 CMD ["/usr/lib/postgresql/9.4/bin/postgres", "-D", \ |
13d5b6c67cef
Add Dockerfile for Postgres-DB setup.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
68 "/var/lib/postgresql/9.4/main", "-c", \ |
13d5b6c67cef
Add Dockerfile for Postgres-DB setup.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
69 "config_file=/etc/postgresql/9.4/main/postgresql.conf"] |