Skip to content
This repository was archived by the owner on Feb 12, 2022. It is now read-only.
Open
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
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Kong as a Heroku app
====================
Deploy [Kong 1.0](https://konghq.com/blog/kong-1-0-ga/) clusters to Heroku Common Runtime and Private Spaces using the [Kong buildpack](https://github.com/heroku/heroku-buildpack-kong/).
Deploy [Kong 1.1.0rc2](https://discuss.konghq.com/t/kong-1-1-0rc2-available-for-testing/3016) clusters to Heroku Common Runtime and Private Spaces using the [Kong buildpack, 1.1.0 branch](https://github.com/heroku/heroku-buildpack-kong/tree/kong-1.1.0).

⏫ **Upgrading from an earlier version?** See [Upgrade Guide](#user-content-upgrade-guide).

Expand Down
3 changes: 1 addition & 2 deletions app.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,9 @@
],
"website": "https://getkong.org/",
"repository": "https://github.com/heroku/heroku-kong.git",
"success_url": "https://github.com/heroku/heroku-kong/blob/master/README.md#user-content-usage",
"stack": "heroku-18",
"buildpacks": [{
"url": "https://github.com/heroku/heroku-buildpack-kong.git"
"url": "https://github.com/heroku/heroku-buildpack-kong.git#kong-1.1.0"
}],
"addons": [
"heroku-postgresql"
Expand Down
25 changes: 25 additions & 0 deletions bin/postrelease
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/usr/bin/env bash
set -eu

# Admin key is empty when the var is unset.
KONG_HEROKU_ADMIN_KEY="${KONG_HEROKU_ADMIN_KEY:-}"

if [ -n "$KONG_HEROKU_ADMIN_KEY" ]
then
echo "Setting up external Admin API secured by KONG_HEROKU_ADMIN_KEY"

# Replace environment variables with their values.
# Example: `$VAR` or `${VAR}` will be replaced with value of `VAR`.
eval "cat <<EOF
$(<config/secure-admin-api.yml)
EOF
" > config/secure-admin-api-rendered.yml

# Kong needs to be running for import.
bin/background-start
sleep 1
# Import config to Kong 1.1+
kong config db_import \
-c "${KONG_CONF:-config/kong.conf}" \
"config/secure-admin-api-rendered.yml"
fi
25 changes: 0 additions & 25 deletions bin/prerelease

This file was deleted.

Binary file removed config/pg-heroku-admin.dump
Binary file not shown.
40 changes: 40 additions & 0 deletions config/secure-admin-api.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# Kong declarative config
# https://discuss.konghq.com/t/rfc-kong-native-declarative-config-format/2719

# Metadata fields start with an underscore (_)
# Fields that do not start with an underscore represent Kong entities and attributes

# Matches Kong minimum version that supports the format
_format_version: "1.1"
_comment: This configures a protected, external-facing loopback proxy to Kong's Admin API, secured by the KONG_HEROKU_ADMIN_KEY config var. This config is preprocessed by the bin/postrelease script to expand shell-style interpolations, such as variables.

services:
- name: kong-admin
url: http://localhost:8001
routes:
- name: kong-admin
protocols:
- https
paths:
- /kong-admin
plugins:
- name: request-size-limiting
config:
allowed_payload_size: 8
- name: rate-limiting
config:
minute: 1000
- name: key-auth
config:
hide_credentials: true
- name: acl
config:
whitelist:
- kong-admin

consumers:
- username: heroku-admin
acls:
- group: kong-admin
keyauth_credentials:
- key: ${KONG_HEROKU_ADMIN_KEY}