theta tsmc-prevv commited on
Commit
1d1faf9
·
1 Parent(s): 242ee03

Add Kibana component for Elasticsearch (#1710)

Browse files

### What problem does this PR solve?
Add Kibana component for Elasticsearch

### Type of change

- [ ] Bug Fix (non-breaking change which fixes an issue)
- [x] New Feature (non-breaking change which adds functionality)

---------

Co-authored-by: Theta Wang (ncu) <[email protected]>

docker/.env CHANGED
@@ -10,6 +10,8 @@ ELASTIC_PASSWORD=infini_rag_flow
10
 
11
  # Port to expose Kibana to the host
12
  KIBANA_PORT=6601
 
 
13
 
14
  # Increase or decrease based on the available host memory (in bytes)
15
 
 
10
 
11
  # Port to expose Kibana to the host
12
  KIBANA_PORT=6601
13
+ KIBANA_USER=rag_flow
14
+ KIBANA_PASSWORD=infini_rag_flow
15
 
16
  # Increase or decrease based on the available host memory (in bytes)
17
 
docker/docker-compose-admin-tool.yml ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ services:
2
+ kibana:
3
+ image: kibana:${STACK_VERSION}
4
+ container_name: ragflow-kibana
5
+ environment:
6
+ ELASTICSEARCH_USERNAME: ${KIBANA_USER}
7
+ ELASTICSEARCH_PASSWORD: ${KIBANA_PASSWORD}
8
+ ELASTICSEARCH_HOSTS: "http://es01:9200"
9
+ ports:
10
+ - ${KIBANA_PORT}:5601
11
+ depends_on:
12
+ es01:
13
+ condition: service_healthy
14
+ kibana-user-init:
15
+ condition: service_completed_successfully
16
+
17
+ networks:
18
+ - ragflow
19
+ kibana-user-init:
20
+ image: appropriate/curl
21
+ depends_on:
22
+ es01:
23
+ condition: service_healthy
24
+ volumes:
25
+ - ./init-kibana.sh:/app/init-kibana.sh
26
+ environment:
27
+ - ELASTIC_PASSWORD=${ELASTIC_PASSWORD}
28
+ - KIBANA_USER=${KIBANA_USER}
29
+ - KIBANA_PASSWORD=${KIBANA_PASSWORD}
30
+ command: /bin/sh -c "sh /app/init-kibana.sh"
31
+ networks:
32
+ - ragflow
33
+ restart: 'no'
docker/docker-compose.yml CHANGED
@@ -1,7 +1,8 @@
1
  include:
2
  - path: ./docker-compose-base.yml
3
  env_file: ./.env
4
-
 
5
  services:
6
  ragflow:
7
  depends_on:
@@ -27,4 +28,4 @@ services:
27
  - MACOS=${MACOS}
28
  networks:
29
  - ragflow
30
- restart: always
 
1
  include:
2
  - path: ./docker-compose-base.yml
3
  env_file: ./.env
4
+ - path: ./docker-compose-admin-tool.yml
5
+ env_file: ./.env
6
  services:
7
  ragflow:
8
  depends_on:
 
28
  - MACOS=${MACOS}
29
  networks:
30
  - ragflow
31
+ restart: always
docker/init-kibana.sh ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/bash
2
+
3
+ # 等待 Elasticsearch 啟動
4
+ until curl -u "elastic:${ELASTIC_PASSWORD}" -s http://es01:9200 >/dev/null; do
5
+ echo "等待 Elasticsearch 啟動..."
6
+ sleep 5
7
+ done
8
+
9
+
10
+ echo "使用者: elastic:${ELASTIC_PASSWORD}"
11
+
12
+
13
+
14
+ PAYLOAD="{
15
+ \"password\" : \"${KIBANA_PASSWORD}\",
16
+ \"roles\" : [ \"kibana_admin\",\"kibana_system\" ],
17
+ \"full_name\" : \"${KIBANA_USER}\",
18
+ \"email\" : \"${KIBANA_USER}@example.com\"
19
+ }"
20
+ echo "新用戶帳戶: $PAYLOAD"
21
+
22
+ # 創建新用戶帳戶
23
+ curl -X POST "http://es01:9200/_security/user/${KIBANA_USER}" \
24
+ -u "elastic:${ELASTIC_PASSWORD}" \
25
+ -H "Content-Type: application/json" \
26
+ -d "$PAYLOAD"s
27
+
28
+ echo "新用戶帳戶已創建"
29
+
30
+ exit 0
docker/service_conf.yaml CHANGED
@@ -17,6 +17,10 @@ es:
17
  hosts: 'http://es01:9200'
18
  username: 'elastic'
19
  password: 'infini_rag_flow'
 
 
 
 
20
  redis:
21
  db: 1
22
  password: 'infini_rag_flow'
 
17
  hosts: 'http://es01:9200'
18
  username: 'elastic'
19
  password: 'infini_rag_flow'
20
+ kibana:
21
+ hosts: 'http://${host}:6601'
22
+ username: 'rag_flow'
23
+ password: 'infini_rag_flow'
24
  redis:
25
  db: 1
26
  password: 'infini_rag_flow'