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

Buildpack Updates #132

Merged
merged 13 commits into from
May 18, 2020
5 changes: 3 additions & 2 deletions Changelog.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
## unreleased

* Updates development tooling
* Updates pgbouncer to 1.13 for Heroku-18
* Updates pgbouncer to 1.13 for Heroku-16
* Updates to Buildpack tooling

## v0.3.4 (January 2, 2015)

Expand Down
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ build-cedar-14:

build-heroku-16:
@echo "Building pgbouncer in Docker for heroku-16..."
@docker run -v $(shell pwd):/buildpack --rm -it -e "STACK=heroku-16" -e "PGBOUNCER_VERSION=1.7.2" -w /buildpack heroku/heroku:16-build support/pgbouncer-build
@docker run -v $(shell pwd):/buildpack --rm -it -e "STACK=heroku-16" -w /buildpack heroku/heroku:16-build support/pgbouncer-build

build-heroku-18:
@echo "Building pgbouncer in Docker for heroku-18..."
@docker run -v $(shell pwd):/buildpack --rm -it -e "STACK=heroku-18" -e "PGBOUNCER_VERSION=1.8.1" -w /buildpack heroku/heroku:18-build support/pgbouncer-build
@docker run -v $(shell pwd):/buildpack --rm -it -e "STACK=heroku-18" -w /buildpack heroku/heroku:18-build support/pgbouncer-build

shell:
@echo "Opening heroku-18 shell..."
@docker run -v $(shell pwd):/buildpack --rm -it -e "STACK=heroku-18" -e "PORT=5000" -w /buildpack heroku/heroku:18 bash
@docker run -v $(shell pwd):/buildpack --rm -it -e "STACK=heroku-18" -e "PORT=5000" -w /buildpack heroku/heroku:18-build bash
8 changes: 4 additions & 4 deletions bin/compile
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ unset GIT_DIR

# config
if [ "$STACK" == "heroku-18" ]; then
PGBOUNCER_VERSION="1.8.1-heroku"
PGBOUNCER_VERSION="1.13.0"
STUNNEL_VERSION=""
elif [ "$STACK" == "heroku-16" ]; then
PGBOUNCER_VERSION="1.7.2-heroku"
PGBOUNCER_VERSION="1.13.0"
else
PGBOUNCER_VERSION="1.7-heroku"
PGBOUNCER_VERSION="1.7"
fi

# parse and derive params
Expand Down Expand Up @@ -48,7 +48,7 @@ VENDORED_PGBOUNCER="vendor/pgbouncer"
PATH="$BUILD_DIR/$VENDORED_PGBOUNCER/bin:$PATH"
echo "-----> Fetching and vendoring pgbouncer into slug"
mkdir -p "$BUILD_DIR/$VENDORED_PGBOUNCER"
tar xzf pgbouncer-${PGBOUNCER_VERSION}.tgz -C ${BUILD_DIR}/${VENDORED_PGBOUNCER}
tar xzf pgbouncer-${PGBOUNCER_VERSION}-${STACK}.tgz -C ${BUILD_DIR}/${VENDORED_PGBOUNCER}

echo "-----> Moving the configuration generation script into app/bin"
mkdir -p $BUILD_DIR/bin
Expand Down
Binary file added pgbouncer-1.13.0-heroku-16.tgz
Binary file not shown.
Binary file added pgbouncer-1.13.0-heroku-18.tgz
Binary file not shown.
Binary file added pgbouncer-1.7-cedar-14.tgz
Binary file not shown.
Binary file removed pgbouncer-1.7-heroku.tgz
Binary file not shown.
Binary file removed pgbouncer-1.7.2-heroku.tgz
Binary file not shown.
Binary file removed pgbouncer-1.8.1-heroku.tgz
Binary file not shown.
27 changes: 0 additions & 27 deletions support/0001-Disable-SIGTERM.patch

This file was deleted.

13 changes: 13 additions & 0 deletions support/patchfiles/1.13.0/0001-Disable-SIGTERM.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
--- src/main.c 2019-09-26 21:37:14.000000000 +0000
+++ src/main.c 2020-03-20 20:43:20.876976754 +0000
@@ -425,9 +425,7 @@

static void handle_sigterm(evutil_socket_t sock, short flags, void *arg)
{
- log_info("got SIGTERM, fast exit");
- /* pidfile cleanup happens via atexit() */
- exit(1);
+ log_info("Got SIGTERM, ignoring!");
}

static void handle_sigint(evutil_socket_t sock, short flags, void *arg)
13 changes: 13 additions & 0 deletions support/patchfiles/1.7/0001-Disable-SIGTERM.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
--- src/main.c 2020-03-20 20:11:32.046384770 +0000
+++ src/main_patched.c 2020-03-20 20:14:02.436366750 +0000
@@ -402,9 +402,7 @@

static void handle_sigterm(int sock, short flags, void *arg)
{
- log_info("Got SIGTERM, fast exit");
- /* pidfile cleanup happens via atexit() */
- exit(1);
+ log_info("Got SIGTERM, ignoring!");
}

static void handle_sigint(int sock, short flags, void *arg)
Empty file.
27 changes: 19 additions & 8 deletions support/pgbouncer-build
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

set -e

PGBOUNCER_VERSION=${PGBOUNCER_VERSION-1.7.2}
PGBOUNCER_VERSION=${PGBOUNCER_VERSION-1.13.0}

pgbouncer_tarball_url=https://pgbouncer.github.io/downloads/files/${PGBOUNCER_VERSION}/pgbouncer-${PGBOUNCER_VERSION}.tar.gz
pgbouncer_tarball_url=http://www.pgbouncer.org/downloads/files/${PGBOUNCER_VERSION}/pgbouncer-${PGBOUNCER_VERSION}.tar.gz
beanieboi marked this conversation as resolved.
Show resolved Hide resolved

temp_dir=$(mktemp -d /tmp/pgbouncer.XXXXXXXXXX)

Expand All @@ -14,12 +14,23 @@ echo "Temp dir: $temp_dir"
echo "Downloading $pgbouncer_tarball_url"
curl -L $pgbouncer_tarball_url | tar xzv

if [ -d "/buildpack/support/patchfiles/${PGBOUNCER_VERSION}" ]
then
PATCHFILES=$(find /buildpack/support/patchfiles/${PGBOUNCER_VERSION} -name '*.patch')
else
PATCHFILES=$(find /buildpack/support/patchfiles/default -name '*.patch')
fi

(
cd pgbouncer-${PGBOUNCER_VERSION}
git apply /buildpack/support/0001-Disable-SIGTERM.patch
./configure \
--prefix=/tmp/pgbouncer
make -j 2 install
cd pgbouncer-${PGBOUNCER_VERSION}
for f in $PATCHFILES
do
patch -p0 < $f
done

./configure \
--prefix=/tmp/pgbouncer
make -j 2 install
)

tar -zcvf /buildpack/pgbouncer-${PGBOUNCER_VERSION}-heroku.tgz -C /tmp/pgbouncer .
tar -zcvf /buildpack/pgbouncer-${PGBOUNCER_VERSION}-${STACK}.tgz -C /tmp/pgbouncer .