AZLABS commited on
Commit
cc9ee69
·
verified ·
1 Parent(s): 4da4818

Update run.sh

Browse files
Files changed (1) hide show
  1. run.sh +22 -16
run.sh CHANGED
@@ -1,31 +1,36 @@
1
  #!/bin/bash
2
 
 
3
  WEBDAV_URL="$WEBDAV_URL"
 
4
  WEBDAV_USER="$WEBDAV_USER"
 
5
  WEBDAV_PASSWORD="$WEBDAV_PASSWORD"
6
 
 
7
  current_time=$(date +"%Y-%m-%d %H:%M:%S")
 
8
  # LOG_FILE="${WORKDIR}/buildlog.txt"
9
 
10
- # 启动 PostgreSQL 服务
11
  /usr/local/bin/docker-entrypoint.sh postgres &
12
 
13
- # 检查 PostgreSQL 服务是否已启动
14
- echo "等待 PostgreSQL 服务启动..."
15
  until pg_isready -h localhost; do
16
  sleep 3
17
  done
18
- echo "PostgreSQL 服务已启动!"
19
 
20
- # 执行数据库导入脚本
21
- echo "运行数据库导入脚本..."
22
  ${WORKDIR}/import-db.sh
23
 
24
- # 设置 N8N 环境变量
25
  export N8N_ENCRYPTION_KEY="n8n8n8n"
26
- # 允许使用所有内建模块
27
  export NODE_FUNCTION_ALLOW_BUILTIN=*
28
- # 允许使用外部 npm 模块
29
  export NODE_FUNCTION_ALLOW_EXTERNAL=*
30
  # Activate automatic data pruning
31
  export EXECUTIONS_DATA_PRUNE=true
@@ -42,15 +47,16 @@ export EXECUTIONS_DATA_SAVE_ON_PROGRESS=false
42
  # Don't save manually launched executions
43
  export EXECUTIONS_DATA_SAVE_MANUAL_EXECUTIONS=false
44
 
45
- # echo "检查 ${WEBDAV_URL}buildlog.txt 是否存在"
 
46
  # if curl -u "$WEBDAV_USER:$WEBDAV_PASSWORD" -f -o "$LOG_FILE" "${WEBDAV_URL}buildlog.txt"; then
47
- # echo "日志文件下载成功并写入部署时间: ${LOG_FILE}"
48
- # echo "hf部署时间: ${current_time}" >> "${LOG_FILE}"
49
  # else
50
- # echo "WebDAV 上日志文件不存在,创建新的日志文件: ${LOG_FILE}"
51
  # touch "${LOG_FILE}"
52
- # echo "hf部署时间: ${current_time}" >> "${LOG_FILE}"
53
  # fi
54
 
55
- # 使用绝对路径调用 n8n
56
- n8n > /dev/null 2>&1
 
1
  #!/bin/bash
2
 
3
+ # WebDAV URL
4
  WEBDAV_URL="$WEBDAV_URL"
5
+ # WebDAV username
6
  WEBDAV_USER="$WEBDAV_USER"
7
+ # WebDAV password
8
  WEBDAV_PASSWORD="$WEBDAV_PASSWORD"
9
 
10
+ # Get current time
11
  current_time=$(date +"%Y-%m-%d %H:%M:%S")
12
+ # Log file path
13
  # LOG_FILE="${WORKDIR}/buildlog.txt"
14
 
15
+ # Start PostgreSQL service
16
  /usr/local/bin/docker-entrypoint.sh postgres &
17
 
18
+ # Wait for PostgreSQL service to start
19
+ echo "Waiting for PostgreSQL service to start..."
20
  until pg_isready -h localhost; do
21
  sleep 3
22
  done
23
+ echo "PostgreSQL service started!"
24
 
25
+ # Run database import script
26
+ echo "Running database import script..."
27
  ${WORKDIR}/import-db.sh
28
 
29
+ # Set N8N environment variables
30
  export N8N_ENCRYPTION_KEY="n8n8n8n"
31
+ # Allow use of all built-in modules
32
  export NODE_FUNCTION_ALLOW_BUILTIN=*
33
+ # Allow use of external npm modules
34
  export NODE_FUNCTION_ALLOW_EXTERNAL=*
35
  # Activate automatic data pruning
36
  export EXECUTIONS_DATA_PRUNE=true
 
47
  # Don't save manually launched executions
48
  export EXECUTIONS_DATA_SAVE_MANUAL_EXECUTIONS=false
49
 
50
+ # Check if log file exists on WebDAV
51
+ # echo "Checking if ${WEBDAV_URL}buildlog.txt exists"
52
  # if curl -u "$WEBDAV_USER:$WEBDAV_PASSWORD" -f -o "$LOG_FILE" "${WEBDAV_URL}buildlog.txt"; then
53
+ # echo "Log file downloaded and written to deployment time: ${LOG_FILE}"
54
+ # echo "hf deployment time: ${current_time}" >> "${LOG_FILE}"
55
  # else
56
+ # echo "WebDAV log file does not exist, creating new log file: ${LOG_FILE}"
57
  # touch "${LOG_FILE}"
58
+ # echo "hf deployment time: ${current_time}" >> "${LOG_FILE}"
59
  # fi
60
 
61
+ # Run n8n with absolute path
62
+ n8n > /dev/null 2>&1