Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

upgrade to 15-3.4 #441

Merged
merged 1 commit into from
Aug 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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';\""