Skip to content

Instantly share code, notes, and snippets.

@kevinccbsg
Last active March 19, 2018 21:21
Show Gist options
  • Save kevinccbsg/2bfcf910701c0aae1100e8f72be86d23 to your computer and use it in GitHub Desktop.
Save kevinccbsg/2bfcf910701c0aae1100e8f72be86d23 to your computer and use it in GitHub Desktop.
Docker compose with mongodb and kong API
version: '2.1'
services:
kong-database:
restart: on-failure
image: cassandra:3
container_name: kong-database
healthcheck:
test: ["CMD-SHELL", "[ $$(nodetool statusgossip) = running ]"]
interval: 30s
timeout: 10s
retries: 5
networks:
- backend
ports:
- "9042:9042"
volumes:
- "./db-data:/var/lib/cassandra"
kong-migration:
image: kong
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost"]
interval: 1m30s
timeout: 10s
retries: 5
depends_on:
kong-database:
condition: service_healthy
#links:
# - kong-database:kong-database
networks:
- backend
environment:
- KONG_DATABASE=cassandra
- KONG_PG_HOST=kong-database
- KONG_CASSANDRA_CONTACT_POINTS=kong-database
command: kong migrations up
kong:
image: kong
container_name: kong
depends_on:
kong-database:
condition: service_healthy
kong-migration:
condition: service_healthy
#links:
# - kong-database:kong-database
networks:
- frontend
- backend
environment:
- KONG_DATABASE=cassandra
- KONG_PG_HOST=kong-database
- KONG_CASSANDRA_CONTACT_POINTS=kong-database
- KONG_PROXY_ACCESS_LOG=/dev/stdout
- KONG_ADMIN_ACCESS_LOG=/dev/stdout
- KONG_PROXY_ERROR_LOG=/dev/stderr
- KONG_ADMIN_ERROR_LOG=/dev/stde
ports:
- "8000:8000"
- "8443:8443"
- "8001:8001"
- "8444:8444"
healthcheck:
test: ["CMD-SHELL", "curl -I -s -L http://127.0.0.1:8000 || exit 1"]
interval: 20s
retries: 10
#dashboard:
# container_name: dashboard-website
# build: ./web-gsitae
# networks:
# - frontend
gsitae-userapi:
container_name: gsitae-userapi
build: ./gsitae-userapi
image: gsitae-userapi:1.0.0
depends_on:
mongo-dashboard:
condition: service_started
networks:
- frontend
- mongodb
mongo-dashboard:
container_name: mongo-dashboard
image: mongo:3.4.10
volumes:
- "./mongo-compose/data/db:/data/db"
ports:
- "27017:27017"
command: mongod --port 27017
#healthcheck:
# test: ["CMD-SHELL", "echo 'db.stats().ok' | mongo 192.168.5.51:30000/test --quiet"]
# interval: 20s
# retries: 10
networks:
- mongodb
#application_2:
# container_name: application-two
# build: ./simple-app
# links:
# - kong:kong
networks:
frontend:
#name: frontend
backend:
#name: backend
mongodb:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment