Skip to content

Instantly share code, notes, and snippets.

@StarlightIbuki
Created February 22, 2023 08:29
Show Gist options
  • Save StarlightIbuki/ee9f47617c165961e5aca2e60a23bf39 to your computer and use it in GitHub Desktop.
Save StarlightIbuki/ee9f47617c165961e5aca2e60a23bf39 to your computer and use it in GitHub Desktop.
compose to test compatibility
version: "3"
x-node: &node
KONG_LOG_LEVEL: info
KONG_PROXY_ERROR_LOG: /dev/stderr
KONG_ADMIN_ERROR_LOG: /dev/stderr
KONG_PROXY_ACCESS_LOG: /dev/stdout
KONG_ADMIN_ACCESS_LOG: /dev/stdout
KONG_CLUSTER_CERT: /etc/kong/cluster.crt
KONG_CLUSTER_CERT_KEY: /etc/kong/cluster.key
x-cluster: &cluster
KONG_CLUSTER_CERT: /etc/kong/cluster.crt
KONG_CLUSTER_CERT_KEY: /etc/kong/cluster.key
x-cp: &db-connection
KONG_DATABASE: postgres
KONG_PG_HOST: postgres
KONG_PG_PASSWORD: kong
x-plugins: &plugins
KONG_PLUGINS: bundled,prometheus
services:
postgres:
profiles: ["cluster", "traditional"]
image: postgres:13
command: -c max_connections=200
environment:
POSTGRES_PASSWORD: kong
POSTGRES_USER: kong
POSTGRES_DB: kong
healthcheck:
test: ["CMD-SHELL", "pg_isready", "-d", "db_prod"]
interval: 5s
timeout: 60s
retries: 5
start_period: 80s
db-init:
profiles: ["cluster", "traditional"]
image: kong/kong-gateway:3.2.0.0
command: kong migrations bootstrap
restart: "no"
environment:
<<: *db-connection
depends_on:
postgres:
condition: service_healthy
cp:
profiles: ["cluster"]
image: kong/kong-gateway:3.2.0.0
ports:
- "8001:8001"
- "9542:9542"
environment:
KONG_ROLE: control_plane
KONG_ADMIN_LISTEN: 0.0.0.0:8001
<<: *node
<<: *cluster
<<: *db-connection
<<: *plugins
volumes:
- ./mount/cluster.crt:/etc/kong/cluster.crt
- ./mount/cluster.key:/etc/kong/cluster.key
- ./mount/kong_license.json:/etc/kong/license.json
- ./mount/removed_fields.lua:/usr/local/share/lua/5.1/kong/clustering/compat/removed_fields.lua
depends_on:
postgres:
condition: service_healthy
db-init:
condition: service_completed_successfully
healthcheck:
test: ["CMD", "kong", "health"]
interval: 5s
timeout: 60s
retries: 5
start_period: 80s
dp:
profiles: ["cluster"]
image: kong/kong-gateway:3.1.1.2
ports:
- "8000:8000"
environment:
KONG_ROLE: data_plane
KONG_DATABASE: 'off'
KONG_CLUSTER_CONTROL_PLANE: cp:8005
KONG_CLUSTER_TELEMETRY_ENDPOINT: cp:8006
<<: *node
<<: *cluster
<<: *plugins
volumes:
- ./mount/cluster.crt:/etc/kong/cluster.crt
- ./mount/cluster.key:/etc/kong/cluster.key
- ./mount/kong_license.json:/etc/kong/license.json
depends_on:
cp:
condition: service_healthy
dbless:
profiles: ["dbless"]
image: kong/kong-gateway:3.2.0.0
ports:
- "8000:8000"
- "8001:8001"
environment:
KONG_DATABASE: 'off'
KONG_PLUGINS: bundled,prometheus
<<: *node
<<: *plugins
volumes:
- ./mount/kong_license.json:/etc/kong/license.json
traditional:
profiles: ["traditional"]
image: kong/kong-gateway:3.2.0.0
ports:
- "8000:8000"
- "8001:8001"
environment:
KONG_DATABASE: 'off'
KONG_PLUGINS: bundled,prometheus
<<: *node
<<: *plugins
volumes:
- ./mount/kong_license.json:/etc/kong/license.json
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment