orztv commited on
Commit
3f73fdd
·
1 Parent(s): 72eeb27
Files changed (2) hide show
  1. Dockerfile +2 -1
  2. run.sh +21 -4
Dockerfile CHANGED
@@ -32,6 +32,7 @@ ENV WEBHOOK_URL=${WEBHOOK_URL} \
32
  # 添加 Qdrant 配置
33
  QDRANT_HOST=localhost \
34
  QDRANT_PORT=6333 \
 
35
  # 添加超时配置
36
  WAIT_TIMEOUT=30 \
37
  # 添加日志级别
@@ -60,7 +61,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
60
  && dpkg-reconfigure --frontend noninteractive tzdata \
61
  # 下载并安装预编译的 Qdrant
62
  && cd /tmp \
63
- && curl -L https://github.com/qdrant/qdrant/releases/download/v1.12.4/qdrant-x86_64-unknown-linux-gnu.tar.gz -o qdrant.tar.gz \
64
  && tar xvf qdrant.tar.gz \
65
  && mv qdrant /usr/local/bin/ \
66
  && rm qdrant.tar.gz \
 
32
  # 添加 Qdrant 配置
33
  QDRANT_HOST=localhost \
34
  QDRANT_PORT=6333 \
35
+ QDRANT_VERSION=1.12.4 \
36
  # 添加超时配置
37
  WAIT_TIMEOUT=30 \
38
  # 添加日志级别
 
61
  && dpkg-reconfigure --frontend noninteractive tzdata \
62
  # 下载并安装预编译的 Qdrant
63
  && cd /tmp \
64
+ && curl -L https://github.com/qdrant/qdrant/releases/download/v${QDRANT_VERSION}/qdrant-x86_64-unknown-linux-gnu.tar.gz -o qdrant.tar.gz \
65
  && tar xvf qdrant.tar.gz \
66
  && mv qdrant /usr/local/bin/ \
67
  && rm qdrant.tar.gz \
run.sh CHANGED
@@ -53,8 +53,9 @@ start_redis() {
53
  # 设置 Redis 配置
54
  redis-cli config set maxmemory 512mb
55
  redis-cli config set maxmemory-policy allkeys-lru
56
-
57
  echo "Redis server started successfully"
 
58
  }
59
 
60
  # 启动 Qdrant 服务
@@ -76,6 +77,7 @@ service:
76
  host: 0.0.0.0
77
  port: 6333
78
  grpc_port: 6334
 
79
 
80
  storage:
81
  storage_path: /home/pn/.n8n/qdrant/storage
@@ -97,9 +99,20 @@ EOF
97
  while [ $SECONDS -lt $end ]; do
98
  if curl -s http://localhost:6333/health >/dev/null; then
99
  echo "Qdrant server started successfully"
100
- # 输出版本信息
101
- echo "Qdrant version:"
102
- curl -s http://localhost:6333/version
 
 
 
 
 
 
 
 
 
 
 
103
  return 0
104
  fi
105
  echo "Waiting for Qdrant to start..."
@@ -165,13 +178,17 @@ main() {
165
 
166
  # 启动服务
167
  wait_for_service "PostgreSQL" "${DB_POSTGRESDB_HOST}" "${DB_POSTGRESDB_PORT}"
 
168
  start_redis
 
169
  start_qdrant
 
170
  check_services
171
 
172
  # 设置 N8N 环境变量
173
  source /home/pn/n8n/config/n8n_env.sh
174
 
 
175
  echo "Starting n8n..."
176
  exec n8n start
177
  }
 
53
  # 设置 Redis 配置
54
  redis-cli config set maxmemory 512mb
55
  redis-cli config set maxmemory-policy allkeys-lru
56
+ echo ""
57
  echo "Redis server started successfully"
58
+ echo ""
59
  }
60
 
61
  # 启动 Qdrant 服务
 
77
  host: 0.0.0.0
78
  port: 6333
79
  grpc_port: 6334
80
+ api_key: "api-key"
81
 
82
  storage:
83
  storage_path: /home/pn/.n8n/qdrant/storage
 
99
  while [ $SECONDS -lt $end ]; do
100
  if curl -s http://localhost:6333/health >/dev/null; then
101
  echo "Qdrant server started successfully"
102
+ # 测试 Qdrant API 连接
103
+ echo "Testing Qdrant API..."
104
+ # 创建测试集合
105
+ curl -X PUT 'http://localhost:6333/collections/test_collection' \
106
+ -H 'Content-Type: application/json' \
107
+ -d '{
108
+ "vectors": {
109
+ "size": 4,
110
+ "distance": "Cosine"
111
+ }
112
+ }'
113
+ # 删除测试集合
114
+ curl -X DELETE 'http://localhost:6333/collections/test_collection'
115
+ echo "Qdrant API test successful"
116
  return 0
117
  fi
118
  echo "Waiting for Qdrant to start..."
 
178
 
179
  # 启动服务
180
  wait_for_service "PostgreSQL" "${DB_POSTGRESDB_HOST}" "${DB_POSTGRESDB_PORT}"
181
+ echo ""
182
  start_redis
183
+ echo ""
184
  start_qdrant
185
+ echo ""
186
  check_services
187
 
188
  # 设置 N8N 环境变量
189
  source /home/pn/n8n/config/n8n_env.sh
190
 
191
+ echo ""
192
  echo "Starting n8n..."
193
  exec n8n start
194
  }