docker-compose.yml 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  1. services:
  2. # SeaweedFS All-in-One Server (Custom Build with PostgreSQL support)
  3. seaweedfs:
  4. build:
  5. context: ../.. # Build from project root
  6. dockerfile: test/postgres/Dockerfile.seaweedfs
  7. container_name: seaweedfs-server
  8. ports:
  9. - "9333:9333" # Master port
  10. - "8888:8888" # Filer port
  11. - "8333:8333" # S3 port
  12. - "8085:8085" # Volume port
  13. - "9533:9533" # Metrics port
  14. - "26777:16777" # MQ Agent port (mapped to avoid conflicts)
  15. - "27777:17777" # MQ Broker port (mapped to avoid conflicts)
  16. volumes:
  17. - seaweedfs_data:/data
  18. - ./config:/etc/seaweedfs
  19. command: >
  20. ./weed server
  21. -dir=/data
  22. -master.volumeSizeLimitMB=50
  23. -master.port=9333
  24. -metricsPort=9533
  25. -volume.max=0
  26. -volume.port=8085
  27. -volume.preStopSeconds=1
  28. -filer=true
  29. -filer.port=8888
  30. -s3=true
  31. -s3.port=8333
  32. -s3.config=/etc/seaweedfs/s3config.json
  33. -webdav=false
  34. -s3.allowEmptyFolder=false
  35. -mq.broker=true
  36. -mq.agent=true
  37. -ip=seaweedfs
  38. networks:
  39. - seaweedfs-net
  40. healthcheck:
  41. test: ["CMD", "wget", "--quiet", "--tries=1", "--spider", "http://seaweedfs:9333/cluster/status"]
  42. interval: 10s
  43. timeout: 5s
  44. retries: 5
  45. start_period: 60s
  46. # Database Server (PostgreSQL Wire Protocol Compatible)
  47. postgres-server:
  48. build:
  49. context: ../.. # Build from project root
  50. dockerfile: test/postgres/Dockerfile.seaweedfs
  51. container_name: postgres-server
  52. ports:
  53. - "5432:5432" # PostgreSQL port
  54. depends_on:
  55. seaweedfs:
  56. condition: service_healthy
  57. command: >
  58. ./weed db
  59. -host=0.0.0.0
  60. -port=5432
  61. -master=seaweedfs:9333
  62. -auth=trust
  63. -database=default
  64. -max-connections=50
  65. -idle-timeout=30m
  66. networks:
  67. - seaweedfs-net
  68. healthcheck:
  69. test: ["CMD", "nc", "-z", "localhost", "5432"]
  70. interval: 5s
  71. timeout: 3s
  72. retries: 3
  73. start_period: 10s
  74. # MQ Data Producer - Creates test topics and data
  75. mq-producer:
  76. build:
  77. context: ../.. # Build from project root
  78. dockerfile: test/postgres/Dockerfile.producer
  79. container_name: mq-producer
  80. depends_on:
  81. seaweedfs:
  82. condition: service_healthy
  83. environment:
  84. - SEAWEEDFS_MASTER=seaweedfs:9333
  85. - SEAWEEDFS_FILER=seaweedfs:8888
  86. networks:
  87. - seaweedfs-net
  88. restart: "no" # Run once to create data
  89. # PostgreSQL Test Client
  90. postgres-client:
  91. build:
  92. context: ../.. # Build from project root
  93. dockerfile: test/postgres/Dockerfile.client
  94. container_name: postgres-client
  95. depends_on:
  96. postgres-server:
  97. condition: service_healthy
  98. environment:
  99. - POSTGRES_HOST=postgres-server
  100. - POSTGRES_PORT=5432
  101. - POSTGRES_USER=seaweedfs
  102. - POSTGRES_DB=logs
  103. networks:
  104. - seaweedfs-net
  105. profiles:
  106. - client # Only start when explicitly requested
  107. # PostgreSQL CLI for manual testing
  108. psql-cli:
  109. image: postgres:15-alpine
  110. container_name: psql-cli
  111. depends_on:
  112. postgres-server:
  113. condition: service_healthy
  114. environment:
  115. - PGHOST=postgres-server
  116. - PGPORT=5432
  117. - PGUSER=seaweedfs
  118. - PGDATABASE=default
  119. networks:
  120. - seaweedfs-net
  121. profiles:
  122. - cli # Only start when explicitly requested
  123. command: >
  124. sh -c "
  125. echo 'Connecting to PostgreSQL server...';
  126. psql -c 'SELECT version();'
  127. "
  128. volumes:
  129. seaweedfs_data:
  130. driver: local
  131. networks:
  132. seaweedfs-net:
  133. driver: bridge