feat: add more services
This commit is contained in:
130
src/kong/docker-compose.yaml
Normal file
130
src/kong/docker-compose.yaml
Normal file
@@ -0,0 +1,130 @@
|
||||
x-default: &default
|
||||
restart: unless-stopped
|
||||
volumes:
|
||||
- &localtime /etc/localtime:/etc/localtime:ro
|
||||
- &timezone /etc/timezone:/etc/timezone:ro
|
||||
logging:
|
||||
driver: json-file
|
||||
options:
|
||||
max-size: 100m
|
||||
|
||||
services:
|
||||
# Kong Database
|
||||
kong-db:
|
||||
<<: *default
|
||||
image: postgres:${POSTGRES_VERSION:-16.6-alpine3.21}
|
||||
container_name: kong-db
|
||||
volumes:
|
||||
- *localtime
|
||||
- *timezone
|
||||
- kong_db_data:/var/lib/postgresql/data
|
||||
environment:
|
||||
- POSTGRES_USER=kong
|
||||
- POSTGRES_DB=kong
|
||||
- POSTGRES_PASSWORD=${KONG_DB_PASSWORD:-kongpass}
|
||||
deploy:
|
||||
resources:
|
||||
limits:
|
||||
cpus: '1.00'
|
||||
memory: 512M
|
||||
reservations:
|
||||
cpus: '0.25'
|
||||
memory: 128M
|
||||
healthcheck:
|
||||
test: ["CMD-SHELL", "pg_isready -U kong"]
|
||||
interval: 30s
|
||||
timeout: 5s
|
||||
retries: 5
|
||||
|
||||
# Kong Database Migration
|
||||
kong-migrations:
|
||||
<<: *default
|
||||
image: kong:${KONG_VERSION:-3.8.0-alpine}
|
||||
container_name: kong-migrations
|
||||
depends_on:
|
||||
- kong-db
|
||||
environment:
|
||||
- KONG_DATABASE=postgres
|
||||
- KONG_PG_HOST=kong-db
|
||||
- KONG_PG_USER=kong
|
||||
- KONG_PG_PASSWORD=${KONG_DB_PASSWORD:-kongpass}
|
||||
- KONG_PG_DATABASE=kong
|
||||
command: kong migrations bootstrap
|
||||
restart: "no"
|
||||
|
||||
# Kong Gateway
|
||||
kong:
|
||||
<<: *default
|
||||
image: kong:${KONG_VERSION:-3.8.0-alpine}
|
||||
container_name: kong
|
||||
depends_on:
|
||||
- kong-db
|
||||
- kong-migrations
|
||||
ports:
|
||||
- "${KONG_PROXY_PORT_OVERRIDE:-8000}:8000"
|
||||
- "${KONG_PROXY_SSL_PORT_OVERRIDE:-8443}:8443"
|
||||
- "${KONG_ADMIN_API_PORT_OVERRIDE:-8001}:8001"
|
||||
- "${KONG_ADMIN_SSL_PORT_OVERRIDE:-8444}:8444"
|
||||
volumes:
|
||||
- *localtime
|
||||
- *timezone
|
||||
|
||||
# Custom configuration
|
||||
# - ./kong.conf:/etc/kong/kong.conf:ro
|
||||
environment:
|
||||
- KONG_DATABASE=postgres
|
||||
- KONG_PG_HOST=kong-db
|
||||
- KONG_PG_USER=kong
|
||||
- KONG_PG_PASSWORD=${KONG_DB_PASSWORD:-kongpass}
|
||||
- KONG_PG_DATABASE=kong
|
||||
- KONG_PROXY_ACCESS_LOG=/dev/stdout
|
||||
- KONG_ADMIN_ACCESS_LOG=/dev/stdout
|
||||
- KONG_PROXY_ERROR_LOG=/dev/stderr
|
||||
- KONG_ADMIN_ERROR_LOG=/dev/stderr
|
||||
- KONG_ADMIN_LISTEN=${KONG_ADMIN_LISTEN:-0.0.0.0:8001}
|
||||
- KONG_ADMIN_GUI_URL=${KONG_ADMIN_GUI_URL:-http://localhost:8002}
|
||||
deploy:
|
||||
resources:
|
||||
limits:
|
||||
cpus: '1.00'
|
||||
memory: 1G
|
||||
reservations:
|
||||
cpus: '0.25'
|
||||
memory: 256M
|
||||
healthcheck:
|
||||
test: ["CMD-SHELL", "kong health"]
|
||||
interval: 30s
|
||||
timeout: 10s
|
||||
retries: 5
|
||||
start_period: 30s
|
||||
|
||||
# Kong Manager (Optional GUI)
|
||||
kong-gui:
|
||||
<<: *default
|
||||
image: pantsel/konga:${KONGA_VERSION:-latest}
|
||||
container_name: kong-gui
|
||||
depends_on:
|
||||
- kong
|
||||
ports:
|
||||
- "${KONG_GUI_PORT_OVERRIDE:-1337}:1337"
|
||||
volumes:
|
||||
- *localtime
|
||||
- *timezone
|
||||
- konga_data:/app/kongadata
|
||||
environment:
|
||||
- NODE_ENV=production
|
||||
- KONGA_HOOK_TIMEOUT=120000
|
||||
deploy:
|
||||
resources:
|
||||
limits:
|
||||
cpus: '0.50'
|
||||
memory: 256M
|
||||
reservations:
|
||||
cpus: '0.10'
|
||||
memory: 64M
|
||||
profiles:
|
||||
- gui
|
||||
|
||||
volumes:
|
||||
kong_db_data:
|
||||
konga_data:
|
||||
Reference in New Issue
Block a user