mirror of
https://github.com/infiniflow/ragflow.git
synced 2026-07-01 16:25:44 +08:00
Fix docker building (#13681)
### What problem does this PR solve? 1. Refactor go server log 2. Update docker building, since nginx config should be set according to the deployment. ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue) --------- Signed-off-by: Jin Hai <haijin.chn@gmail.com>
This commit is contained in:
@@ -220,6 +220,13 @@ COPY docker/service_conf.yaml.template ./conf/service_conf.yaml.template
|
||||
COPY docker/entrypoint.sh ./
|
||||
RUN chmod +x ./entrypoint*.sh
|
||||
|
||||
# Copy nginx configuration for frontend serving
|
||||
COPY docker/nginx/ragflow.conf.golang docker/nginx/ragflow.conf.python docker/nginx/ragflow.conf.hybrid docker/nginx/nginx.conf docker/nginx/proxy.conf /etc/nginx/
|
||||
RUN mv /etc/nginx/ragflow.conf.golang /etc/nginx/conf.d/ragflow.conf.golang && \
|
||||
mv /etc/nginx/ragflow.conf.python /etc/nginx/conf.d/ragflow.conf.python && \
|
||||
mv /etc/nginx/ragflow.conf.hybrid /etc/nginx/conf.d/ragflow.conf.hybrid && \
|
||||
rm -f /etc/nginx/sites-enabled/default
|
||||
|
||||
# Copy compiled web pages
|
||||
COPY --from=builder /ragflow/web/dist /ragflow/web/dist
|
||||
|
||||
|
||||
@@ -246,7 +246,7 @@ func startServer(config *server.Config) {
|
||||
local.SetAdminStatus(0, "")
|
||||
} else {
|
||||
local.SetAdminStatus(1, err.Error())
|
||||
logger.Warn(fmt.Sprintf(err.Error()))
|
||||
//logger.Warn(fmt.Sprintf(err.Error()))
|
||||
}
|
||||
})
|
||||
heartbeatReporter.Start()
|
||||
|
||||
@@ -38,9 +38,9 @@ services:
|
||||
- ${GO_ADMIN_PORT}:9383
|
||||
volumes:
|
||||
- ./ragflow-logs:/ragflow/logs
|
||||
- ./nginx/ragflow.conf:/etc/nginx/conf.d/ragflow.conf
|
||||
- ./nginx/proxy.conf:/etc/nginx/proxy.conf
|
||||
- ./nginx/nginx.conf:/etc/nginx/nginx.conf
|
||||
# - ./nginx/ragflow.conf:/etc/nginx/conf.d/ragflow.conf
|
||||
# - ./nginx/proxy.conf:/etc/nginx/proxy.conf
|
||||
# - ./nginx/nginx.conf:/etc/nginx/nginx.conf
|
||||
- ./service_conf.yaml.template:/ragflow/conf/service_conf.yaml.template
|
||||
- ./entrypoint.sh:/ragflow/entrypoint.sh
|
||||
env_file: .env
|
||||
@@ -86,9 +86,9 @@ services:
|
||||
- ${SVR_MCP_PORT}:9382 # entry for MCP (host_port:docker_port). The docker_port must match the value you set for `mcp-port` above.
|
||||
volumes:
|
||||
- ./ragflow-logs:/ragflow/logs
|
||||
- ./nginx/ragflow.conf:/etc/nginx/conf.d/ragflow.conf
|
||||
- ./nginx/proxy.conf:/etc/nginx/proxy.conf
|
||||
- ./nginx/nginx.conf:/etc/nginx/nginx.conf
|
||||
# - ./nginx/ragflow.conf:/etc/nginx/conf.d/ragflow.conf
|
||||
# - ./nginx/proxy.conf:/etc/nginx/proxy.conf
|
||||
# - ./nginx/nginx.conf:/etc/nginx/nginx.conf
|
||||
- ./service_conf.yaml.template:/ragflow/conf/service_conf.yaml.template
|
||||
- ./entrypoint.sh:/ragflow/entrypoint.sh
|
||||
env_file: .env
|
||||
|
||||
@@ -175,6 +175,27 @@ done < "${TEMPLATE_FILE}"
|
||||
export LD_LIBRARY_PATH="/usr/lib/x86_64-linux-gnu/"
|
||||
PY=python3
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# Select Nginx Configuration based on API_PROXY_SCHEME
|
||||
# -----------------------------------------------------------------------------
|
||||
NGINX_CONF_DIR="/etc/nginx/conf.d"
|
||||
if [ -n "$API_PROXY_SCHEME" ]; then
|
||||
if [[ "${API_PROXY_SCHEME}" == "hybrid" ]]; then
|
||||
mv -f "$NGINX_CONF_DIR/ragflow.conf.hybrid" "$NGINX_CONF_DIR/ragflow.conf"
|
||||
echo "Applied nginx config: ragflow.conf.hybrid"
|
||||
elif [[ "${API_PROXY_SCHEME}" == "go" ]]; then
|
||||
mv -f "$NGINX_CONF_DIR/ragflow.conf.golang" "$NGINX_CONF_DIR/ragflow.conf"
|
||||
echo "Applied nginx config: ragflow.conf.golang (default)"
|
||||
else
|
||||
mv -f "$NGINX_CONF_DIR/ragflow.conf.python" "$NGINX_CONF_DIR/ragflow.conf"
|
||||
echo "Applied nginx config: ragflow.conf.python"
|
||||
fi
|
||||
else
|
||||
# Default to python backend
|
||||
mv -f "$NGINX_CONF_DIR/ragflow.conf.python" "$NGINX_CONF_DIR/ragflow.conf"
|
||||
echo "Default: applied nginx config: ragflow.conf.python"
|
||||
fi
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# Function(s)
|
||||
# -----------------------------------------------------------------------------
|
||||
|
||||
33
docker/nginx/ragflow.conf.golang
Normal file
33
docker/nginx/ragflow.conf.golang
Normal file
@@ -0,0 +1,33 @@
|
||||
server {
|
||||
listen 80;
|
||||
server_name _;
|
||||
root /ragflow/web/dist;
|
||||
|
||||
gzip on;
|
||||
gzip_min_length 1k;
|
||||
gzip_comp_level 9;
|
||||
gzip_types text/plain application/javascript application/x-javascript text/css application/xml text/javascript application/x-httpd-php image/jpeg image/gif image/png;
|
||||
gzip_vary on;
|
||||
gzip_disable "MSIE [1-6]\.";
|
||||
|
||||
location ~ ^/api/v1/admin {
|
||||
proxy_pass http://127.0.0.1:9383;
|
||||
include proxy.conf;
|
||||
}
|
||||
|
||||
location ~ ^/(v1|api) {
|
||||
proxy_pass http://127.0.0.1:9382;
|
||||
include proxy.conf;
|
||||
}
|
||||
|
||||
location / {
|
||||
index index.html;
|
||||
try_files $uri $uri/ /index.html;
|
||||
}
|
||||
|
||||
# Cache-Control: max-age Expires
|
||||
location ~ ^/static/(css|js|media)/ {
|
||||
expires 10y;
|
||||
access_log off;
|
||||
}
|
||||
}
|
||||
68
docker/nginx/ragflow.conf.hybrid
Normal file
68
docker/nginx/ragflow.conf.hybrid
Normal file
@@ -0,0 +1,68 @@
|
||||
server {
|
||||
listen 80;
|
||||
server_name _;
|
||||
root /ragflow/web/dist;
|
||||
|
||||
gzip on;
|
||||
gzip_min_length 1k;
|
||||
gzip_comp_level 9;
|
||||
gzip_types text/plain application/javascript application/x-javascript text/css application/xml text/javascript application/x-httpd-php image/jpeg image/gif image/png;
|
||||
gzip_vary on;
|
||||
gzip_disable "MSIE [1-6]\.";
|
||||
|
||||
location ~ ^/api/v1/admin/roles_with_permission {
|
||||
proxy_pass http://127.0.0.1:9381;
|
||||
include proxy.conf;
|
||||
}
|
||||
|
||||
location ~ ^/api/v1/admin/sandbox {
|
||||
proxy_pass http://127.0.0.1:9381;
|
||||
include proxy.conf;
|
||||
}
|
||||
|
||||
location ~ ^/api/v1/admin/roles {
|
||||
proxy_pass http://127.0.0.1:9381;
|
||||
include proxy.conf;
|
||||
}
|
||||
|
||||
location ~ ^/api/v1/admin/whitelist {
|
||||
proxy_pass http://127.0.0.1:9381;
|
||||
include proxy.conf;
|
||||
}
|
||||
|
||||
location ~ ^/api/v1/admin/variables {
|
||||
proxy_pass http://127.0.0.1:9381;
|
||||
include proxy.conf;
|
||||
}
|
||||
|
||||
location ~ ^/api/v1/admin {
|
||||
proxy_pass http://127.0.0.1:9383;
|
||||
include proxy.conf;
|
||||
}
|
||||
|
||||
location ~ ^/v1/system/config {
|
||||
proxy_pass http://127.0.0.1:9384;
|
||||
include proxy.conf;
|
||||
}
|
||||
|
||||
location ~ ^/v1/user/(login|logout) {
|
||||
proxy_pass http://127.0.0.1:9384;
|
||||
include proxy.conf;
|
||||
}
|
||||
|
||||
location ~ ^/(v1|api) {
|
||||
proxy_pass http://127.0.0.1:9380;
|
||||
include proxy.conf;
|
||||
}
|
||||
|
||||
location / {
|
||||
index index.html;
|
||||
try_files $uri $uri/ /index.html;
|
||||
}
|
||||
|
||||
# Cache-Control: max-age Expires
|
||||
location ~ ^/static/(css|js|media)/ {
|
||||
expires 10y;
|
||||
access_log off;
|
||||
}
|
||||
}
|
||||
@@ -26,7 +26,7 @@ server {
|
||||
try_files $uri $uri/ /index.html;
|
||||
}
|
||||
|
||||
# Cache-Control: max-age~@~AExpires
|
||||
# Cache-Control: max-age Expires
|
||||
location ~ ^/static/(css|js|media)/ {
|
||||
expires 10y;
|
||||
access_log off;
|
||||
@@ -17,6 +17,8 @@
|
||||
package local
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"ragflow/internal/logger"
|
||||
"sync"
|
||||
)
|
||||
|
||||
@@ -66,6 +68,10 @@ func SetAdminStatus(status int, reason string) {
|
||||
}
|
||||
adminStatus.Status = status
|
||||
adminStatus.Reason = reason
|
||||
|
||||
if adminStatus.Status != 0 {
|
||||
logger.Warn(fmt.Sprintf("Admin server is unavailable, reason: %s", adminStatus.Reason))
|
||||
}
|
||||
}
|
||||
|
||||
// IsAdminAvailable returns true if admin is valid (Status == 0)
|
||||
|
||||
@@ -94,11 +94,6 @@ export default defineConfig(({ mode }) => {
|
||||
changeOrigin: true,
|
||||
ws: true,
|
||||
},
|
||||
'/api/v1/billing/current_plan': {
|
||||
target: 'http://127.0.0.1:9381/',
|
||||
changeOrigin: true,
|
||||
ws: true,
|
||||
},
|
||||
'/api/v1/admin': {
|
||||
target: 'http://127.0.0.1:9383/',
|
||||
changeOrigin: true,
|
||||
|
||||
Reference in New Issue
Block a user