mirror of
https://github.com/kossakovsky/n8n-install.git
synced 2026-04-26 17:56:10 +00:00
feat: Add LibreTranslate self-hosted translation service
- Add LibreTranslate service with 50+ language support - Configure with Basic Auth for security - Integrate with wizard and final report - Add documentation to README
This commit is contained in:
20
scripts/03_generate_secrets.sh
Executable file → Normal file
20
scripts/03_generate_secrets.sh
Executable file → Normal file
@@ -54,6 +54,7 @@ declare -A VARS_TO_GENERATE=(
|
||||
["COMFYUI_PASSWORD"]="password:32" # Added ComfyUI basic auth password
|
||||
["RAGAPP_PASSWORD"]="password:32" # Added RAGApp basic auth password
|
||||
["PADDLEOCR_PASSWORD"]="password:32" # Added PaddleOCR basic auth password
|
||||
["LIBRETRANSLATE_PASSWORD"]="password:32" # Added LibreTranslate basic auth password
|
||||
)
|
||||
|
||||
# Initialize existing_env_vars and attempt to read .env if it exists
|
||||
@@ -375,6 +376,7 @@ generated_values["WEAVIATE_USERNAME"]="$USER_EMAIL" # Set Weaviate username for
|
||||
generated_values["COMFYUI_USERNAME"]="$USER_EMAIL" # Set ComfyUI username for Caddy
|
||||
generated_values["RAGAPP_USERNAME"]="$USER_EMAIL" # Set RAGApp username for Caddy
|
||||
generated_values["PADDLEOCR_USERNAME"]="$USER_EMAIL" # Set PaddleOCR username for Caddy
|
||||
generated_values["LIBRETRANSLATE_USERNAME"]="$USER_EMAIL" # Set LibreTranslate username for Caddy
|
||||
|
||||
if [[ -n "$OPENAI_API_KEY" ]]; then
|
||||
generated_values["OPENAI_API_KEY"]="$OPENAI_API_KEY"
|
||||
@@ -401,6 +403,7 @@ found_vars["NEO4J_AUTH_USERNAME"]=0
|
||||
found_vars["COMFYUI_USERNAME"]=0
|
||||
found_vars["RAGAPP_USERNAME"]=0
|
||||
found_vars["PADDLEOCR_USERNAME"]=0
|
||||
found_vars["LIBRETRANSLATE_USERNAME"]=0
|
||||
|
||||
# Read template, substitute domain, generate initial values
|
||||
while IFS= read -r line || [[ -n "$line" ]]; do
|
||||
@@ -447,7 +450,7 @@ while IFS= read -r line || [[ -n "$line" ]]; do
|
||||
# This 'else' block is for lines from template not covered by existing values or VARS_TO_GENERATE.
|
||||
# Check if it is one of the user input vars - these are handled by found_vars later if not in template.
|
||||
is_user_input_var=0 # Reset for each line
|
||||
user_input_vars=("FLOWISE_USERNAME" "DASHBOARD_USERNAME" "LETSENCRYPT_EMAIL" "RUN_N8N_IMPORT" "PROMETHEUS_USERNAME" "SEARXNG_USERNAME" "OPENAI_API_KEY" "LANGFUSE_INIT_USER_EMAIL" "N8N_WORKER_COUNT" "WEAVIATE_USERNAME" "NEO4J_AUTH_USERNAME" "COMFYUI_USERNAME" "RAGAPP_USERNAME")
|
||||
user_input_vars=("FLOWISE_USERNAME" "DASHBOARD_USERNAME" "LETSENCRYPT_EMAIL" "RUN_N8N_IMPORT" "PROMETHEUS_USERNAME" "SEARXNG_USERNAME" "OPENAI_API_KEY" "LANGFUSE_INIT_USER_EMAIL" "N8N_WORKER_COUNT" "WEAVIATE_USERNAME" "NEO4J_AUTH_USERNAME" "COMFYUI_USERNAME" "RAGAPP_USERNAME" "PADDLEOCR_USERNAME" "LIBRETRANSLATE_USERNAME")
|
||||
for uivar in "${user_input_vars[@]}"; do
|
||||
if [[ "$varName" == "$uivar" ]]; then
|
||||
is_user_input_var=1
|
||||
@@ -529,7 +532,7 @@ if [[ -z "${generated_values[SERVICE_ROLE_KEY]}" ]]; then
|
||||
fi
|
||||
|
||||
# Add any custom variables that weren't found in the template
|
||||
for var in "FLOWISE_USERNAME" "DASHBOARD_USERNAME" "LETSENCRYPT_EMAIL" "RUN_N8N_IMPORT" "OPENAI_API_KEY" "PROMETHEUS_USERNAME" "SEARXNG_USERNAME" "LANGFUSE_INIT_USER_EMAIL" "N8N_WORKER_COUNT" "WEAVIATE_USERNAME" "NEO4J_AUTH_USERNAME" "COMFYUI_USERNAME" "RAGAPP_USERNAME"; do
|
||||
for var in "FLOWISE_USERNAME" "DASHBOARD_USERNAME" "LETSENCRYPT_EMAIL" "RUN_N8N_IMPORT" "OPENAI_API_KEY" "PROMETHEUS_USERNAME" "SEARXNG_USERNAME" "LANGFUSE_INIT_USER_EMAIL" "N8N_WORKER_COUNT" "WEAVIATE_USERNAME" "NEO4J_AUTH_USERNAME" "COMFYUI_USERNAME" "RAGAPP_USERNAME" "PADDLEOCR_USERNAME" "LIBRETRANSLATE_USERNAME"; do
|
||||
if [[ ${found_vars["$var"]} -eq 0 && -v generated_values["$var"] ]]; then
|
||||
# Before appending, check if it's already in TMP_ENV_FILE to avoid duplicates
|
||||
if ! grep -q -E "^${var}=" "$TMP_ENV_FILE"; then
|
||||
@@ -676,6 +679,17 @@ if [[ -z "$FINAL_RAGAPP_HASH" && -n "$RAGAPP_PLAIN_PASS" ]]; then
|
||||
fi
|
||||
_update_or_add_env_var "RAGAPP_PASSWORD_HASH" "$FINAL_RAGAPP_HASH"
|
||||
|
||||
# --- LIBRETRANSLATE ---
|
||||
LIBRETRANSLATE_PLAIN_PASS="${generated_values["LIBRETRANSLATE_PASSWORD"]}"
|
||||
FINAL_LIBRETRANSLATE_HASH="${generated_values[LIBRETRANSLATE_PASSWORD_HASH]}"
|
||||
if [[ -z "$FINAL_LIBRETRANSLATE_HASH" && -n "$LIBRETRANSLATE_PLAIN_PASS" ]]; then
|
||||
NEW_HASH=$(_generate_and_get_hash "$LIBRETRANSLATE_PLAIN_PASS")
|
||||
if [[ -n "$NEW_HASH" ]]; then
|
||||
FINAL_LIBRETRANSLATE_HASH="$NEW_HASH"
|
||||
generated_values["LIBRETRANSLATE_PASSWORD_HASH"]="$NEW_HASH"
|
||||
fi
|
||||
fi
|
||||
_update_or_add_env_var "LIBRETRANSLATE_PASSWORD_HASH" "$FINAL_LIBRETRANSLATE_HASH"
|
||||
|
||||
if [ $? -eq 0 ]; then # This $? reflects the status of the last mv command from the last _update_or_add_env_var call.
|
||||
# For now, assuming if we reached here and mv was fine, primary operations were okay.
|
||||
@@ -689,4 +703,4 @@ fi
|
||||
# Uninstall caddy
|
||||
apt remove -y caddy
|
||||
|
||||
exit 0
|
||||
exit 0
|
||||
|
||||
3
scripts/04_wizard.sh
Executable file → Normal file
3
scripts/04_wizard.sh
Executable file → Normal file
@@ -58,6 +58,7 @@ base_services_data=(
|
||||
"gotenberg" "Gotenberg (Document Conversion API)"
|
||||
"langfuse" "Langfuse Suite (AI Observability - includes Clickhouse, Minio)"
|
||||
"letta" "Letta (Agent Server & SDK)"
|
||||
"libretranslate" "LibreTranslate (Self-hosted translation API - 50+ languages)"
|
||||
"monitoring" "Monitoring Suite (Prometheus, Grafana, cAdvisor, Node-Exporter)"
|
||||
"n8n" "n8n, n8n-worker, n8n-import (Workflow Automation)"
|
||||
"neo4j" "Neo4j (Graph Database)"
|
||||
@@ -287,4 +288,4 @@ fi
|
||||
# Make the script executable (though install.sh calls it with bash)
|
||||
chmod +x "$SCRIPT_DIR/04_wizard.sh"
|
||||
|
||||
exit 0
|
||||
exit 0
|
||||
|
||||
25
scripts/06_final_report.sh
Executable file → Normal file
25
scripts/06_final_report.sh
Executable file → Normal file
@@ -164,6 +164,29 @@ if is_profile_active "comfyui"; then
|
||||
echo "Password: ${COMFYUI_PASSWORD:-<not_set_in_env>}"
|
||||
fi
|
||||
|
||||
if is_profile_active "libretranslate"; then
|
||||
echo
|
||||
echo "================================= LibreTranslate ==========================="
|
||||
echo
|
||||
echo "Host: ${LIBRETRANSLATE_HOSTNAME:-<hostname_not_set>}"
|
||||
echo "User: ${LIBRETRANSLATE_USERNAME:-<not_set_in_env>}"
|
||||
echo "Password: ${LIBRETRANSLATE_PASSWORD:-<not_set_in_env>}"
|
||||
echo "API (external via Caddy): https://${LIBRETRANSLATE_HOSTNAME:-<hostname_not_set>}"
|
||||
echo "API (internal): http://libretranslate:5000"
|
||||
echo ""
|
||||
echo "API Endpoints:"
|
||||
echo " - Translate: POST /translate"
|
||||
echo " - Detect Language: POST /detect"
|
||||
echo " - Available Languages: GET /languages"
|
||||
echo ""
|
||||
echo "Example n8n usage:"
|
||||
echo " URL: http://libretranslate:5000/translate"
|
||||
echo " Method: POST"
|
||||
echo " Body: {\"q\":\"Hello\",\"source\":\"en\",\"target\":\"de\"}"
|
||||
echo ""
|
||||
echo "Docs: https://github.com/LibreTranslate/LibreTranslate"
|
||||
fi
|
||||
|
||||
if is_profile_active "qdrant"; then
|
||||
echo
|
||||
echo "================================= Qdrant =============================="
|
||||
@@ -333,5 +356,3 @@ echo "======================================================================"
|
||||
echo
|
||||
log_info "Thank you for using this installer setup!"
|
||||
echo
|
||||
|
||||
exit 0
|
||||
Reference in New Issue
Block a user