hijnu commited on
Commit
148af65
1 Parent(s): 0a4cc64

Update run.sh

Browse files
Files changed (1) hide show
  1. run.sh +31 -5
run.sh CHANGED
@@ -1,5 +1,8 @@
1
  #!/bin/bash
2
 
 
 
 
3
  # 启动 PostgreSQL 服务
4
  /usr/local/bin/docker-entrypoint.sh postgres &
5
 
@@ -14,13 +17,36 @@ echo "PostgreSQL 服务已启动!"
14
  echo "运行数据库导入脚本..."
15
  ${WORKDIR}/import-db.sh
16
 
17
- sleep 2
18
-
19
  export N8N_ENCRYPTION_KEY="n8n8n8n"
20
- # Allows usage of all builtin modules
21
  export NODE_FUNCTION_ALLOW_BUILTIN=*
22
- # Allow usage of external npm modules.
23
  export NODE_FUNCTION_ALLOW_EXTERNAL=*
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
24
 
25
  # 使用绝对路径调用 n8n
26
- exec n8n
 
1
  #!/bin/bash
2
 
3
+ current_time=$(date +"%Y-%m-%d %H:%M:%S")
4
+ LOG_FILE="${WORKDIR}/buildlog.txt"
5
+
6
  # 启动 PostgreSQL 服务
7
  /usr/local/bin/docker-entrypoint.sh postgres &
8
 
 
17
  echo "运行数据库导入脚本..."
18
  ${WORKDIR}/import-db.sh
19
 
20
+ # 设置 N8N 环境变量
 
21
  export N8N_ENCRYPTION_KEY="n8n8n8n"
22
+ # 允许使用所有内建模块
23
  export NODE_FUNCTION_ALLOW_BUILTIN=*
24
+ # 允许使用外部 npm 模块
25
  export NODE_FUNCTION_ALLOW_EXTERNAL=*
26
+ # Activate automatic data pruning
27
+ export EXECUTIONS_DATA_PRUNE=true
28
+ # Number of hours after execution that n8n deletes data
29
+ export EXECUTIONS_DATA_MAX_AGE=36
30
+ # Number of executions to store
31
+ export EXECUTIONS_DATA_PRUNE_MAX_COUNT=1000
32
+ # Save executions ending in errors
33
+ export EXECUTIONS_DATA_SAVE_ON_ERROR=all
34
+ # Save successful executions
35
+ export EXECUTIONS_DATA_SAVE_ON_SUCCESS=all
36
+ # Don't save node progress for each execution
37
+ export EXECUTIONS_DATA_SAVE_ON_PROGRESS=false
38
+ # Don't save manually launched executions
39
+ export EXECUTIONS_DATA_SAVE_MANUAL_EXECUTIONS=false
40
+
41
+ echo "检查 WebDAV 日志文件是否存在,下载或创建新文件..."
42
+ if curl -f -u "${WEBDAV_USER}:${WEBDAV_PASSWORD}" -o "${LOG_FILE}" "${WEBDAV_URL}/buildlog.txt"; then
43
+ echo "日志文件下载成功并写入部署时间: ${LOG_FILE}"
44
+ echo "hf部署时间: ${current_time}" >> "${LOG_FILE}"
45
+ else
46
+ echo "WebDAV 上日志文件不存在,创建新的日志文件: ${LOG_FILE}"
47
+ touch "${LOG_FILE}"
48
+ echo "hf部署时间: ${current_time}" >> "${LOG_FILE}"
49
+ fi
50
 
51
  # 使用绝对路径调用 n8n
52
+ exec n8n