diff --git a/.github/workflows/docker-image-testing.yml b/.github/workflows/docker-image-testing.yml new file mode 100644 index 0000000..e91027a --- /dev/null +++ b/.github/workflows/docker-image-testing.yml @@ -0,0 +1,102 @@ +name: Build and push pgtuned images + +on: + push: + branches: [ dev ] + pull_request: + branches: [ dev ] + +jobs: + build: + strategy: + matrix: + include: + - postgres_version: 15 + tags: esgn/pgtuned-testing:15, esgn/pgtuned-testing:latest + - postgres_version: 15 + postgis_version: 3 + tags: esgn/pgtuned-testing:15-3, esgn/pgtuned-testing:postgis-latest + - postgres_version: 14 + tags: esgn/pgtuned-testing:14 + - postgres_version: 14 + postgis_version: 3 + tags: esgn/pgtuned-testing:14-3 + - postgres_version: 13 + tags: esgn/pgtuned-testing:13 + - postgres_version: 13 + postgis_version: 3 + tags: esgn/pgtuned-testing:13-3 + - postgres_version: 12 + tags: esgn/pgtuned-testing:12 + - postgres_version: 12 + postgis_version: 3 + tags: esgn/pgtuned-testing:12-3 + - postgres_version: 11-bullseye + tags: esgn/pgtuned-testing:11 + - postgres_version: 11-bullseye + postgis_version: 3 + tags: esgn/pgtuned-testing:11-3 + - postgres_version: 11 + postgis_version: 2.5 + tags: esgn/pgtuned-testing:11-2.5 + - postgres_version: 10-bullseye + tags: esgn/pgtuned-testing:10 + - postgres_version: 10-bullseye + postgis_version: 3 + tags: esgn/pgtuned-testing:10-3 + - postgres_version: 10 + postgis_version: 2.5 + tags: esgn/pgtuned-testing:10-2.5 + - postgres_version: 10 + postgis_version: 2.4 + tags: esgn/pgtuned-testing:10-2.4 + - postgres_version: 9.6-bullseye + tags: esgn/pgtuned-testing:9.6 + - postgres_version: 9.6-bullseye + postgis_version: 3 + tags: esgn/pgtuned-testing:9.6-3 + - postgres_version: 9.6 + postgis_version: 2.5 + tags: esgn/pgtuned-testing:9.6-2.5 + - postgres_version: 9.6 + postgis_version: 2.4 + tags: esgn/pgtuned-testing:9.6-2.4 + - postgres_version: 9.6 + postgis_version: 2.3 + tags: esgn/pgtuned-testing:9.6-2.3 + - postgres_version: 9.5 + tags: esgn/pgtuned-testing:9.5 + - postgres_version: 9.5 + postgis_version: 3 + tags: esgn/pgtuned-testing:9.5-3 + - postgres_version: 9.5 + postgis_version: 2.5 + tags: esgn/pgtuned-testing:9.5-2.5 + - postgres_version: 9.5 + postgis_version: 2.4 + tags: esgn/pgtuned-testing:9.5-24 + - postgres_version: 9.5 + postgis_version: 2.3 + tags: esgn/pgtuned-testing:9.5-2.3 + + runs-on: ubuntu-latest + + steps: + - name: Check out the repo + uses: actions/checkout@v2 + + - name: Log in to Docker Hub + uses: docker/login-action@v1.12.0 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + + - name: Build docker image + uses: docker/build-push-action@v2.9.0 + with: + context: . + push: true + build-args: | + POSTGRES_VERSION=${{ matrix.postgres_version }} + POSTGIS_VERSION=${{ matrix.postgis_version }} + tags: ${{ matrix.tags }} diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml index 72fcfbf..388a698 100644 --- a/.github/workflows/docker-image.yml +++ b/.github/workflows/docker-image.yml @@ -5,266 +5,98 @@ on: branches: [ main ] pull_request: branches: [ main ] - -concurrency: docker-image-ci jobs: - build: + strategy: + matrix: + include: + - postgres_version: 15 + tags: esgn/pgtuned:15, esgn/pgtuned:latest + - postgres_version: 15 + postgis_version: 3 + tags: esgn/pgtuned:15-3, esgn/pgtuned:postgis-latest + - postgres_version: 14 + tags: esgn/pgtuned:14 + - postgres_version: 14 + postgis_version: 3 + tags: esgn/pgtuned:14-3 + - postgres_version: 13 + tags: esgn/pgtuned:13 + - postgres_version: 13 + postgis_version: 3 + tags: esgn/pgtuned:13-3 + - postgres_version: 12 + tags: esgn/pgtuned:12 + - postgres_version: 12 + postgis_version: 3 + tags: esgn/pgtuned:12-3 + - postgres_version: 11-bullseye + tags: esgn/pgtuned:11 + - postgres_version: 11-bullseye + postgis_version: 3 + tags: esgn/pgtuned:11-3 + - postgres_version: 11 + postgis_version: 2.5 + tags: esgn/pgtuned:11-2.5 + - postgres_version: 10-bullseye + tags: esgn/pgtuned:10 + - postgres_version: 10-bullseye + postgis_version: 3 + tags: esgn/pgtuned:10-3 + - postgres_version: 10 + postgis_version: 2.5 + tags: esgn/pgtuned:10-2.5 + - postgres_version: 10 + postgis_version: 2.4 + tags: esgn/pgtuned:10-2.4 + - postgres_version: 9.6-bullseye + tags: esgn/pgtuned:9.6 + - postgres_version: 9.6-bullseye + postgis_version: 3 + tags: esgn/pgtuned:9.6-3 + - postgres_version: 9.6 + postgis_version: 2.5 + tags: esgn/pgtuned:9.6-2.5 + - postgres_version: 9.6 + postgis_version: 2.4 + tags: esgn/pgtuned:9.6-2.4 + - postgres_version: 9.6 + postgis_version: 2.3 + tags: esgn/pgtuned:9.6-2.3 + - postgres_version: 9.5 + tags: esgn/pgtuned:9.5 + - postgres_version: 9.5 + postgis_version: 3 + tags: esgn/pgtuned:9.5-3 + - postgres_version: 9.5 + postgis_version: 2.5 + tags: esgn/pgtuned:9.5-2.5 + - postgres_version: 9.5 + postgis_version: 2.4 + tags: esgn/pgtuned:9.5-24 + - postgres_version: 9.5 + postgis_version: 2.3 + tags: esgn/pgtuned:9.5-2.3 runs-on: ubuntu-latest steps: - - name: Check out the repo - uses: actions/checkout@v2 - - - name: Log in to Docker Hub - uses: docker/login-action@v1.12.0 - with: - username: ${{ secrets.DOCKERHUB_USERNAME }} - password: ${{ secrets.DOCKERHUB_TOKEN }} - - - name: Extract metadata (tags, labels) for Docker - id: meta - uses: docker/metadata-action@v3.6.2 - with: - images: esgn/pgtuned - - - - - name: Build docker image with latest postgresql and postgis - uses: docker/build-push-action@v2.9.0 - with: - context: . - push: true - build-args: | - POSTGRES_VERSION=14 - POSTGIS_VERSION=3 - tags: esgn/pgtuned:14-3, esgn/pgtuned:postgis-latest - - - name: Build docker image with latest postgresql but without postgis - uses: docker/build-push-action@v2.9.0 - with: - context: . - push: true - build-args: | - POSTGRES_VERSION=14 - tags: esgn/pgtuned:14, esgn/pgtuned:latest - - - - - name: Build docker image with postgresql 13 and postgis 3 - uses: docker/build-push-action@v2.9.0 - with: - context: . - push: true - build-args: | - POSTGRES_VERSION=13 - POSTGIS_VERSION=3 - tags: esgn/pgtuned:13-3 - - - name: Build docker image with postgresql 13 but without postgis - uses: docker/build-push-action@v2.9.0 - with: - context: . - push: true - build-args: | - POSTGRES_VERSION=13 - tags: esgn/pgtuned:13 - - - - - name: Build docker image with postgresql 12 and postgis 3 - uses: docker/build-push-action@v2.9.0 - with: - context: . - push: true - build-args: | - POSTGRES_VERSION=12 - POSTGIS_VERSION=3 - tags: esgn/pgtuned:12-3 - - - name: Build docker image with postgresql 12 but without postgis - uses: docker/build-push-action@v2.9.0 - with: - context: . - push: true - build-args: | - POSTGRES_VERSION=12 - tags: esgn/pgtuned:12 - - - - - name: Build docker image with postgresql 11 and postgis 3 - uses: docker/build-push-action@v2.9.0 - with: - context: . - push: true - build-args: | - POSTGRES_VERSION=11 - POSTGIS_VERSION=3 - tags: esgn/pgtuned:11-3 - - - name: Build docker image with postgresql 11 and postgis 2.5 - uses: docker/build-push-action@v2.9.0 - with: - context: . - push: true - build-args: | - POSTGRES_VERSION=11 - POSTGIS_VERSION=2.5 - tags: esgn/pgtuned:11-2.5 - - - name: Build docker image with postgresql 11 but without postgis - uses: docker/build-push-action@v2.9.0 - with: - context: . - push: true - build-args: | - POSTGRES_VERSION=11 - tags: esgn/pgtuned:11 - - - - - name: Build docker image with postgresql 10 and postgis 3 - uses: docker/build-push-action@v2.9.0 - with: - context: . - push: true - build-args: | - POSTGRES_VERSION=10 - POSTGIS_VERSION=3 - tags: esgn/pgtuned:10-3 - - - name: Build docker image with postgresql 10 and postgis 2.5 - uses: docker/build-push-action@v2.9.0 - with: - context: . - push: true - build-args: | - POSTGRES_VERSION=10 - POSTGIS_VERSION=2.5 - tags: esgn/pgtuned:10-2.5 - - - name: Build docker image with postgresql 10 and postgis 2.4 - uses: docker/build-push-action@v2.9.0 - with: - context: . - push: true - build-args: | - POSTGRES_VERSION=10 - POSTGIS_VERSION=2.4 - tags: esgn/pgtuned:10-2.4 - - - name: Build docker image with postgresql 10 but without postgis - uses: docker/build-push-action@v2.9.0 - with: - context: . - push: true - build-args: | - POSTGRES_VERSION=10 - tags: esgn/pgtuned:10 - - - - - name: Build docker image with postgresql 9.6 and postgis 3 - uses: docker/build-push-action@v2.9.0 - with: - context: . - push: true - build-args: | - POSTGRES_VERSION=9.6 - POSTGIS_VERSION=3 - tags: esgn/pgtuned:9.6-3 - - - name: Build docker image with postgresql 9.6 and postgis 2.5 - uses: docker/build-push-action@v2.9.0 - with: - context: . - push: true - build-args: | - POSTGRES_VERSION=9.6 - POSTGIS_VERSION=2.5 - tags: esgn/pgtuned:9.6-2.5 - - - name: Build docker image with postgresql 9.6 and postgis 2.4 - uses: docker/build-push-action@v2.9.0 - with: - context: . - push: true - build-args: | - POSTGRES_VERSION=9.6 - POSTGIS_VERSION=2.4 - tags: esgn/pgtuned:9.6-2.4 - - - name: Build docker image with postgresql 9.6 and postgis 2.3 - uses: docker/build-push-action@v2.9.0 - with: - context: . - push: true - build-args: | - POSTGRES_VERSION=9.6 - POSTGIS_VERSION=2.3 - tags: esgn/pgtuned:9.6-2.3 - - - name: Build docker image with postgresql 9.6 but without postgis - uses: docker/build-push-action@v2.9.0 - with: - context: . - push: true - build-args: | - POSTGRES_VERSION=9.6 - tags: esgn/pgtuned:9.6 - - - - - name: Build docker image with postgresql 9.5 and postgis 3 - uses: docker/build-push-action@v2.9.0 - with: - context: . - push: true - build-args: | - POSTGRES_VERSION=9.5 - POSTGIS_VERSION=3 - tags: esgn/pgtuned:9.5-3 - - - name: Build docker image with postgresql 9.5 and postgis 2.5 - uses: docker/build-push-action@v2.9.0 - with: - context: . - push: true - build-args: | - POSTGRES_VERSION=9.5 - POSTGIS_VERSION=2.5 - tags: esgn/pgtuned:9.5-2.5 - - - name: Build docker image with postgresql 9.5 and postgis 2.4 - uses: docker/build-push-action@v2.9.0 - with: - context: . - push: true - build-args: | - POSTGRES_VERSION=9.5 - POSTGIS_VERSION=2.4 - tags: esgn/pgtuned:9.5-2.4 - - - name: Build docker image with postgresql 9.5 and postgis 2.3 - uses: docker/build-push-action@v2.9.0 - with: - context: . - push: true - build-args: | - POSTGRES_VERSION=9.5 - POSTGIS_VERSION=2.3 - tags: esgn/pgtuned:9.5-2.3 - - - name: Build docker image with postgresql 9.5 but without postgis - uses: docker/build-push-action@v2.9.0 - with: - context: . - push: true - build-args: | - POSTGRES_VERSION=9.5 - tags: esgn/pgtuned:9.5 - - + - name: Check out the repo + uses: actions/checkout@v2 + + - name: Log in to Docker Hub + uses: docker/login-action@v1.12.0 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + + - name: Build docker image + uses: docker/build-push-action@v2.9.0 + with: + context: . + push: true + build-args: | + POSTGRES_VERSION=${{ matrix.postgres_version }} + POSTGIS_VERSION=${{ matrix.postgis_version }} + tags: ${{ matrix.tags }} diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..2211df6 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +*.txt diff --git a/Dockerfile b/Dockerfile index 1601fe8..2801ac2 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,8 +1,8 @@ -ARG POSTGRES_VERSION=14 +ARG POSTGRES_VERSION=15 FROM postgres:${POSTGRES_VERSION} -ARG POSTGIS_VERSION= +ARG POSTGIS_VERSION ENV DB_TYPE= ENV PG_VERSION= @@ -11,15 +11,20 @@ ENV CPU_COUNT= ENV MAX_CONN= ENV STGE_TYPE= +# Fix old postgres stretch images +COPY apt_archive_patch.sh /tmp +RUN /bin/bash /tmp/apt_archive_patch.sh +RUN rm /tmp/apt_archive_patch.sh + # PostGIS install if required RUN if [ ! -z $POSTGIS_VERSION ]; \ - then apt-get update \ - && apt-get install -y postgresql-${PG_MAJOR}-postgis-${POSTGIS_VERSION} \ - && apt-get install -y postgresql-${PG_MAJOR}-postgis-${POSTGIS_VERSION}-scripts \ - && apt-get install -y postgresql-${PG_MAJOR}-pgrouting \ - && apt-get install -y --no-install-recommends postgis \ - && rm -rf /var/lib/apt/lists/*; \ - fi + then apt-get update \ + && apt-get install -y postgresql-${PG_MAJOR}-postgis-${POSTGIS_VERSION} \ + && apt-get install -y postgresql-${PG_MAJOR}-postgis-${POSTGIS_VERSION}-scripts \ + && apt-get install -y postgresql-${PG_MAJOR}-pgrouting \ + && apt-get install -y --no-install-recommends postgis \ + && rm -rf /var/lib/apt/lists/*; \ + fi # Run the rest of the commands as postgres user USER postgres:postgres diff --git a/README.md b/README.md index 5aa9820..104e214 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ This project includes a bash script equivalent of [PGTune](https://github.com/le ## `pgtune.sh` -This `pgtune.sh` script is a bash port of [PGTune](https://github.com/le0pard/pgtune). +This `pgtune.sh` script is a bash port of [PGTune](https://github.com/le0pard/pgtune) with additions for system resources detection. All arguments have been rendered optional. The script will either use default value or try and automatically determine the parameter value. ``` @@ -17,8 +17,8 @@ It produces a postgresql.conf file based on supplied parameters. -h display this help and exit -v PG_VERSION (optional) PostgreSQL version - accepted values: 9.5, 9.6, 10, 11, 12, 13, 14 - default value: 14 + accepted values: 9.5, 9.6, 10, 11, 12, 13, 14, 15 + default value: 15 -t DB_TYPE (optional) For what type of application is PostgreSQL used accepted values: web, oltp, dw, desktop, mixed default value: web @@ -52,13 +52,13 @@ When running the PGTuned image as a container, the `pgtuned.sh` script replaces ### Building PGTuned image The build stage of the PGTuned image accepts **two optional build arguments** : -* `POSTGRES_VERSION` corresponds to any tag available in the [official PostgreSQL Docker image](https://hub.docker.com/_/postgres) save the `alpine` tags (examples : 14, 13.6, 11.15-stretch, ...). If omitted the `14` tag will be used. +* `POSTGRES_VERSION` corresponds to any tag available in the [official PostgreSQL Docker image](https://hub.docker.com/_/postgres) save the `alpine` tags (examples : 14, 13.6, 11.15-stretch, ...). If omitted the `15` tag will be used. * `POSTGIS_VERSION` corresponds to the version of [PostGIS](https://postgis.net/) that will be installed. The selected version of PostGIS must be available in the packages of the chosen PostgreSQL image. If omitted PostGIS will not be installed.
Below are command line examples to build different version of the PGTuned image : -* Build the `pgtuned` image using `postgres:14` image **without PostGIS** : +* Build the `pgtuned` image using `postgres:15` image **without PostGIS** : ``` docker build --no-cache . -t pgtuned @@ -76,12 +76,17 @@ docker build --no-cache --build-arg POSTGRES_VERSION=13 . -t pgtuned:13 docker build --no-cache --build-arg POSTGRES_VERSION=11 --build-arg POSTGIS_VERSION=2.5 . -t pgtuned:11-2.5 ``` -:point_right: The helper script `check-compatibility.sh` runs the main versions of the official Docker PostgreSQL image and checks available PostGIS versions for each. This could be used as a guide to select the correct version of PostGIS for each PostgreSQL image version. +:point_right: The helper script `test/scripts/check_compatibility.sh` runs the main versions of the official Docker PostgreSQL image and checks available PostGIS versions for each. This could be used as a guide to select the correct version of PostGIS for each PostgreSQL image version. Note that a patch is applied for `postgres` images older than 12 still running on Debian Stretch.
-View ouput of check-compatibility.sh +View ouput of check_compatibility.sh
 
