Fix tb-postgres docker image. Update postgreSQL version to 11

This commit is contained in:
Igor Kulikov 2020-02-27 19:12:54 +02:00
parent 57c2915e65
commit 771bd70a33
3 changed files with 12 additions and 4 deletions

View File

@ -17,7 +17,11 @@
FROM thingsboard/openjdk8 FROM thingsboard/openjdk8
RUN apt-get update RUN apt-get update
RUN apt-get install -y postgresql postgresql-contrib RUN apt-get install -y curl
RUN echo 'deb http://apt.postgresql.org/pub/repos/apt/ stretch-pgdg main' | tee --append /etc/apt/sources.list.d/pgdg.list > /dev/null
RUN curl -L https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add -
RUN apt-get update
RUN apt-get install -y postgresql-11
RUN update-rc.d postgresql disable RUN update-rc.d postgresql disable
RUN mkdir -p /var/log/postgres RUN mkdir -p /var/log/postgres

View File

@ -17,13 +17,15 @@
firstlaunch=${DATA_FOLDER}/.firstlaunch firstlaunch=${DATA_FOLDER}/.firstlaunch
export PG_CTL=$(find /usr/lib/postgresql/ -name pg_ctl)
if [ ! -d ${PGDATA} ]; then if [ ! -d ${PGDATA} ]; then
mkdir -p ${PGDATA} mkdir -p ${PGDATA}
chown -R postgres:postgres ${PGDATA} chown -R postgres:postgres ${PGDATA}
su postgres -c '/usr/lib/postgresql/10/bin/pg_ctl initdb -U postgres' su postgres -c '${PG_CTL} initdb -U postgres'
fi fi
su postgres -c '/usr/lib/postgresql/10/bin/pg_ctl -l /var/log/postgres/postgres.log -w start' su postgres -c '${PG_CTL} -l /var/log/postgres/postgres.log -w start'
if [ ! -f ${firstlaunch} ]; then if [ ! -f ${firstlaunch} ]; then
su postgres -c 'psql -U postgres -d postgres -c "CREATE DATABASE thingsboard"' su postgres -c 'psql -U postgres -d postgres -c "CREATE DATABASE thingsboard"'

View File

@ -15,4 +15,6 @@
# limitations under the License. # limitations under the License.
# #
su postgres -c '/usr/lib/postgresql/10/bin/pg_ctl stop' export PG_CTL=$(find /usr/lib/postgresql/ -name pg_ctl)
su postgres -c '${PG_CTL} stop'