feat: add ollama & PostgresSQL & Qdrant & RabbitMQ

This commit is contained in:
Sun-ZhenXing
2025-09-21 20:54:17 +08:00
parent 166f0f2a50
commit b250573e72
11 changed files with 205 additions and 1 deletions

19
src/ollama/README.md Normal file
View File

@@ -0,0 +1,19 @@
# Ollama
拉取 DeepSeek R1 7B 模型:
```bash
docker exec -it ollama ollama pull deepseek-r1:7b
```
列出本地所有模型:
```bash
docker exec -it ollama ollama list
```
API 请求获取本地所有模型:
```bash
curl http://localhost:11434/api/tags 2> /dev/null | jq
```

View File

@@ -0,0 +1,35 @@
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:
ollama:
<<: *default
image: ollama/ollama:${OLLAMA_VERSION:-0.12.0}
ports:
- "${OLLAMA_PORT:-11434}:11434"
volumes:
- *localtime
- *timezone
- ollama_models:/root/.ollama
deploy:
resources:
limits:
cpus: '8.0'
memory: 4G
reservations:
cpus: '2.0'
memory: 2G
devices:
- driver: nvidia
device_ids: [ '0' ]
capabilities: [ gpu ]
volumes:
ollama_models:

View File

@@ -0,0 +1 @@
POSTGRES_PASSWORD=

View 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:
postgres:
<<: *default
image: postgres:${POSTGRES_VERSION:-17.6}
environment:
POSTGRES_USER: ${POSTGRES_USER:-postgres}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-postgres}
POSTGRES_DB: ${POSTGRES_DB:-postgres}
volumes:
- *localtime
- *timezone
- postgres_data:/var/lib/postgresql/data
# Initialize the database with a custom SQL script
# - ./init.sql:/docker-entrypoint-initdb.d/init.sql
ports:
- "${POSTGRES_PORT:-5432}:5432"
deploy:
resources:
limits:
cpus: '1.0'
memory: 1G
reservations:
cpus: '0.5'
memory: 512M
volumes:
postgres_data:

14
src/qdrant/.env.example Normal file
View File

@@ -0,0 +1,14 @@
# Qdrant Version
QDRANT_VERSION="v1.15.4"
# Qdrant API Key
QDRANT_API_KEY=
# Use RBAC
QDRANT_JWT_RBAC=true
# HTTP Port
QDRANT_HTTP_PORT=
# gRPC Port
QDRANT_GRPC_PORT=

5
src/qdrant/README.md Normal file
View File

@@ -0,0 +1,5 @@
# Qdrant
## 鉴权
Qdrant 支持 [API 密钥](https://qdrant.tech/documentation/guides/security/#read-only-api-key)和 [JWT 令牌](https://qdrant.tech/documentation/guides/security/#granular-access-control-with-jwt)两种鉴权方式。

View File

@@ -0,0 +1,35 @@
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:
qdrant:
<<: *default
image: qdrant/qdrant:${QDRANT_VERSION:-v1.15.4}
ports:
- "${QDRANT_HTTP_PORT:-6333}:6333"
- "${QDRANT_GRPC_PORT:-6334}:6334"
volumes:
- *localtime
- *timezone
- qdrant_data:/qdrant/storage:z
environment:
- QDRANT__SERVICE__API_KEY=${QDRANT_API_KEY}
- QDRANT__SERVICE__JWT_RBAC=${QDRANT_JWT_RBAC:-false}
deploy:
resources:
limits:
cpus: '1.0'
memory: 1G
reservations:
cpus: '0.5'
memory: 256M
volumes:
qdrant_data:

1
src/rabbitmq/README.md Normal file
View File

@@ -0,0 +1 @@
# RabbitMQ

View File

@@ -0,0 +1,35 @@
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:
rabbitmq:
<<: *default
image: rabbitmq:${RABBITMQ_VERSION:-4.1.4-management-alpine}
volumes:
- rabbitmq_data:/var/lib/rabbitmq
- *localtime
- *timezone
ports:
- ${RABBITMQ_PORT:-5672}:5672
- ${RABBITMQ_MANAGEMENT_PORT:-15672}:15672
environment:
RABBITMQ_DEFAULT_USER: ${RABBITMQ_DEFAULT_USER:-admin}
RABBITMQ_DEFAULT_PASS: ${RABBITMQ_DEFAULT_PASS:-password}
deploy:
resources:
limits:
cpus: '1.0'
memory: 1G
reservations:
cpus: '0.5'
memory: 512M
volumes:
rabbitmq_data:

View File

@@ -20,7 +20,7 @@ services:
- *timezone
- redis_data:/data
# !! Uncomment to use a custom redis.conf file
# Use a custom redis.conf file
# - ./redis.conf:/etc/redis/redis.conf
environment:
- SKIP_FIX_PERMS=${SKIP_FIX_PERMS:-}