Skip to content

Commit

Permalink
Buildpack Updates (#132)
Browse files Browse the repository at this point in the history
* add support for versioned patchfiles

* update pgbouncer url

* use -build image for make shell

* build pgbouncer 1.12 with heroku-18

* mv from 1.12 to 1.13

* run 1.13 on heroku-16

* add stack to archive name

* build 1.13 for heroku-16

* set default to 1.13

* move patch to 1.7 from default

* update changelog

* our changelog is lowercased
  • Loading branch information
beanieboi authored May 18, 2020
1 parent 17e5510 commit d18141b
Show file tree
Hide file tree
Showing 15 changed files with 56 additions and 45 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/check_changelog.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ jobs:
- uses: actions/checkout@v1
- name: Check that CHANGELOG is touched
run: |
cat $GITHUB_EVENT_PATH | jq .pull_request.title | grep -i '\[\(\(changelog skip\)\|\(ci skip\)\)\]' || git diff remotes/origin/${{ github.base_ref }} --name-only | grep CHANGELOG.md
cat $GITHUB_EVENT_PATH | jq .pull_request.title | grep -i '\[\(\(changelog skip\)\|\(ci skip\)\)\]' || git diff remotes/origin/${{ github.base_ref }} --name-only | grep Changelog.md
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

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 .

0 comments on commit d18141b

Please sign in to comment.