Skip to content

RAGFlow is an agent-native database: a Retrieval-Augmented Generation (RAG) engine that grew into context infrastructure.

Add Kibana component for Elasticsearch (#1710)

Wang548f01850f80
diff --git a/docker/.env b/docker/.env
index 36985f5c7d..568b5ee6c9 100644
--- a/docker/.env
+++ b/docker/.env
@@ -10,6 +10,8 @@ ELASTIC_PASSWORD=infini_rag_flow
# Port to expose Kibana to the host
KIBANA_PORT=6601
+KIBANA_USER=rag_flow
+KIBANA_PASSWORD=infini_rag_flow
# Increase or decrease based on the available host memory (in bytes)
diff --git a/docker/docker-compose-admin-tool.yml b/docker/docker-compose-admin-tool.yml
new file mode 100644
index 0000000000..1d52891af1
--- /dev/null
+++ b/docker/docker-compose-admin-tool.yml
@@ -0,0 +1,33 @@
+services:
+ kibana:
+ image: kibana:${STACK_VERSION}
+ container_name: ragflow-kibana
+ environment:
+ ELASTICSEARCH_USERNAME: ${KIBANA_USER}
+ ELASTICSEARCH_PASSWORD: ${KIBANA_PASSWORD}
+ ELASTICSEARCH_HOSTS: "http://es01:9200"
+ ports:
+ - ${KIBANA_PORT}:5601
+ depends_on:
+ es01:
+ condition: service_healthy
+ kibana-user-init:
+ condition: service_completed_successfully
+
+ networks:
+ - ragflow
+ kibana-user-init:
+ image: appropriate/curl
+ depends_on:
+ es01:
+ condition: service_healthy
+ volumes:
+ - ./init-kibana.sh:/app/init-kibana.sh
+ environment:
+ - ELASTIC_PASSWORD=${ELASTIC_PASSWORD}
+ - KIBANA_USER=${KIBANA_USER}
+ - KIBANA_PASSWORD=${KIBANA_PASSWORD}
+ command: /bin/sh -c "sh /app/init-kibana.sh"
+ networks:
+ - ragflow
+ restart: 'no'
diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml
index 97a1cb5c36..f1d5fb0069 100644
--- a/docker/docker-compose.yml
+++ b/docker/docker-compose.yml
@@ -1,7 +1,8 @@
include:
- path: ./docker-compose-base.yml
env_file: ./.env
-
+ - path: ./docker-compose-admin-tool.yml
+ env_file: ./.env
services:
ragflow:
depends_on:
@@ -27,4 +28,4 @@ services:
- MACOS=${MACOS}
networks:
- ragflow
- restart: always
+ restart: always
\ No newline at end of file
diff --git a/docker/init-kibana.sh b/docker/init-kibana.sh
new file mode 100755
index 0000000000..1e5ca6907e
--- /dev/null
+++ b/docker/init-kibana.sh
@@ -0,0 +1,30 @@
+#!/bin/bash
+
+# 等待 Elasticsearch 啟動
+until curl -u "elastic:${ELASTIC_PASSWORD}" -s http://es01:9200 >/dev/null; do
+ echo "等待 Elasticsearch 啟動..."
+ sleep 5
+done
+
+
+echo "使用者: elastic:${ELASTIC_PASSWORD}"
+
+
+
+PAYLOAD="{
+ \"password\" : \"${KIBANA_PASSWORD}\",
+ \"roles\" : [ \"kibana_admin\",\"kibana_system\" ],
+ \"full_name\" : \"${KIBANA_USER}\",
+ \"email\" : \"${KIBANA_USER}@example.com\"
+}"
+echo "新用戶帳戶: $PAYLOAD"
+
+# 創建新用戶帳戶
+curl -X POST "http://es01:9200/_security/user/${KIBANA_USER}" \
+-u "elastic:${ELASTIC_PASSWORD}" \
+-H "Content-Type: application/json" \
+-d "$PAYLOAD"s
+
+echo "新用戶帳戶已創建"
+
+exit 0
diff --git a/docker/service_conf.yaml b/docker/service_conf.yaml
index 778f0f0c16..a3538429c0 100644
--- a/docker/service_conf.yaml
+++ b/docker/service_conf.yaml
@@ -17,6 +17,10 @@ es:
hosts: 'http://es01:9200'
username: 'elastic'
password: 'infini_rag_flow'
+kibana:
+ hosts: 'http://${host}:6601'
+ username: 'rag_flow'
+ password: 'infini_rag_flow'
redis:
db: 1
password: 'infini_rag_flow'