Adding of PgBouncer

Gitaly project plans to use PgBouncer for Praefect service
https://gitlab.com/gitlab-org/gitaly/-/issues/2816
We want to have an image for CI so we can test interaction
of Praefect with PostgreSQL database if PgBouncer sits in
between.

Installation script added with 1.14.0 version of PgBouncer (latest).

Related to: https://gitlab.com/gitlab-org/gitaly/-/issues/2816
This commit is contained in:
Pavlo Strokov 2020-07-15 15:02:51 +03:00
parent d8bb1b8602
commit 9934e625c6
5 changed files with 44 additions and 0 deletions

View file

@ -180,6 +180,19 @@ function print_graphicsmagick_args() {
printf -- "--build-arg GRAPHISMAGICK_DOWNLOAD_SHA256=%s " "$GRAPHISMAGICK_DOWNLOAD_SHA256"
}
function print_pgbouncer_args() {
case "$1" in
1.14)
PGBOUNCER_VERSION=1.14.0
PGBOUNCER_DOWNLOAD_SHA256=a0c13d10148f557e36ff7ed31793abb7a49e1f8b09aa2d4695d1c28fa101fee7
;;
*) echo "Unknown pgbouncer version $1"; exit 1;
esac
printf -- "--build-arg PGBOUNCER_VERSION=%s " "$PGBOUNCER_VERSION"
printf -- "--build-arg PGBOUNCER_DOWNLOAD_SHA256=%s " "$PGBOUNCER_DOWNLOAD_SHA256"
}
function parse_arguments() {
read base
read base_version
@ -206,6 +219,7 @@ function parse_arguments() {
ansible) print_ansible_args $version ;;
terraform) print_terraform_args $version ;;
graphicsmagick) print_graphicsmagick_args $version ;;
pgbouncer) print_pgbouncer_args $version ;;
*) exit 1;;
esac
done

22
scripts/install-pgbouncer Executable file
View file

@ -0,0 +1,22 @@
#!/bin/bash
PGBOUNCER_VERSION=${1}
PGBOUNCER_DOWNLOAD_SHA256=${2}
PGBOUNCER_DOWNLOAD_URL="https://www.pgbouncer.org/downloads/files/${PGBOUNCER_VERSION}/pgbouncer-${PGBOUNCER_VERSION}.tar.gz"
curl -fsSL "$PGBOUNCER_DOWNLOAD_URL" -o pgbouncer.zip
echo "${PGBOUNCER_DOWNLOAD_SHA256} pgbouncer.zip" | sha256sum -c -
unzip -d /usr/local/bin pgbouncer.zip
rm pgbouncer.zip
curl -o pgbouncer.tar.gz -L https://pgbouncer.github.io/downloads/files/$PGBOUNCER_VERSION/pgbouncer-$PGBOUNCER_VERSION.tar.gz
tar xvfz pgbouncer.tar.gz
cd pgbouncer-${PGBOUNCER_VERSION}
./configure --prefix=/usr/local
make
cp pgbouncer /usr/local/bin
cd ..
rm -rf pgbouncer-${PGBOUNCER_VERSION}