<commit_before># postgis 2.1 / posgresql PGVER / ubuntu trusty

FROM ubuntu:trusty
ARG PGVER

RUN test -n "${PGVER}" || ( \
  echo 'PGVER build arg is mandatory,' \
       'try --build-arg PGVER=9.3'; \
  exit 1; \
) >&2

# TODO: find a way to report version at build time
#RUN echo PGVER is ${PGVER}

MAINTAINER <NAME> <<EMAIL>>

RUN apt-get update && apt-get -y install wget
RUN wget --quiet --no-check-certificate -O - \
    https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add -
RUN echo "deb http://apt.postgresql.org/pub/repos/apt/ $(lsb_release -cs)-pgdg main" >> /etc/apt/sources.list
RUN locale-gen --no-purge en_US.UTF-8
ENV LC_ALL en_US.UTF-8
RUN update-locale LANG=en_US.UTF-8
RUN apt-get -y update && apt-get install -y \
  postgresql-contrib-${PGVER} \
  postgresql-${PGVER} \
  postgresql-${PGVER}-postgis-2.1
# We do not install recommends because they could bring in
# non-wanted PostgreSQL versions.
# See https://github.com/systemapic/docker-systemapic/issues/13
RUN apt-get -y update && apt-get -y install --no-install-recommends postgis

# access configuration
RUN echo "host    all             all             0.0.0.0/0 md5" >> /etc/postgresql/${PGVER}/main/pg_hba.conf

# common config
RUN ( \
  echo "listen_addresses = '*'"; \
  echo "port = 5432"; \
  : echo "log_statement = ddl"; \
  echo "log_statement = none"; \ 
  : echo "log_statement = all"; \
  echo "log_min_error_statement = ERROR"; \
) >> /etc/postgresql/${PGVER}/main/postgresql.conf

# pgtune
RUN ( \
  echo "max_connections = 100"; \
  echo "shared_buffers = 4GB"; \
  echo "effective_cache_size = 12GB"; \
  echo "work_mem = 20971kB"; \
  echo "maintenance_work_mem = 2GB"; \
  echo "checkpoint_segments = 128"; \
  echo "checkpoint_completion_target = 0.9"; \
  echo "wal_buffers = 16MB"; \
  echo "default_statistics_target = 500"; \
) >> /etc/postgresql/${PGVER}/main/postgresql.conf

# TODO: stop relying on service start/stop to fix /var/run/postgresql
RUN service postgresql start && service postgresql stop

EXPOSE 5432

ENV TERM xterm
RUN apt-get install -y fish htop

ADD start.sh /start.sh
RUN chmod 0755 /start.sh

ADD update_postgis.sh /update_postgis.sh
RUN chmod 0755 /update_postgis.sh

ADD restore_databases.sh /restore_databases.sh
RUN chmod 0755 /restore_databases.sh

# ADD default_env.txt /systemapic/configs/env  # added by build_config.sh in /docks/config/... @strk: YES, we need a deafult 
# RUN chmod 0600 /systemapic/configs/env

ENV PGVER ${PGVER}
CMD /start.sh ${PGVER}

ENV PGUSER postgres
ENV PGDATABASE template1
<commit_msg>Include application name in PostgreSQL logs<commit_after># postgis 2.1 / posgresql PGVER / ubuntu trusty

FROM ubuntu:trusty
ARG PGVER

RUN test -n "${PGVER}" || ( \
  echo 'PGVER build arg is mandatory,' \
       'try --build-arg PGVER=9.3'; \
  exit 1; \
) >&2

# TODO: find a way to report version at build time
#RUN echo PGVER is ${PGVER}

MAINTAINER <NAME> <<EMAIL>>

RUN apt-get update && apt-get -y install wget
RUN wget --quiet --no-check-certificate -O - \
    https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add -
RUN echo "deb http://apt.postgresql.org/pub/repos/apt/ $(lsb_release -cs)-pgdg main" >> /etc/apt/sources.list
RUN locale-gen --no-purge en_US.UTF-8
ENV LC_ALL en_US.UTF-8
RUN update-locale LANG=en_US.UTF-8
RUN apt-get -y update && apt-get install -y \
  postgresql-contrib-${PGVER} \
  postgresql-${PGVER} \
  postgresql-${PGVER}-postgis-2.1
# We do not install recommends because they could bring in
# non-wanted PostgreSQL versions.
# See https://github.com/systemapic/docker-systemapic/issues/13
RUN apt-get -y update && apt-get -y install --no-install-recommends postgis

# access configuration
RUN echo "host    all             all             0.0.0.0/0 md5" >> /etc/postgresql/${PGVER}/main/pg_hba.conf

# common config
RUN ( \
  echo "listen_addresses = '*'"; \
  echo "port = 5432"; \
  : echo "log_statement = ddl"; \
  echo "log_statement = none"; \ 
  : echo "log_statement = all"; \
  echo "log_min_error_statement = ERROR"; \
  echo "log_line_prefix = '%t %a [%p-%l] %q%u@%d '"; \
) >> /etc/postgresql/${PGVER}/main/postgresql.conf

# pgtune
RUN ( \
  echo "max_connections = 100"; \
  echo "shared_buffers = 4GB"; \
  echo "effective_cache_size = 12GB"; \
  echo "work_mem = 20971kB"; \
  echo "maintenance_work_mem = 2GB"; \
  echo "checkpoint_segments = 128"; \
  echo "checkpoint_completion_target = 0.9"; \
  echo "wal_buffers = 16MB"; \
  echo "default_statistics_target = 500"; \
) >> /etc/postgresql/${PGVER}/main/postgresql.conf

# TODO: stop relying on service start/stop to fix /var/run/postgresql
RUN service postgresql start && service postgresql stop

EXPOSE 5432

ENV TERM xterm
RUN apt-get install -y fish htop

ADD start.sh /start.sh
RUN chmod 0755 /start.sh

ADD update_postgis.sh /update_postgis.sh
RUN chmod 0755 /update_postgis.sh

ADD restore_databases.sh /restore_databases.sh
RUN chmod 0755 /restore_databases.sh

# ADD default_env.txt /systemapic/configs/env  # added by build_config.sh in /docks/config/... @strk: YES, we need a deafult 
# RUN chmod 0600 /systemapic/configs/env

ENV PGVER ${PGVER}
CMD /start.sh ${PGVER}

ENV PGUSER postgres
ENV PGDATABASE template1

{'fraction_non_alphanumeric': 0.13376897943494137, 'fraction_numerical': 0.026138766096482798, 'mean_word_length': 3.3330557868442963, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 27, 'https://': 4, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 2, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '339348', 'n_tokens_mistral': 2044, 'n_tokens_neox': 1923, 'n_words': 513}