Skip to content

Commit

Permalink
[skip ci] Another attempt to use /etc/postgresql/postgres.conf
Browse files Browse the repository at this point in the history
  • Loading branch information
akorotkov committed Dec 10, 2023
1 parent adc4d7f commit e47d061
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 8 deletions.
6 changes: 5 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,10 @@ ENV PGDATA /var/lib/postgresql/data
RUN mkdir -p "$PGDATA" && chown -R postgres:postgres "$PGDATA" && chmod 777 "$PGDATA"
VOLUME /var/lib/postgresql/data

RUN mkdir -p /etc/postgresql && chown -R postgres:postgres /etc/postgresql && chmod 700 /etc/postgresql
COPY --chown=postgres:postgres postgresql.docker.conf /etc/postgresql/postgresql.conf
ENV PG_CONF=/etc/postgresql/postgresql.conf

COPY docker-entrypoint.sh /usr/local/bin/
ENTRYPOINT ["docker-entrypoint.sh"]

Expand Down Expand Up @@ -266,4 +270,4 @@ STOPSIGNAL SIGINT
# that even 90 seconds may not be long enough in many instances.

EXPOSE 5432
CMD ["postgres"]
CMD ["postgres", "-D", "/etc/postgresql"]
6 changes: 5 additions & 1 deletion Dockerfile.ubuntu
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,10 @@ ENV PGDATA /var/lib/postgresql/data
RUN mkdir -p "$PGDATA" && chown -R postgres:postgres "$PGDATA" && chmod 777 "$PGDATA"
VOLUME /var/lib/postgresql/data

RUN mkdir -p /etc/postgresql && chown -R postgres:postgres /etc/postgresql && chmod 700 /etc/postgresql
COPY --chown=postgres:postgres postgresql.docker.conf /etc/postgresql/postgresql.conf
ENV PG_CONF=/etc/postgresql/postgresql.conf

COPY docker-entrypoint.sh /usr/local/bin/
ENTRYPOINT ["docker-entrypoint.sh"]

Expand Down Expand Up @@ -249,4 +253,4 @@ STOPSIGNAL SIGINT
# that even 90 seconds may not be long enough in many instances.

EXPOSE 5432
CMD ["postgres"]
CMD ["postgres", "-D", "/etc/postgresql"]
6 changes: 0 additions & 6 deletions docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -90,12 +90,6 @@ docker_init_database_dir() {

eval 'initdb --username="$POSTGRES_USER" --pwfile=<(echo "$POSTGRES_PASSWORD") '"$POSTGRES_INITDB_ARGS"' "$@"'

sed -ri "s!^#?(listen_addresses)\s*=\s*\S+.*!\1 = '*'!" $PGDATA/postgresql.conf;
echo "shared_preload_libraries = 'orioledb'" >> $PGDATA/postgresql.conf;
echo "orioledb.main_buffers = 512MB" >> $PGDATA/postgresql.conf;
echo "orioledb.undo_buffers = 256MB" >> $PGDATA/postgresql.conf;
echo "max_wal_size = 8GB" >> $PGDATA/postgresql.conf;

# unset/cleanup "nss_wrapper" bits
if [[ "${LD_PRELOAD:-}" == */libnss_wrapper.so ]]; then
rm -f "$NSS_WRAPPER_PASSWD" "$NSS_WRAPPER_GROUP"
Expand Down
6 changes: 6 additions & 0 deletions postgresql.docker.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
data_directory = '/var/lib/postgresql/data'
listen_addresses = '*'
shared_preload_libraries = 'orioledb'
orioledb.main_buffers = 512MB
orioledb.undo_buffers = 256MB
max_wal_size = 8GB

0 comments on commit e47d061

Please sign in to comment.