docker-compose.yaml 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. version: "3"
  2. x-common-definition-pg:
  3. &common-definition-pg
  4. image: postgres:14
  5. network_mode: "service:main"
  6. healthcheck:
  7. test: [ "CMD-SHELL", "pg_isready -U postgres -d postgres" ]
  8. interval: 5s
  9. timeout: 5s
  10. retries: 5
  11. volumes:
  12. - type: bind
  13. source: ../tests/sharding/query_routing_setup.sql
  14. target: /docker-entrypoint-initdb.d/query_routing_setup.sql
  15. - type: bind
  16. source: ../tests/sharding/partition_hash_test_setup.sql
  17. target: /docker-entrypoint-initdb.d/partition_hash_test_setup.sql
  18. x-common-env-pg:
  19. &common-env-pg
  20. POSTGRES_USER: postgres
  21. POSTGRES_DB: postgres
  22. POSTGRES_PASSWORD: postgres
  23. services:
  24. main:
  25. image: gcr.io/google_containers/pause:3.2
  26. ports:
  27. - 6432
  28. pg1:
  29. <<: *common-definition-pg
  30. environment:
  31. <<: *common-env-pg
  32. POSTGRES_INITDB_ARGS: --auth-local=md5 --auth-host=md5 --auth=md5
  33. PGPORT: 5432
  34. command: ["postgres", "-p", "5432", "-c", "shared_preload_libraries=pg_stat_statements", "-c", "pg_stat_statements.track=all", "-c", "pg_stat_statements.max=100000"]
  35. pg2:
  36. <<: *common-definition-pg
  37. environment:
  38. <<: *common-env-pg
  39. POSTGRES_INITDB_ARGS: --auth-local=scram-sha-256 --auth-host=scram-sha-256 --auth=scram-sha-256
  40. PGPORT: 7432
  41. command: ["postgres", "-p", "7432", "-c", "shared_preload_libraries=pg_stat_statements", "-c", "pg_stat_statements.track=all", "-c", "pg_stat_statements.max=100000"]
  42. pg3:
  43. <<: *common-definition-pg
  44. environment:
  45. <<: *common-env-pg
  46. POSTGRES_INITDB_ARGS: --auth-local=scram-sha-256 --auth-host=scram-sha-256 --auth=scram-sha-256
  47. PGPORT: 8432
  48. command: ["postgres", "-p", "8432", "-c", "shared_preload_libraries=pg_stat_statements", "-c", "pg_stat_statements.track=all", "-c", "pg_stat_statements.max=100000"]
  49. pg4:
  50. <<: *common-definition-pg
  51. environment:
  52. <<: *common-env-pg
  53. POSTGRES_INITDB_ARGS: --auth-local=scram-sha-256 --auth-host=scram-sha-256 --auth=scram-sha-256
  54. PGPORT: 9432
  55. command: ["postgres", "-p", "9432", "-c", "shared_preload_libraries=pg_stat_statements", "-c", "pg_stat_statements.track=all", "-c", "pg_stat_statements.max=100000"]
  56. pg5:
  57. <<: *common-definition-pg
  58. environment:
  59. <<: *common-env-pg
  60. POSTGRES_INITDB_ARGS: --auth-local=md5 --auth-host=md5 --auth=md5
  61. PGPORT: 10432
  62. command: ["postgres", "-p", "10432", "-c", "shared_preload_libraries=pg_stat_statements", "-c", "pg_stat_statements.track=all", "-c", "pg_stat_statements.max=100000"]
  63. toxiproxy:
  64. build: .
  65. network_mode: "service:main"
  66. container_name: toxiproxy
  67. environment:
  68. LOG_LEVEL: info
  69. entrypoint: toxiproxy-server
  70. depends_on:
  71. - pg1
  72. - pg2
  73. - pg3
  74. - pg4
  75. - pg5
  76. pgcat-shell:
  77. stdin_open: true
  78. user: "${HOST_UID}:${HOST_GID}"
  79. build: .
  80. network_mode: "service:main"
  81. depends_on:
  82. - toxiproxy
  83. volumes:
  84. - ../:/app/
  85. entrypoint:
  86. - /bin/bash
  87. - -i