From 79ad907def0add518b551cbcffd69c770a20c90d Mon Sep 17 00:00:00 2001 From: Sun-ZhenXing <1006925066@qq.com> Date: Wed, 24 Sep 2025 00:06:13 +0800 Subject: [PATCH] feat: add mongodb-replicaset/ & mysql/ & minio/ --- src/milvus-standalone/docker-compose.yaml | 2 +- src/minio/.env.example | 1 + src/minio/.gitignore | 1 + src/minio/README.zh.md | 5 ++ src/minio/docker-compose.yaml | 38 +++++++++++++ src/mongodb-replicaset/.gitignore | 1 + src/mongodb-replicaset/README.zh.md | 22 ++++++++ src/mongodb-replicaset/docker-compose.yaml | 56 +++++++++++++++++++ src/mysql/README.md | 0 src/mysql/docker-compose.yaml | 30 ++++++++++ ...docker-compose.yml => docker-compose.yaml} | 2 +- 11 files changed, 156 insertions(+), 2 deletions(-) create mode 100644 src/minio/.env.example create mode 100644 src/minio/.gitignore create mode 100644 src/minio/README.zh.md create mode 100644 src/minio/docker-compose.yaml create mode 100644 src/mongodb-replicaset/.gitignore create mode 100644 src/mongodb-replicaset/README.zh.md create mode 100644 src/mongodb-replicaset/docker-compose.yaml create mode 100644 src/mysql/README.md create mode 100644 src/mysql/docker-compose.yaml rename src/ollama/{docker-compose.yml => docker-compose.yaml} (93%) diff --git a/src/milvus-standalone/docker-compose.yaml b/src/milvus-standalone/docker-compose.yaml index c36fae9..1bc2057 100644 --- a/src/milvus-standalone/docker-compose.yaml +++ b/src/milvus-standalone/docker-compose.yaml @@ -43,8 +43,8 @@ services: MINIO_ACCESS_KEY: ${MINIO_ACCESS_KEY:-minioadmin} MINIO_SECRET_KEY: ${MINIO_SECRET_KEY:-minioadmin} ports: - - "${MINIO_PORT_OVERRIDE_WEBUI:-9001}:9001" - "${MINIO_PORT_OVERRIDE_API:-9000}:9000" + - "${MINIO_PORT_OVERRIDE_WEBUI:-9001}:9001" volumes: - *localtime - *timezone diff --git a/src/minio/.env.example b/src/minio/.env.example new file mode 100644 index 0000000..5fe4581 --- /dev/null +++ b/src/minio/.env.example @@ -0,0 +1 @@ +MINIO_ROOT_PASSWORD= diff --git a/src/minio/.gitignore b/src/minio/.gitignore new file mode 100644 index 0000000..50cf6de --- /dev/null +++ b/src/minio/.gitignore @@ -0,0 +1 @@ +/config diff --git a/src/minio/README.zh.md b/src/minio/README.zh.md new file mode 100644 index 0000000..59bdd71 --- /dev/null +++ b/src/minio/README.zh.md @@ -0,0 +1,5 @@ +# MinIO + +MinIO 是一个高性能的分布式对象存储系统,兼容 Amazon S3 API。它可以用于存储和管理大量非结构化数据,如照片、视频、日志文件等。 + +打开 Web UI 界面:。 diff --git a/src/minio/docker-compose.yaml b/src/minio/docker-compose.yaml new file mode 100644 index 0000000..fcc4051 --- /dev/null +++ b/src/minio/docker-compose.yaml @@ -0,0 +1,38 @@ +x-default: &default + restart: unless-stopped + volumes: + - &localtime /etc/localtime:/etc/localtime:ro + - &timezone /etc/timezone:/etc/timezone:ro + logging: + driver: json-file + options: + max-size: 100m + +services: + minio: + <<: *default + image: minio/minio:${MINIO_VERSION:-RELEASE.2025-09-07T16-13-09Z} + ports: + - "${MINIO_PORT_OVERRIDE_API:-9000}:9000" + - "${MINIO_PORT_OVERRIDE_WEBUI:-9001}:9001" + environment: + MINIO_ROOT_USER: ${MINIO_ROOT_USER:-root} + MINIO_ROOT_PASSWORD: ${MINIO_ROOT_PASSWORD:-password} + MINIO_ACCESS_KEY: ${MINIO_ACCESS_KEY} + MINIO_SECRET_KEY: ${MINIO_SECRET_KEY} + volumes: + - *localtime + - *timezone + - minio_data:/data + - ./config:/root/.minio/ + command: server --console-address ':9001' /data + healthcheck: + test: ["CMD", "curl", "-f", "http://localhost:9000/minio/health/live"] + interval: 30s + timeout: 20s + retries: 5 + start_period: 30s + + +volumes: + minio_data: diff --git a/src/mongodb-replicaset/.gitignore b/src/mongodb-replicaset/.gitignore new file mode 100644 index 0000000..956d472 --- /dev/null +++ b/src/mongodb-replicaset/.gitignore @@ -0,0 +1 @@ +/secrets diff --git a/src/mongodb-replicaset/README.zh.md b/src/mongodb-replicaset/README.zh.md new file mode 100644 index 0000000..f61c967 --- /dev/null +++ b/src/mongodb-replicaset/README.zh.md @@ -0,0 +1,22 @@ +# MongoDB + +```bash +docker exec -it mongodb-mongo1-1 mongosh +``` + +初始化副本集: + +```js +use admin +db.auth('root', '$MONGO_ROOT_PASSWORD') +config = { + _id: "rs0", + members: [ + {_id: 0, host: "192.168.31.38:27017"}, + {_id: 1, host: "192.168.31.38:27018"}, + {_id: 2, host: "192.168.31.38:27019"}, + ] +} +rs.initiate(config) +exit +``` diff --git a/src/mongodb-replicaset/docker-compose.yaml b/src/mongodb-replicaset/docker-compose.yaml new file mode 100644 index 0000000..af612a8 --- /dev/null +++ b/src/mongodb-replicaset/docker-compose.yaml @@ -0,0 +1,56 @@ +x-default: &default + restart: unless-stopped + volumes: + - &localtime /etc/localtime:/etc/localtime:ro + - &timezone /etc/timezone:/etc/timezone:ro + logging: + driver: json-file + options: + max-size: 100m + +x-mongo: &mongo + <<: *default + image: mongo:${MONGO_VERSION:-8.0.13} + environment: + MONGO_INITDB_ROOT_USERNAME: ${MONGO_INITDB_ROOT_USERNAME:-root} + MONGO_INITDB_ROOT_PASSWORD: ${MONGO_INITDB_ROOT_PASSWORD:-password} + MONGO_INITDB_DATABASE: ${MONGO_INITDB_DATABASE:-admin} + command: + - mongod + - --replSet + - ${MONGO_REPLICA_SET_NAME:-rs0} + - --keyFile + - /secrets/rs0.key + volumes: + - *localtime + - *timezone + - ./secrets/rs0.key:/secrets/rs0.key + entrypoint: + - bash + - -c + - | + chmod 400 /secrets/rs0.key + chown 999:999 /secrets/rs0.key + exec docker-entrypoint.sh $$@ + deploy: + resources: + limits: + cpus: '0.50' + memory: 1G + reservations: + cpus: '0.25' + memory: 256M + +services: + mongo1: + <<: *mongo + ports: + - "${MONGO_PORT_OVERRIDE_1:-27017}:27017" + mongo2: + <<: *mongo + ports: + - "${MONGO_PORT_OVERRIDE_2:-27018}:27017" + mongo3: + <<: *mongo + ports: + - "${MONGO_PORT_OVERRIDE_3:-27019}:27017" diff --git a/src/mysql/README.md b/src/mysql/README.md new file mode 100644 index 0000000..e69de29 diff --git a/src/mysql/docker-compose.yaml b/src/mysql/docker-compose.yaml new file mode 100644 index 0000000..abe4ecc --- /dev/null +++ b/src/mysql/docker-compose.yaml @@ -0,0 +1,30 @@ +x-default: &default + restart: unless-stopped + volumes: + - &localtime /etc/localtime:/etc/localtime:ro + - &timezone /etc/timezone:/etc/timezone:ro + logging: + driver: json-file + options: + max-size: 100m + +services: + mysql: + <<: *default + image: mysql:${MYSQL_VERSION:-9.4.0} + ports: + - "${MYSQL_PORT_OVERRIDE:-3306}:3306" + volumes: + - *localtime + - *timezone + - mysql_data:/var/lib/mysql + + # Initialize database with scripts in ./init.sql + # - ./init.sql:/docker-entrypoint-initdb.d/init.sql:ro + environment: + MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD:-password} + MYSQL_ROOT_HOST: ${MYSQL_ROOT_HOST:-%} + + +volumes: + mysql_data: diff --git a/src/ollama/docker-compose.yml b/src/ollama/docker-compose.yaml similarity index 93% rename from src/ollama/docker-compose.yml rename to src/ollama/docker-compose.yaml index c42e4bc..b04601d 100644 --- a/src/ollama/docker-compose.yml +++ b/src/ollama/docker-compose.yaml @@ -13,7 +13,7 @@ services: <<: *default image: ollama/ollama:${OLLAMA_VERSION:-0.12.0} ports: - - "${OLLAMA_PORT:-11434}:11434" + - "${OLLAMA_PORT_OVERRIDE:-11434}:11434" volumes: - *localtime - *timezone