Skip to content

Instantly share code, notes, and snippets.

@guushamann
Created May 14, 2019 08:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save guushamann/ed1e365c9bcb126428246eb45c837114 to your computer and use it in GitHub Desktop.
Save guushamann/ed1e365c9bcb126428246eb45c837114 to your computer and use it in GitHub Desktop.
kong setup
version: "3.4"
services:
db:
image: postgres:9.6
networks:
- kongback
volumes:
- pgdata:/var/lib/postgresql/data
env_file:
- kongstack.env
# met pgtune deze settings bepaald https://pgtune.leopard.in.ua/#/
command: postgres -c max_connections=200 -c shared_buffers=1GB -c effective_cache_size=1536MB -c maintenance_work_mem=256MB -c checkpoint_completion_target=0.7 -c wal_buffers=16MB -c default_statistics_target=100 -c random_page_cost=1.1 -c effective_io_concurrency=300 -c work_mem=2621kB -c min_wal_size=1GB -c max_wal_size=2GB -c max_worker_processes=4 -c max_parallel_workers_per_gather=2
deploy:
restart_policy:
condition: on-failure
delay: 10s
healthcheck:
test: ["CMD", "pg_isready", "-U", "kong"]
interval: 30s
timeout: 30s
retries: 3
migration:
networks:
- kongback
image: kong:1.0.3
depends_on:
- kong-database
command: kong migrations bootstrap
deploy:
restart_policy:
condition: on-failure
delay: 2s
env_file:
- kongstack.env
kong:
image: kong:1.0.3
networks:
- traefik-net
- kongback
depends_on:
- kong-database
- kong-database-migrations
ports:
- "8001:8001"
- "8000:8000"
- "8443:8443"
- "8444:8444"
deploy:
replicas: 4
restart_policy:
condition: on-failure
delay: 10s
max_attempts: 3
labels:
- "traefik.backend=kong"
- "traefik.port=8000"
- "traefik.enable=true"
- "traefik.frontend.rule=Host:liveapi-swarm.pe-online.org,liveknbapi-swarm.pe-online.org,accapi-testswarm.pe-online.org,devapi-testswarm.pe-online.org,devknbapi-testswarm.pe-online.org,localapi-testswarm.pe-online.org"
- "traefik.frontend.passHostHeader=true"
- "traefik.docker.network=traefik-net"
- "traefik.frontend.headers.customRequestHeaders=x-forwarded-proto:https"
env_file:
- kongstack.env
networks:
kongback:
external: false
traefik-net:
external: true
volumes:
pgdata:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment