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

build(snap): kong migrations up before Kong startup #4223

Merged
merged 2 commits into from
Oct 26, 2022
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
7 changes: 5 additions & 2 deletions snap/local/runtime-helpers/bin/kong-daemon.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,18 @@

KONG=/usr/local/bin/kong

# run kong migrations up to bootstrap the cassandra database
# note that sometimes cassandra can be in a "starting up" state, etc.
# bootstrap the database
# note that sometimes the database can be in a "starting up" state, etc.
# and in this case we should just loop and keep trying
# we don't implement a timeout here because systemd will kill us if we
# don't succeed in 15 minutes (or whatever the configured stop-timeout is)
until "$KONG" migrations bootstrap --conf "$KONG_CONF"; do
sleep 5
done

# perform migration for upgrades
"$KONG" migrations up --conf "$KONG_CONF"

# set up Kong's admin API plugins via kong.yml:
"$KONG" config db_import "$KONGADMIN_CONFIGFILEPATH" || true

Expand Down
8 changes: 4 additions & 4 deletions snap/snapcraft.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -696,23 +696,23 @@ parts:
- perl
- zlib1g-dev
override-build: |
VERSION=2.8.0
VERSION=2.8.2

# use dpkg architecture to figure out our target arch
case "$(dpkg --print-architecture)" in
amd64)
FILE_NAME=kong_${VERSION}_amd64.deb
FILE_HASH=5715ec10547a2de9e7534d0af402fc8dbdad7145d4b43bbccc7bb960152b0314
FILE_HASH=d600227d07cb862b2dd2de3925eca5841b2292ef838af21ddf5f412c9ab0f3ee
;;
arm64)
FILE_NAME=kong_${VERSION}_arm64.deb
FILE_HASH=d980f5c106a36142dd86c04bee4adc0deec3470970f8b0f6d3024c17e13d83d6
FILE_HASH=c23b22bf34df1f3a8428c998875e868025557d5f9599fd9bed10b12c9fb8ed57
;;
esac

# download the archive and verify the checksum
curl --silent --show-error --location --output $FILE_NAME \
https://download.konghq.com/gateway-2.x-ubuntu-xenial/pool/all/k/kong/$FILE_NAME
https://download.konghq.com/gateway-2.x-ubuntu-focal/pool/all/k/kong/$FILE_NAME
echo "$FILE_HASH $FILE_NAME" > sha256
sha256sum -c sha256 | grep OK

Expand Down