irobust

Set up Kong with Docker

Apr 22nd, 2019
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.18 KB | None | 0 0
  1. 1. Create network
  2. docker network create kong-net
  3.  
  4. 2. Create cassandra container
  5. docker run -d --name kong-database \
  6. --network=kong-net \
  7. -p 9042:9042 \
  8. cassandra:3
  9.  
  10. 3. Generate database schema
  11. docker run --rm \
  12. --network=kong-net \
  13. -e "KONG_DATABASE=cassandra" \
  14. -e "KONG_CASSANDRA_CONTACT_POINTS=kong-database" \
  15. kong:latest kong migrations bootstrap
  16.  
  17. **** Use docker start kong-database for next time ****
  18.  
  19. 4. docker run -d --name kong \
  20. --network=kong-net \
  21. -e "KONG_DATABASE=cassandra" \
  22. -e "KONG_CASSANDRA_CONTACT_POINTS=kong-database" \
  23. -e "KONG_ADMIN_LISTEN=0.0.0.0:8001" \
  24. -p 8000:8000 \
  25. -p 8001:8001 \
  26. kong:latest
  27.  
  28. **** Use docker start kong for next time ****
  29. **** docker exec -it kong kong start *****
  30.  
  31. 5 Test Kong status
  32. 5.1 curl http://localhost:8001
  33. 5.2 curl http://localhost:8081/status
  34.  
  35. 6. Create Fake Service
  36. 6.1 Share drive api.js to container
  37. 6.2 npm install faker
  38. 6.3 docker run --name product-service --network kong-net -p 3000:3000 -v /NodeServers/FakeAPI:/data
  39. williamyeh/json-server api.js
  40. 6.4 http://localhost:3000/products
Add Comment
Please, Sign In to add comment