Skip to content

Kong: API Gateway

Deploy Kong with Pigsty Compose templates and PostgreSQL backend storage.

Kong is an open-source API gateway.

Pigsty’s app/kong template stores configuration in PostgreSQL. For a new empty database, explicitly run the one-time kong-migration initialization job. Normal startup does not run it automatically.

Quick Start

By default, the template binds the Admin API to the host loopback address (127.0.0.1:${KONG_ADMIN_PORT}:${KONG_ADMIN_PORT}) and publishes only the HTTP/HTTPS proxy ports externally:

cd ~/pigsty/app/kong
vi .env         # check KONG_PG_* and port settings
make bootstrap  # only when initializing a new empty database
make up

Default ports:

  • Proxy HTTP: 8000
  • Proxy HTTPS: 8443
  • Admin API: 127.0.0.1:8001, host loopback only; use an SSH tunnel for remote administration

make bootstrap runs kong migrations bootstrap; it is not an upgrade command for an existing database. The template defaults to kong:latest. Before upgrading, record the image version, back up the database, and follow the Kong migration procedure for that version.

Database Preparation

bin/pgsql-user pg-meta dbuser_kong
bin/pgsql-db   pg-meta kong

Connection string example:

postgres://dbuser_kong:[email protected]:5432/kong

Common Commands

make log
make stop
make clean
make pull

References

Was this page helpful?