Updates for 2.2.0

* Use timescaleDB CE intead of OSS
* Have psql-app wait for psql to startup during init db
* Add version file to postgres container
This commit is contained in:
Tim Evens 2022-06-12 11:04:59 -07:00
parent e19e5ac73a
commit 6e616efe10
2 changed files with 18 additions and 6 deletions

View File

@ -23,8 +23,8 @@
# ----------------------------------------------- # -----------------------------------------------
# stage: Final container # stage: Final container
# ----------------------------------------------- # -----------------------------------------------
#FROM timescale/timescaledb-ha:pg14.3-ts2.7-latest FROM timescale/timescaledb-ha:pg14-ts2.7-latest
FROM timescale/timescaledb-ha:pg14-ts2.7-oss-latest
ARG VERSION=0.0.0 ARG VERSION=0.0.0
ENV PGDATA=/var/lib/postgresql/data ENV PGDATA=/var/lib/postgresql/data
@ -42,8 +42,8 @@ USER root
RUN rm -rf /usr/lib/postgresql/12 /usr/lib/postgresql/13 \ RUN rm -rf /usr/lib/postgresql/12 /usr/lib/postgresql/13 \
&& mkdir -p /var/lib/postgresql/data /var/lib/postgresql/ts/data \ && mkdir -p /var/lib/postgresql/data /var/lib/postgresql/ts/data \
&& chown -R postgres /var/lib/postgresql/data /var/lib/postgresql/ts/data && chown -R postgres /var/lib/postgresql/data /var/lib/postgresql/ts/data \
&& mkdir -p /usr/local/openbmp \
&& touch /usr/local/openbmp/version-${VERSION}
USER postgres USER postgres
RUN touch /var/lib/postgresql/data/version-${VERSION}

View File

@ -74,10 +74,22 @@ initdb_postgres() {
if [[ ! -f /config/do_not_init_db ]]; then if [[ ! -f /config/do_not_init_db ]]; then
echo " ===> Initializing the DB" echo " ===> Initializing the DB"
echo "Waiting for postgres to start..."
done=0
while [ $done -eq 0 ]; do
psql -c "select 1;" > /dev/null 2>&1
if [[ $? -ne 0 ]]; then
echo " postgres not running, sleeping for 20 seconds..."
sleep 20
else
done=1
break
fi
done
# Load the schema files # Load the schema files
echo " ===> Loading Schemas" echo " ===> Loading Schemas"
echo "------" > /var/log/db_schema_load.log echo "------" > /var/log/db_schema_load.log
for file in $(ls -v /usr/local/openbmp/database/*.sql); do for file in $(ls -v /usr/local/openbmp/database/*.sql); do
echo " ===[ $file ] ========================================" >> /var/log/db_schema_load.log echo " ===[ $file ] ========================================" >> /var/log/db_schema_load.log