diff --git a/Dockerfiles/db/Dockerfile b/Dockerfiles/db/Dockerfile index 9ffe08c06926c5a5489bc0a97d9afd4a02aff8ea..3d67b8c3a1ee257e91b735b2c8872f59ba2ceafc 100644 --- a/Dockerfiles/db/Dockerfile +++ b/Dockerfiles/db/Dockerfile @@ -1,32 +1,26 @@ -# # ARB::Base de données postgis pour le calcul du calque de plantabilité +# ARB::Base de données postgis pour le calcul du calque de plantabilité -# FROM postgis/postgis +FROM postgis/postgis -# # Create another dir for pgdata than /var/postgresql/data/ -# # see http://heidloff.net/article/deploying-postgres-on-openshift/ -# USER root +# Create another dir for pgdata than /var/postgresql/data/ +# see http://heidloff.net/article/deploying-postgres-on-openshift/ +USER root # ENV PGDATA=/var/lib/postgresql/data/pgdata -# # RUN mkdir arb-data +ENV PGDATA=/arb-data/pgdata # RUN groupadd non-root-postgres-group && \ # useradd non-root-postgres-user --group non-root-postgres-group && \ -# mkdir -p $PGDATA && \ -# chown -R non-root-postgres-user:non-root-postgres-group /$PGDATA && \ -# chmod 777 /$PGDATA - -# # Entry point. -# COPY ./db-init/ /docker-entrypoint-initdb.d/ +RUN mkdir -p $PGDATA && \ +chown -R postgres:0 /$PGDATA && \ +chmod 777 /$PGDATA -# RUN ls -l /docker-entrypoint-initdb.d/ +# Entry point. +COPY ./db-init/ /docker-entrypoint-initdb.d/ # USER non-root-postgres -FROM mdillon/postgis:10-alpine - -USER root - -RUN chown postgres:0 -R ${PGDATA} - -COPY ./db-init/ /docker-entrypoint-initdb.d/ - +# FROM mdillon/postgis:10-alpine +# USER root +# RUN chown postgres:0 -R ${PGDATA} +# COPY ./db-init/ /docker-entrypoint-initdb.d/ USER postgres \ No newline at end of file diff --git a/deployment/db-calqul.yml b/deployment/db-calqul.yml index 904a716bad7bdd3ea39a980bebf58fae946da7d7..008ca0b08080e9cffd88d811c98ba369060ca144 100644 --- a/deployment/db-calqul.yml +++ b/deployment/db-calqul.yml @@ -64,7 +64,8 @@ spec: value: "__POSTGRES_SCHEMA__" # need to define PGDATA env var because not using the default /var/lib/postgresql/data, but a subpath under it. - name: PGDATA - value: /var/lib/postgresql/data/pgdata + # value: /var/lib/postgresql/data/pgdata + value: /arb-data/pgdata volumeMounts: # need a subpath as postgres wants an empty folder (the mounted folder `/var/lib/postgresql/data` has a `lost+found` directory) # see https://stackoverflow.com/questions/51168558/how-to-mount-a-postgresql-volume-using-aws-ebs-in-kubernete @@ -72,6 +73,6 @@ spec: # the owner:group of this folder is 70:70 (postgres:postgres), done by this step in the docker image: # https://github.com/docker-library/postgres/blob/master/Dockerfile-alpine.template#L146 - name: db-data - mountPath: "/var/lib/postgresql/data/pgdata" + mountPath: "/arb-data/pgdata" subpath: pgdata