-
Notifications
You must be signed in to change notification settings - Fork 10
docs: add developer setup guides and improve deployment scripts #53
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -5,11 +5,11 @@ admin: | |||||||||
| host: 0.0.0.0 | ||||||||||
| http_port: 9381 | ||||||||||
| mysql: | ||||||||||
| name: 'rag_flow' | ||||||||||
| name: 'powerrag' | ||||||||||
| user: 'root' | ||||||||||
| password: 'infini_rag_flow' | ||||||||||
| host: 'localhost' | ||||||||||
| port: 5455 | ||||||||||
| password: 'powerrag' | ||||||||||
| host: '127.0.0.1' | ||||||||||
| port: 2881 | ||||||||||
| max_connections: 900 | ||||||||||
| stale_timeout: 300 | ||||||||||
| max_allowed_packet: 1073741824 | ||||||||||
|
|
@@ -31,12 +31,12 @@ infinity: | |||||||||
| uri: 'localhost:23817' | ||||||||||
| db_name: 'default_db' | ||||||||||
| oceanbase: | ||||||||||
| scheme: 'oceanbase' # set 'mysql' to create connection using mysql config | ||||||||||
| scheme: 'mysql' | ||||||||||
| config: | ||||||||||
| db_name: 'test' | ||||||||||
| user: 'root@ragflow' | ||||||||||
| password: 'infini_rag_flow' | ||||||||||
| host: 'localhost' | ||||||||||
| db_name: 'powerrag_doc' | ||||||||||
| user: 'root' | ||||||||||
| password: 'powerrag' | ||||||||||
| host: '127.0.0.1' | ||||||||||
| port: 2881 | ||||||||||
|
Comment on lines
+37
to
40
|
||||||||||
| user: 'root' | |
| password: 'powerrag' | |
| host: '127.0.0.1' | |
| port: 2881 |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -24,12 +24,25 @@ load_env_file() { | |
| # Load environment variables | ||
| load_env_file | ||
|
|
||
| # Get the project root directory (parent of docker directory) | ||
| SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" | ||
| PROJECT_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)" | ||
| cd "$PROJECT_ROOT" | ||
|
|
||
| # Unset HTTP proxies that might be set by Docker daemon | ||
| export http_proxy=""; export https_proxy=""; export no_proxy=""; export HTTP_PROXY=""; export HTTPS_PROXY=""; export NO_PROXY="" | ||
| export PYTHONPATH=$(pwd) | ||
| export PYTHONPATH="$PROJECT_ROOT" | ||
|
|
||
| export LD_LIBRARY_PATH=/usr/lib/x86_64-linux-gnu/ | ||
| JEMALLOC_PATH=$(pkg-config --variable=libdir jemalloc)/libjemalloc.so | ||
|
|
||
| # Try to find jemalloc, but don't fail if not found | ||
| JEMALLOC_PATH="" | ||
| if command -v pkg-config >/dev/null 2>&1; then | ||
| JEMALLOC_LIBDIR=$(pkg-config --variable=libdir jemalloc 2>/dev/null || echo "") | ||
| if [ -n "$JEMALLOC_LIBDIR" ] && [ -f "$JEMALLOC_LIBDIR/libjemalloc.so" ]; then | ||
| JEMALLOC_PATH="$JEMALLOC_LIBDIR/libjemalloc.so" | ||
| fi | ||
| fi | ||
|
|
||
| PY=python3 | ||
|
|
||
|
|
@@ -48,7 +61,12 @@ STOP=false | |
| PIDS=() | ||
|
|
||
| # Set the path to the NLTK data directory | ||
| export NLTK_DATA="./nltk_data" | ||
| export NLTK_DATA="$PROJECT_ROOT/nltk_data" | ||
|
|
||
| # Set additional environment variables for OceanBase | ||
| export DOC_ENGINE=${DOC_ENGINE:-oceanbase} | ||
| export STORAGE_IMPL=${STORAGE_IMPL:-OPENDAL} | ||
| export CACHE_TYPE=${CACHE_TYPE:-oceanbase} | ||
|
|
||
| # Function to handle termination signals | ||
| cleanup() { | ||
|
|
@@ -73,7 +91,11 @@ task_exe(){ | |
| local retry_count=0 | ||
| while ! $STOP && [ $retry_count -lt $MAX_RETRIES ]; do | ||
| echo "Starting task_executor.py for task $task_id (Attempt $((retry_count+1)))" | ||
| LD_PRELOAD=$JEMALLOC_PATH $PY rag/svr/task_executor.py "$task_id" | ||
| if [ -n "$JEMALLOC_PATH" ]; then | ||
| LD_PRELOAD=$JEMALLOC_PATH $PY rag/svr/task_executor.py "$task_id" | ||
| else | ||
| $PY rag/svr/task_executor.py "$task_id" | ||
| fi | ||
|
Comment on lines
+94
to
+98
|
||
| EXIT_CODE=$? | ||
| if [ $EXIT_CODE -eq 0 ]; then | ||
| echo "task_executor.py for task $task_id exited successfully." | ||
|
|
@@ -114,6 +136,29 @@ run_server(){ | |
| fi | ||
| } | ||
|
|
||
| # Function to execute sync_data_source with retry logic | ||
| run_sync_data_source(){ | ||
| local retry_count=0 | ||
| while ! $STOP && [ $retry_count -lt $MAX_RETRIES ]; do | ||
| echo "Starting sync_data_source.py (Attempt $((retry_count+1)))" | ||
| $PY rag/svr/sync_data_source.py | ||
| EXIT_CODE=$? | ||
| if [ $EXIT_CODE -eq 0 ]; then | ||
|
Comment on lines
+142
to
+146
|
||
| echo "sync_data_source.py exited successfully." | ||
| break | ||
| else | ||
| echo "sync_data_source.py failed with exit code $EXIT_CODE. Retrying..." >&2 | ||
| retry_count=$((retry_count + 1)) | ||
| sleep 2 | ||
| fi | ||
| done | ||
|
|
||
| if [ $retry_count -ge $MAX_RETRIES ]; then | ||
| echo "sync_data_source.py failed after $MAX_RETRIES attempts. Exiting..." >&2 | ||
| cleanup | ||
| fi | ||
| } | ||
|
|
||
| # Start task executors | ||
| for ((i=0;i<WS;i++)) | ||
| do | ||
|
|
@@ -125,5 +170,9 @@ done | |
| run_server & | ||
| PIDS+=($!) | ||
|
|
||
| # Start data source sync service (required for AliDing KB, Notion, Confluence, etc.) | ||
| run_sync_data_source & | ||
| PIDS+=($!) | ||
|
|
||
| # Wait for all background processes to finish | ||
| wait | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This config switches the metadata DB to use the root account with a hard-coded password. Even for dev defaults, using a privileged user and committing real credentials makes accidental exposure/misuse more likely; prefer a dedicated least-privilege DB user and/or read the password from environment variables (keeping this file as a template/example).