Skip to content

Commit

Permalink
upgrade to 15-3.4 (#441)
Browse files Browse the repository at this point in the history
  • Loading branch information
NyakudyaA authored Aug 19, 2023
1 parent 56643f4 commit d00a5f6
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 36 deletions.
2 changes: 1 addition & 1 deletion .example.env
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@ LANGS="en_US.UTF-8,id_ID.UTF-8"

POSTGRES_MAJOR_VERSION=15
POSTGIS_MAJOR_VERSION=3
POSTGIS_MINOR_RELEASE=3
POSTGIS_MINOR_RELEASE=4
BUILD_TIMESCALE=false
4 changes: 2 additions & 2 deletions .github/workflows/build-latest.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
postgisMajorVersion:
- 3
postgisMinorRelease:
- 3
- 4
scenario:
- datadir_init
- streaming_replication
Expand Down Expand Up @@ -93,7 +93,7 @@ jobs:
postgisMajorVersion:
- 3
postgisMinorRelease:
- 3
- 4
include:
- distro: debian
imageVersion: bookworm
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/deploy-image.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
postgisMajorVersion:
- 3
postgisMinorRelease:
- 3
- 4
include:
- distro: debian
imageVersion: bookworm
Expand Down
9 changes: 3 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ FROM postgis-base AS postgis-prod
ARG IMAGE_VERSION
ARG POSTGRES_MAJOR_VERSION=15
ARG POSTGIS_MAJOR_VERSION=3
ARG POSTGIS_MINOR_RELEASE=3
ARG POSTGIS_MINOR_RELEASE=4
ARG TIMESCALE_VERSION=2-2.9.1
ARG BUILD_TIMESCALE=false

Expand Down Expand Up @@ -119,9 +119,8 @@ RUN if [ "${BUILD_TIMESCALE}" = "true" ]; then \
apt-get -y --no-install-recommends install timescaledb-${TIMESCALE_VERSION}-postgresql-${POSTGRES_MAJOR_VERSION} timescaledb-tools;\
fi;

RUN echo $POSTGRES_MAJOR_VERSION >/tmp/pg_version.txt
RUN echo $POSTGIS_MAJOR_VERSION >/tmp/pg_major_version.txt
RUN echo $POSTGIS_MINOR_RELEASE >/tmp/pg_minor_version.txt
RUN echo $POSTGRES_MAJOR_VERSION >/tmp/pg_version.txt && echo $POSTGIS_MAJOR_VERSION >/tmp/pg_major_version.txt && \
echo $POSTGIS_MINOR_RELEASE >/tmp/pg_minor_version.txt
ENV \
PATH="$PATH:/usr/lib/postgresql/${POSTGRES_MAJOR_VERSION}/bin"
# Compile pointcloud extension
Expand All @@ -131,8 +130,6 @@ cd pointcloud-master && \
./autogen.sh && ./configure && make -j 4 && make install && \
cd .. && rm -Rf pointcloud-master



# Cleanup resources
RUN apt-get -y --purge autoremove \
&& apt-get clean \
Expand Down
4 changes: 2 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ volumes:
services:

db:
image: kartoza/postgis:15-3.3
image: kartoza/postgis:${POSTGRES_MAJOR_VERSION}-${POSTGIS_MAJOR_VERSION}.${POSTGIS_MINOR_RELEASE}
volumes:
- postgis-data:/var/lib/postgresql
- dbbackups:/backups
Expand All @@ -28,7 +28,7 @@ services:


dbbackups:
image: kartoza/pg-backup:15-3.3
image: kartoza/pg-backup:${POSTGRES_MAJOR_VERSION}-${POSTGIS_MAJOR_VERSION}.${POSTGIS_MINOR_RELEASE}
hostname: pg-backups
volumes:
- dbbackups:/backups
Expand Down
12 changes: 12 additions & 0 deletions scripts/env-data.sh
Original file line number Diff line number Diff line change
Expand Up @@ -515,6 +515,7 @@ function over_write_conf() {

}


function extension_install() {
DATABASE=$1
IFS=':'
Expand Down Expand Up @@ -550,6 +551,7 @@ function extension_install() {
fi

}

function directory_checker() {
DATA_PATH=$1
if [ -d $DATA_PATH ];then
Expand Down Expand Up @@ -578,3 +580,13 @@ function non_root_permission() {

}

function role_check() {
ROLE_NAME=$1
echo "Creating user $1"
RESULT=$(su - postgres -c "psql postgres -t -c \"SELECT 1 FROM pg_roles WHERE rolname = '$ROLE_NAME'\"")
COMMAND="ALTER"
if [ -z "$RESULT" ]; then
export COMMAND="CREATE"
fi

}
28 changes: 4 additions & 24 deletions scripts/setup-user.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,32 +4,12 @@ source /scripts/env-data.sh

# This script will setup new configured user

# Note that $POSTGRES_USER and $POSTGRES_PASS below are optional parameters that can be passed
# via docker run e.g.
#docker run --name="postgis" -e POSTGRES_USER=qgis -e POSTGRES_PASS=qgis -d -v
#/var/docker-data/postgres-dat:/var/lib/postgresql -t qgis/postgis:6

# If you dont specify a user/password in docker run, we will generate one
# here and create a user called 'docker' to go with it.

# Only create credentials if this is a master database
# Slave database will just mirror from master users

# Check user already exists
echo "Creating superuser $POSTGRES_USER"
RESULT=`su - postgres -c "psql postgres -t -c \"SELECT 1 FROM pg_roles WHERE rolname = '$POSTGRES_USER'\""`
COMMAND="ALTER"
if [ -z "$RESULT" ]; then
COMMAND="CREATE"
fi

role_check $POSTGRES_USER
su - postgres -c "psql postgres -c \"$COMMAND USER $POSTGRES_USER WITH SUPERUSER ENCRYPTED PASSWORD '$POSTGRES_PASS';\""


echo "Creating replication user $REPLICATION_USER"
RESULT_REPLICATION=`su - postgres -c "psql postgres -t -c \"SELECT 1 FROM pg_roles WHERE rolname = '$REPLICATION_USER'\""`
COMMANDS="ALTER"
if [ -z "$RESULT_REPLICATION" ]; then
COMMANDS="CREATE"
fi
su - postgres -c "psql postgres -c \"$COMMANDS USER $REPLICATION_USER WITH REPLICATION ENCRYPTED PASSWORD '$REPLICATION_PASS';\""
role_check $REPLICATION_USER
su - postgres -c "psql postgres -c \"$COMMAND USER $REPLICATION_USER WITH REPLICATION ENCRYPTED PASSWORD '$REPLICATION_PASS';\""

0 comments on commit d00a5f6

Please sign in to comment.