+Examining postgres:15
+######################
+Available PostGIS versions : 3
+Running on Debian GNU/Linux 11 (bullseye)
+
Examining postgres:14 ###################### Available PostGIS versions : 3 @@ -99,21 +104,40 @@ Running on Debian GNU/Linux 11 (bullseye)
Examining postgres:11 ###################### +applying apt-archive.postgres.org patch Available PostGIS versions : 2.5 3 Running on Debian GNU/Linux 9 (stretch)
+Examining postgres:11-bullseye +###################### +Available PostGIS versions : 3 +Running on Debian GNU/Linux 11 (bullseye) +
Examining postgres:10 ###################### +applying apt-archive.postgres.org patch Available PostGIS versions : 2.4 2.5 3 Running on Debian GNU/Linux 9 (stretch)
+Examining postgres:10-bullseye +###################### +Available PostGIS versions : 3 +Running on Debian GNU/Linux 11 (bullseye) +
Examining postgres:9.6 ###################### +applying apt-archive.postgres.org patch Available PostGIS versions : 2.3 2.4 2.5 3 Running on Debian GNU/Linux 9 (stretch)
+Examining postgres:9.6-bullseye +###################### +Available PostGIS versions : 3 +Running on Debian GNU/Linux 11 (bullseye) +
Examining postgres:9.5 ###################### +applying apt-archive.postgres.org patch Available PostGIS versions : 2.3 2.4 2.5 3 Running on Debian GNU/Linux 9 (stretch)
@@ -174,9 +198,9 @@ checkpoint_completion_target = 0.9 ### Using PGTuned images directly from Docker hub -This project builds a small number of versions of the PGTuned image and deploy them to [Docker Hub](https://hub.docker.com/r/esgn/pgtuned) using the following tags : -* `latest` corresponds to PostgreSQL 14 -* `postgis-latest` corresponds to PostgreSQL 14 and PostGIS 3 +This project builds a number of versions of the PGTuned image and deploy them to [Docker Hub](https://hub.docker.com/r/esgn/pgtuned) using the following tags : +* `latest` corresponds to PostgreSQL 15 +* `postgis-latest` corresponds to PostgreSQL 15 and PostGIS 3 * `POSTGRES_VERSION` corresponds to a specific PostgreSQL image version (e.g. 12) without PostGIS * `POSTGRES_VERSION-POSTGIS_VERSION` corresponds to a specific PostgreSQL image version including a specific PostGIS version (e.g. 12-3) diff --git a/apt_archive_patch.sh b/apt_archive_patch.sh new file mode 100644 index 0000000..1722042 --- /dev/null +++ b/apt_archive_patch.sh @@ -0,0 +1,17 @@ +#!/usr/bin/env bash + +# This script updates the pgdg.list source file present in Debian stretch images +# in order to use apt-archive.postgres.org. This is necessary to apt update as stretch +# has been cycled out and to get access to older versions of PostGIS + +codename=$(source /etc/os-release && echo -n $VERSION_CODENAME) + +if [ "$codename" = "stretch" ] +then + cd /etc/apt/sources.list.d/ + mv pgdg.list pgdg.list.backup + apt-get -qq update + apt-get install apt-transport-https -y + sed -i "s/http\:\/\/apt\.postgres/https\:\/\/apt-archive\.postgres/" pgdg.list.backup + mv pgdg.list.backup pgdg.list +fi diff --git a/check-compatibility.sh b/check-compatibility.sh deleted file mode 100644 index fc6b972..0000000 --- a/check-compatibility.sh +++ /dev/null @@ -1,21 +0,0 @@ -#!/usr/bin/env bash - -# This script runs official PostgreSQL Docker images -# and gets the available PostGIS version for each of them. -# Also ouputs the distribution used for each image. - -pg_versions="14 13 12 11 10 9.6 9.5" - -for v in $pg_versions -do - echo "Examining postgres:$v" - echo "######################" - docker run -d -e POSTGRES_PASSWORD=secret --name pg$v postgres:$v >/dev/null 2>&1 - c="apt update >/dev/null 2>&1 && apt-cache search $v-postgis | grep -Po '(?<=postgresql-$v-postgis-)([0-9\.]*)' | uniq | xargs " - versions=$(docker exec -ti pg$v bash -c "$c") - distrib=$(docker exec -ti pg$v bash -c 'cat /etc/os-release' | grep -Po '(?<=PRETTY_NAME=")(.*)(?=")') - echo "Available PostGIS versions : "$versions - echo "Running on "$distrib - docker rm -f pg$v >/dev/null 2>&1 - echo -done diff --git a/pgtune.sh b/pgtune.sh index 89bc5bc..2c767ee 100644 --- a/pgtune.sh +++ b/pgtune.sh @@ -13,8 +13,8 @@ It produces a postgresql.conf file based on supplied parameters. -h display this help and exit -v PG_VERSION (optional) PostgreSQL version - accepted values: 9.5, 9.6, 10, 11, 12, 13, 14 - default value: 14 + accepted values: 9.5, 9.6, 10, 11, 12, 13, 14, 15 + default value: 15 -t DB_TYPE (optional) For what type of application is PostgreSQL used accepted values: web, oltp, dw, desktop, mixed default value: web @@ -51,7 +51,7 @@ _error() { get_total_ram () { local total_ram=$(cat /proc/meminfo | grep -i 'memtotal' | grep -o '[[:digit:]]*') - if [[ ! $total_ram ]] + if [[ -z $total_ram ]] || [[ "$total_ram" -eq "0" ]] then _error "cannot detect total memory size, terminating script. Please supply -m TOTAL_MEM." fi @@ -60,15 +60,18 @@ get_total_ram () { get_cpu_count () { local cpu_count=$(nproc --all) - if [[ ! $cpu_count ]] + if [[ -z $cpu_count ]] || [[ "$cpu_count" -eq "0" ]] then _error "cannot detect cpu count, terminating script. Please supply -u CPU_COUNT." fi echo $cpu_count } -get_disk_type () { - local disk_type_clue=$(cat /sys/block/sda/queue/rotational 2>/dev/null) +get_disk_type () { + # PGDATA should always be defined in base postgres image + # findmnt should also be installed by default + local disk_name=$(basename $(findmnt -v -n -o SOURCE --target $PGDATA 2>/dev/null) 2>/dev/null) + local disk_type_clue=$(cat /sys/block/$disk_name/queue/rotational 2>/dev/null) case "$disk_type_clue" in "0") disk_type="ssd" @@ -93,7 +96,7 @@ set_db_default_values() { max_worker_processes=8 max_parallel_workers_per_gather=0 ;; - "10" | "11" | "12" | "13" | "14") + "10" | "11" | "12" | "13" | "14" | "15") max_worker_processes=8 max_parallel_workers_per_gather=2 max_parallel_workers=8 @@ -413,7 +416,7 @@ cpu_num=$(get_cpu_count) || exit $? storage_type=$(get_disk_type) conn_nb=0 db_type="web" -db_version=14 +db_version=15 while getopts "hv:t:m:u:c:s:" opt; do case $opt in @@ -429,7 +432,8 @@ while getopts "hv:t:m:u:c:s:" opt; do [ $v != "11" ] && \ [ $v != "12" ] && \ [ $v != "13" ] && \ - [ $v != "14" ] + [ $v != "14" ] && \ + [ $v != "15" ] then _input_error "$v is not a valid PostgreSQL version number" fi @@ -568,6 +572,5 @@ if [ ! -z ${checkpoint_segments+x}] then echo "checkpoint_segments = "$checkpoint_segments fi -echo unset set_parallel_settings diff --git a/test_files/10_linux_web_8GB_8_1000_hdd.txt b/test/expected_results/10_linux_web_8GB_8_1000_hdd.txt similarity index 100% rename from test_files/10_linux_web_8GB_8_1000_hdd.txt rename to test/expected_results/10_linux_web_8GB_8_1000_hdd.txt index 47f5b36..92e38d6 100644 --- a/test_files/10_linux_web_8GB_8_1000_hdd.txt +++ b/test/expected_results/10_linux_web_8GB_8_1000_hdd.txt @@ -19,5 +19,5 @@ work_mem = 524kB min_wal_size = 1GB max_wal_size = 4GB max_worker_processes = 8 -max_parallel_workers_per_gather = 4 max_parallel_workers = 8 +max_parallel_workers_per_gather = 4 diff --git a/test_files/10_linux_web_8GB_8_1000_san.txt b/test/expected_results/10_linux_web_8GB_8_1000_san.txt similarity index 100% rename from test_files/10_linux_web_8GB_8_1000_san.txt rename to test/expected_results/10_linux_web_8GB_8_1000_san.txt index b05417e..51fd1bd 100644 --- a/test_files/10_linux_web_8GB_8_1000_san.txt +++ b/test/expected_results/10_linux_web_8GB_8_1000_san.txt @@ -19,5 +19,5 @@ work_mem = 524kB min_wal_size = 1GB max_wal_size = 4GB max_worker_processes = 8 -max_parallel_workers_per_gather = 4 max_parallel_workers = 8 +max_parallel_workers_per_gather = 4 diff --git a/test_files/10_linux_web_8GB_8_1000_ssd.txt b/test/expected_results/10_linux_web_8GB_8_1000_ssd.txt similarity index 100% rename from test_files/10_linux_web_8GB_8_1000_ssd.txt rename to test/expected_results/10_linux_web_8GB_8_1000_ssd.txt index f752792..f8f97ec 100644 --- a/test_files/10_linux_web_8GB_8_1000_ssd.txt +++ b/test/expected_results/10_linux_web_8GB_8_1000_ssd.txt @@ -19,5 +19,5 @@ work_mem = 524kB min_wal_size = 1GB max_wal_size = 4GB max_worker_processes = 8 -max_parallel_workers_per_gather = 4 max_parallel_workers = 8 +max_parallel_workers_per_gather = 4 diff --git a/test_files/11_linux_web_8GB_8_1000_hdd.txt b/test/expected_results/11_linux_web_8GB_8_1000_hdd.txt similarity index 100% rename from test_files/11_linux_web_8GB_8_1000_hdd.txt rename to test/expected_results/11_linux_web_8GB_8_1000_hdd.txt index a5d68a1..e60a407 100644 --- a/test_files/11_linux_web_8GB_8_1000_hdd.txt +++ b/test/expected_results/11_linux_web_8GB_8_1000_hdd.txt @@ -19,6 +19,6 @@ work_mem = 524kB min_wal_size = 1GB max_wal_size = 4GB max_worker_processes = 8 -max_parallel_workers_per_gather = 4 max_parallel_workers = 8 max_parallel_maintenance_workers = 4 +max_parallel_workers_per_gather = 4 diff --git a/test_files/11_linux_web_8GB_8_1000_san.txt b/test/expected_results/11_linux_web_8GB_8_1000_san.txt similarity index 93% rename from test_files/11_linux_web_8GB_8_1000_san.txt rename to test/expected_results/11_linux_web_8GB_8_1000_san.txt index b5cf298..4d1e461 100644 --- a/test_files/11_linux_web_8GB_8_1000_san.txt +++ b/test/expected_results/11_linux_web_8GB_8_1000_san.txt @@ -19,6 +19,6 @@ work_mem = 524kB min_wal_size = 1GB max_wal_size = 4GB max_worker_processes = 8 -max_parallel_workers_per_gather = 4 max_parallel_workers = 8 -max_parallel_maintenance_workers = 4 \ No newline at end of file +max_parallel_maintenance_workers = 4 +max_parallel_workers_per_gather = 4 diff --git a/test_files/11_linux_web_8GB_8_1000_ssd.txt b/test/expected_results/11_linux_web_8GB_8_1000_ssd.txt similarity index 100% rename from test_files/11_linux_web_8GB_8_1000_ssd.txt rename to test/expected_results/11_linux_web_8GB_8_1000_ssd.txt index 126d21f..e6d8329 100644 --- a/test_files/11_linux_web_8GB_8_1000_ssd.txt +++ b/test/expected_results/11_linux_web_8GB_8_1000_ssd.txt @@ -19,6 +19,6 @@ work_mem = 524kB min_wal_size = 1GB max_wal_size = 4GB max_worker_processes = 8 -max_parallel_workers_per_gather = 4 max_parallel_workers = 8 max_parallel_maintenance_workers = 4 +max_parallel_workers_per_gather = 4 diff --git a/test_files/12_linux_web_8GB_8_1000_hdd.txt b/test/expected_results/12_linux_web_8GB_8_1000_hdd.txt similarity index 100% rename from test_files/12_linux_web_8GB_8_1000_hdd.txt rename to test/expected_results/12_linux_web_8GB_8_1000_hdd.txt index 02b497b..62680a6 100644 --- a/test_files/12_linux_web_8GB_8_1000_hdd.txt +++ b/test/expected_results/12_linux_web_8GB_8_1000_hdd.txt @@ -19,6 +19,6 @@ work_mem = 524kB min_wal_size = 1GB max_wal_size = 4GB max_worker_processes = 8 -max_parallel_workers_per_gather = 4 max_parallel_workers = 8 max_parallel_maintenance_workers = 4 +max_parallel_workers_per_gather = 4 diff --git a/test_files/12_linux_web_8GB_8_1000_san.txt b/test/expected_results/12_linux_web_8GB_8_1000_san.txt similarity index 93% rename from test_files/12_linux_web_8GB_8_1000_san.txt rename to test/expected_results/12_linux_web_8GB_8_1000_san.txt index c6932ad..5370a44 100644 --- a/test_files/12_linux_web_8GB_8_1000_san.txt +++ b/test/expected_results/12_linux_web_8GB_8_1000_san.txt @@ -19,6 +19,6 @@ work_mem = 524kB min_wal_size = 1GB max_wal_size = 4GB max_worker_processes = 8 -max_parallel_workers_per_gather = 4 max_parallel_workers = 8 -max_parallel_maintenance_workers = 4 \ No newline at end of file +max_parallel_maintenance_workers = 4 +max_parallel_workers_per_gather = 4 diff --git a/test_files/12_linux_web_8GB_8_1000_ssd.txt b/test/expected_results/12_linux_web_8GB_8_1000_ssd.txt similarity index 100% rename from test_files/12_linux_web_8GB_8_1000_ssd.txt rename to test/expected_results/12_linux_web_8GB_8_1000_ssd.txt index 995f9ca..994fb82 100644 --- a/test_files/12_linux_web_8GB_8_1000_ssd.txt +++ b/test/expected_results/12_linux_web_8GB_8_1000_ssd.txt @@ -19,6 +19,6 @@ work_mem = 524kB min_wal_size = 1GB max_wal_size = 4GB max_worker_processes = 8 -max_parallel_workers_per_gather = 4 max_parallel_workers = 8 max_parallel_maintenance_workers = 4 +max_parallel_workers_per_gather = 4 diff --git a/test_files/13_linux_web_8GB_8_1000_hdd.txt b/test/expected_results/13_linux_web_8GB_8_1000_hdd.txt similarity index 100% rename from test_files/13_linux_web_8GB_8_1000_hdd.txt rename to test/expected_results/13_linux_web_8GB_8_1000_hdd.txt index 468d3d4..e69ee5a 100644 --- a/test_files/13_linux_web_8GB_8_1000_hdd.txt +++ b/test/expected_results/13_linux_web_8GB_8_1000_hdd.txt @@ -19,6 +19,6 @@ work_mem = 524kB min_wal_size = 1GB max_wal_size = 4GB max_worker_processes = 8 -max_parallel_workers_per_gather = 4 max_parallel_workers = 8 max_parallel_maintenance_workers = 4 +max_parallel_workers_per_gather = 4 diff --git a/test_files/13_linux_web_8GB_8_1000_san.txt b/test/expected_results/13_linux_web_8GB_8_1000_san.txt similarity index 93% rename from test_files/13_linux_web_8GB_8_1000_san.txt rename to test/expected_results/13_linux_web_8GB_8_1000_san.txt index 8788245..f34648e 100644 --- a/test_files/13_linux_web_8GB_8_1000_san.txt +++ b/test/expected_results/13_linux_web_8GB_8_1000_san.txt @@ -19,6 +19,6 @@ work_mem = 524kB min_wal_size = 1GB max_wal_size = 4GB max_worker_processes = 8 -max_parallel_workers_per_gather = 4 max_parallel_workers = 8 -max_parallel_maintenance_workers = 4 \ No newline at end of file +max_parallel_maintenance_workers = 4 +max_parallel_workers_per_gather = 4 diff --git a/test_files/13_linux_web_8GB_8_1000_ssd.txt b/test/expected_results/13_linux_web_8GB_8_1000_ssd.txt similarity index 100% rename from test_files/13_linux_web_8GB_8_1000_ssd.txt rename to test/expected_results/13_linux_web_8GB_8_1000_ssd.txt index 68723bf..08a9c48 100644 --- a/test_files/13_linux_web_8GB_8_1000_ssd.txt +++ b/test/expected_results/13_linux_web_8GB_8_1000_ssd.txt @@ -19,6 +19,6 @@ work_mem = 524kB min_wal_size = 1GB max_wal_size = 4GB max_worker_processes = 8 -max_parallel_workers_per_gather = 4 max_parallel_workers = 8 max_parallel_maintenance_workers = 4 +max_parallel_workers_per_gather = 4 diff --git a/test_files/14_linux_web_8GB_8_1000_hdd.txt b/test/expected_results/14_linux_web_8GB_8_1000_hdd.txt similarity index 93% rename from test_files/14_linux_web_8GB_8_1000_hdd.txt rename to test/expected_results/14_linux_web_8GB_8_1000_hdd.txt index 11f0658..cae331e 100644 --- a/test_files/14_linux_web_8GB_8_1000_hdd.txt +++ b/test/expected_results/14_linux_web_8GB_8_1000_hdd.txt @@ -19,6 +19,6 @@ work_mem = 524kB min_wal_size = 1GB max_wal_size = 4GB max_worker_processes = 8 -max_parallel_workers_per_gather = 4 max_parallel_workers = 8 -max_parallel_maintenance_workers = 4 \ No newline at end of file +max_parallel_maintenance_workers = 4 +max_parallel_workers_per_gather = 4 diff --git a/test_files/14_linux_web_8GB_8_1000_san.txt b/test/expected_results/14_linux_web_8GB_8_1000_san.txt similarity index 93% rename from test_files/14_linux_web_8GB_8_1000_san.txt rename to test/expected_results/14_linux_web_8GB_8_1000_san.txt index f85ed56..ddf738b 100644 --- a/test_files/14_linux_web_8GB_8_1000_san.txt +++ b/test/expected_results/14_linux_web_8GB_8_1000_san.txt @@ -19,6 +19,6 @@ work_mem = 524kB min_wal_size = 1GB max_wal_size = 4GB max_worker_processes = 8 -max_parallel_workers_per_gather = 4 max_parallel_workers = 8 -max_parallel_maintenance_workers = 4 \ No newline at end of file +max_parallel_maintenance_workers = 4 +max_parallel_workers_per_gather = 4 diff --git a/test_files/14_linux_web_8GB_8_1000_ssd.txt b/test/expected_results/14_linux_web_8GB_8_1000_ssd.txt similarity index 100% rename from test_files/14_linux_web_8GB_8_1000_ssd.txt rename to test/expected_results/14_linux_web_8GB_8_1000_ssd.txt index 428e03d..f88a45c 100644 --- a/test_files/14_linux_web_8GB_8_1000_ssd.txt +++ b/test/expected_results/14_linux_web_8GB_8_1000_ssd.txt @@ -19,6 +19,6 @@ work_mem = 524kB min_wal_size = 1GB max_wal_size = 4GB max_worker_processes = 8 -max_parallel_workers_per_gather = 4 max_parallel_workers = 8 max_parallel_maintenance_workers = 4 +max_parallel_workers_per_gather = 4 diff --git a/test/expected_results/15_linux_web_8GB_8_1000_hdd.txt b/test/expected_results/15_linux_web_8GB_8_1000_hdd.txt new file mode 100644 index 0000000..6ae554a --- /dev/null +++ b/test/expected_results/15_linux_web_8GB_8_1000_hdd.txt @@ -0,0 +1,24 @@ +# DB Version: 15 +# OS Type: linux +# DB Type: web +# Total Memory (RAM): 8 GB +# CPUs num: 8 +# Connections num: 1000 +# Data Storage: hdd + +max_connections = 1000 +shared_buffers = 2GB +effective_cache_size = 6GB +maintenance_work_mem = 512MB +checkpoint_completion_target = 0.9 +wal_buffers = 16MB +default_statistics_target = 100 +random_page_cost = 4 +effective_io_concurrency = 2 +work_mem = 524kB +min_wal_size = 1GB +max_wal_size = 4GB +max_worker_processes = 8 +max_parallel_workers = 8 +max_parallel_maintenance_workers = 4 +max_parallel_workers_per_gather = 4 diff --git a/test/expected_results/15_linux_web_8GB_8_1000_san.txt b/test/expected_results/15_linux_web_8GB_8_1000_san.txt new file mode 100644 index 0000000..4e6b3de --- /dev/null +++ b/test/expected_results/15_linux_web_8GB_8_1000_san.txt @@ -0,0 +1,24 @@ +# DB Version: 15 +# OS Type: linux +# DB Type: web +# Total Memory (RAM): 8 GB +# CPUs num: 8 +# Connections num: 1000 +# Data Storage: san + +max_connections = 1000 +shared_buffers = 2GB +effective_cache_size = 6GB +maintenance_work_mem = 512MB +checkpoint_completion_target = 0.9 +wal_buffers = 16MB +default_statistics_target = 100 +random_page_cost = 1.1 +effective_io_concurrency = 300 +work_mem = 524kB +min_wal_size = 1GB +max_wal_size = 4GB +max_worker_processes = 8 +max_parallel_workers = 8 +max_parallel_maintenance_workers = 4 +max_parallel_workers_per_gather = 4 diff --git a/test/expected_results/15_linux_web_8GB_8_1000_ssd.txt b/test/expected_results/15_linux_web_8GB_8_1000_ssd.txt new file mode 100644 index 0000000..e7f5203 --- /dev/null +++ b/test/expected_results/15_linux_web_8GB_8_1000_ssd.txt @@ -0,0 +1,24 @@ +# DB Version: 15 +# OS Type: linux +# DB Type: web +# Total Memory (RAM): 8 GB +# CPUs num: 8 +# Connections num: 1000 +# Data Storage: ssd + +max_connections = 1000 +shared_buffers = 2GB +effective_cache_size = 6GB +maintenance_work_mem = 512MB +checkpoint_completion_target = 0.9 +wal_buffers = 16MB +default_statistics_target = 100 +random_page_cost = 1.1 +effective_io_concurrency = 200 +work_mem = 524kB +min_wal_size = 1GB +max_wal_size = 4GB +max_worker_processes = 8 +max_parallel_workers = 8 +max_parallel_maintenance_workers = 4 +max_parallel_workers_per_gather = 4 diff --git a/test_files/9.5_linux_web_8GB_8_1000_hdd.txt b/test/expected_results/9.5_linux_web_8GB_8_1000_hdd.txt similarity index 100% rename from test_files/9.5_linux_web_8GB_8_1000_hdd.txt rename to test/expected_results/9.5_linux_web_8GB_8_1000_hdd.txt diff --git a/test_files/9.5_linux_web_8GB_8_1000_san.txt b/test/expected_results/9.5_linux_web_8GB_8_1000_san.txt similarity index 100% rename from test_files/9.5_linux_web_8GB_8_1000_san.txt rename to test/expected_results/9.5_linux_web_8GB_8_1000_san.txt diff --git a/test_files/9.5_linux_web_8GB_8_1000_ssd.txt b/test/expected_results/9.5_linux_web_8GB_8_1000_ssd.txt similarity index 100% rename from test_files/9.5_linux_web_8GB_8_1000_ssd.txt rename to test/expected_results/9.5_linux_web_8GB_8_1000_ssd.txt diff --git a/test_files/9.6_linux_web_8GB_8_1000_hdd.txt b/test/expected_results/9.6_linux_web_8GB_8_1000_hdd.txt similarity index 100% rename from test_files/9.6_linux_web_8GB_8_1000_hdd.txt rename to test/expected_results/9.6_linux_web_8GB_8_1000_hdd.txt diff --git a/test_files/9.6_linux_web_8GB_8_1000_san.txt b/test/expected_results/9.6_linux_web_8GB_8_1000_san.txt similarity index 100% rename from test_files/9.6_linux_web_8GB_8_1000_san.txt rename to test/expected_results/9.6_linux_web_8GB_8_1000_san.txt diff --git a/test_files/9.6_linux_web_8GB_8_1000_ssd.txt b/test/expected_results/9.6_linux_web_8GB_8_1000_ssd.txt similarity index 100% rename from test_files/9.6_linux_web_8GB_8_1000_ssd.txt rename to test/expected_results/9.6_linux_web_8GB_8_1000_ssd.txt diff --git a/test/scripts/build_run_images.sh b/test/scripts/build_run_images.sh new file mode 100644 index 0000000..3117de4 --- /dev/null +++ b/test/scripts/build_run_images.sh @@ -0,0 +1,38 @@ +#!/usr/bin/env bash + +# This scripts build all possible Debian combination +# of PostgreSQL + PostGIS and outputs PostgreSQL +# configuration file for checking + +declare -a arr=("15|3" + "14|3" + "13|3" + "12|3" + "11-bullseye|3" + "11|2.5" + "10-bullseye|3" + "10|2.5" + "10|2.4" + "9.6-bullseye|3" + "9.6|2.5" + "9.6|2.4" + "9.6|2.3" + "9.5|3" + "9.5|2.5" + "9.5|2.4" + "9.5|2.3" + ) + +IFS='|' +for i in "${arr[@]}" +do + read -ra ADDR <<< "$i" + pg_version="${ADDR[0]}" + postgis_version="${ADDR[1]}" + docker build --no-cache --build-arg POSTGRES_VERSION=$pg_version --build-arg POSTGIS_VERSION=$postgis_version . -t pg$pg_version-$postgis_version + docker run -d -e POSTGRES_PASSWORD=secret --name pg$pg_version-$postgis_version pg$pg_version-$postgis_version + docker exec -ti pg$pg_version-$postgis_version bash -c "until pg_isready -q; do sleep 5; done" + docker exec -ti pg$pg_version-$postgis_version bash -c "cat /etc/apt/sources.list.d/pgdg.list" + docker exec -ti pg$pg_version-$postgis_version bash -c "cat /var/lib/postgresql/data/postgresql.conf" > pg$pg_version-$postgis_version.txt + docker stop pg$pg_version-$postgis_version && docker rm pg$pg_version-$postgis_version +done diff --git a/test/scripts/check_compatibility.sh b/test/scripts/check_compatibility.sh new file mode 100644 index 0000000..9b7a72f --- /dev/null +++ b/test/scripts/check_compatibility.sh @@ -0,0 +1,40 @@ +#!/usr/bin/env bash + +# This script runs official PostgreSQL Docker images +# and gets the available PostGIS version for each of them. +# Also ouputs the distribution used for each image. + +pg_versions="15 14 13 12 11 11-bullseye 10 10-bullseye 9.6 9.6-bullseye 9.5" + +for v in $pg_versions +do + echo "Examining postgres:$v" + echo "######################" + docker run -d -e POSTGRES_PASSWORD=secret --name pg$v postgres:$v >/dev/null 2>&1 + codename=$(docker exec -ti pg$v bash -c "source /etc/os-release && echo -n \$VERSION_CODENAME") + id=$(docker exec -ti pg$v bash -c "source /etc/os-release && echo -n \$ID") + if [ "$id" = "debian" ] + then + if [ "$codename" = "stretch" ] + then + echo "applying apt-archive.postgres.org patch" + c="cd /etc/apt/sources.list.d/ && mv pgdg.list pgdg.list.backup" + docker exec -ti pg$v bash -c "$c" + c="apt-get -qq update && DEBCONF_NOWARNINGS='yes' apt-get install apt-transport-https -y > /dev/null" + docker exec -ti pg$v bash -c "$c" + c="cd /etc/apt/sources.list.d/ && mv pgdg.list.backup pgdg.list" + docker exec -ti pg$v bash -c "$c" + c="sed -i 's/http\:\/\/apt\.postgres/https\:\/\/apt-archive\.postgres/' /etc/apt/sources.list.d/pgdg.list" + docker exec -ti pg$v bash -c "$c" + c="apt-get -qq update" + docker exec -ti pg$v bash -c "$c" + fi + c="apt update >/dev/null 2>&1 && apt-cache search \$PG_MAJOR-postgis | grep -Po \"(?<=postgresql-\$PG_MAJOR-postgis-)([0-9\.]*)\" | uniq | xargs " + versions=$(docker exec -ti pg$v bash -c "$c") + fi + echo "Available PostGIS versions : "$versions + distrib=$(docker exec -ti pg$v bash -c "source /etc/os-release && echo -n \$PRETTY_NAME") + echo "Running on "$distrib + docker rm -f pg$v >/dev/null 2>&1 + echo +done diff --git a/test/scripts/pull_testing_images.sh b/test/scripts/pull_testing_images.sh new file mode 100644 index 0000000..9722d49 --- /dev/null +++ b/test/scripts/pull_testing_images.sh @@ -0,0 +1,19 @@ +#!/usr/bin/env bash + +# This script pulls images from Docker Hub and run them +# to do a simple check of PostgreSQL configuration + +testing_image="esgn/pgtuned-testing" + +tags=$(curl "https://registry.hub.docker.com/v2/repositories/$testing_image/tags?page_size=32" 2>/dev/null | jq -r '.results | .[] | .name') +for tag in $tags +do + image_name=$testing_image":"$tag + docker rmi $image_name &> /dev/null + docker pull -q $image_name + docker run -d -e POSTGRES_PASSWORD=secret --name pg-testing$tag $image_name + docker exec -ti pg-testing$tag bash -c "until pg_isready -q; do sleep 5; done" + docker exec -ti pg-testing$tag bash -c "cat /etc/apt/sources.list.d/pgdg.list" + docker exec -ti pg-testing$tag bash -c "cat /var/lib/postgresql/data/postgresql.conf" > pg-testing$tag".txt" + docker stop pg-testing$tag &> /dev/null && docker rm pg-testing$tag &> /dev/null +done diff --git a/test.sh b/test/scripts/test_pgtune.sh similarity index 78% rename from test.sh rename to test/scripts/test_pgtune.sh index 3acc679..c5f1e2a 100644 --- a/test.sh +++ b/test/scripts/test_pgtune.sh @@ -1,7 +1,11 @@ #!/usr/bin/env bash -test_files_dir="test_files/" -pg_versions="14 13 12 11 10 9.6 9.5" +# This scripts runs pgtune.sh and compare its results +# to expected results (see /expected_results directory) + +test_files_dir="../expected_results/" +pgtuned_script="../../pgtune.sh" +pg_versions="15 14 13 12 11 10 9.6 9.5" db_types="web oltp dw desktop mixed" total_mem=8GB cpu_count=8 @@ -23,7 +27,7 @@ do echo "= stge_type: "$stge_type echo "=====================================" output_file=$pg_version$db_type$total_mem$cpu_count$max_conn$stge_type".txt" - bash pgtune.sh -v $pg_version -t $db_type -m $total_mem -u $cpu_count -c $max_conn -s $stge_type > $output_file + bash $pgtuned_script -v $pg_version -t $db_type -m $total_mem -u $cpu_count -c $max_conn -s $stge_type > $output_file test_file=$pg_version"_linux_"$db_type"_"$total_mem"_"$cpu_count"_"$max_conn"_"$stge_type".txt" if [ ! -f "$test_files_dir$test_file" ] then