feat: add mongodb-replicaset/ & mysql/ & minio/
This commit is contained in:
@@ -43,8 +43,8 @@ services:
|
|||||||
MINIO_ACCESS_KEY: ${MINIO_ACCESS_KEY:-minioadmin}
|
MINIO_ACCESS_KEY: ${MINIO_ACCESS_KEY:-minioadmin}
|
||||||
MINIO_SECRET_KEY: ${MINIO_SECRET_KEY:-minioadmin}
|
MINIO_SECRET_KEY: ${MINIO_SECRET_KEY:-minioadmin}
|
||||||
ports:
|
ports:
|
||||||
- "${MINIO_PORT_OVERRIDE_WEBUI:-9001}:9001"
|
|
||||||
- "${MINIO_PORT_OVERRIDE_API:-9000}:9000"
|
- "${MINIO_PORT_OVERRIDE_API:-9000}:9000"
|
||||||
|
- "${MINIO_PORT_OVERRIDE_WEBUI:-9001}:9001"
|
||||||
volumes:
|
volumes:
|
||||||
- *localtime
|
- *localtime
|
||||||
- *timezone
|
- *timezone
|
||||||
|
|||||||
1
src/minio/.env.example
Normal file
1
src/minio/.env.example
Normal file
@@ -0,0 +1 @@
|
|||||||
|
MINIO_ROOT_PASSWORD=
|
||||||
1
src/minio/.gitignore
vendored
Normal file
1
src/minio/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
|||||||
|
/config
|
||||||
5
src/minio/README.zh.md
Normal file
5
src/minio/README.zh.md
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
# MinIO
|
||||||
|
|
||||||
|
MinIO 是一个高性能的分布式对象存储系统,兼容 Amazon S3 API。它可以用于存储和管理大量非结构化数据,如照片、视频、日志文件等。
|
||||||
|
|
||||||
|
打开 Web UI 界面:<http://localhost:9001>。
|
||||||
38
src/minio/docker-compose.yaml
Normal file
38
src/minio/docker-compose.yaml
Normal file
@@ -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:
|
||||||
1
src/mongodb-replicaset/.gitignore
vendored
Normal file
1
src/mongodb-replicaset/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
|||||||
|
/secrets
|
||||||
22
src/mongodb-replicaset/README.zh.md
Normal file
22
src/mongodb-replicaset/README.zh.md
Normal file
@@ -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
|
||||||
|
```
|
||||||
56
src/mongodb-replicaset/docker-compose.yaml
Normal file
56
src/mongodb-replicaset/docker-compose.yaml
Normal file
@@ -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"
|
||||||
0
src/mysql/README.md
Normal file
0
src/mysql/README.md
Normal file
30
src/mysql/docker-compose.yaml
Normal file
30
src/mysql/docker-compose.yaml
Normal file
@@ -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:
|
||||||
@@ -13,7 +13,7 @@ services:
|
|||||||
<<: *default
|
<<: *default
|
||||||
image: ollama/ollama:${OLLAMA_VERSION:-0.12.0}
|
image: ollama/ollama:${OLLAMA_VERSION:-0.12.0}
|
||||||
ports:
|
ports:
|
||||||
- "${OLLAMA_PORT:-11434}:11434"
|
- "${OLLAMA_PORT_OVERRIDE:-11434}:11434"
|
||||||
volumes:
|
volumes:
|
||||||
- *localtime
|
- *localtime
|
||||||
- *timezone
|
- *timezone
|
||||||
Reference in New Issue
Block a user