File size: 1,271 Bytes
e4fbb50
d57197c
e4fbb50
 
 
 
d57197c
 
 
 
 
 
 
 
 
 
 
e4fbb50
d57197c
e4fbb50
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
d57197c
 
 
e4fbb50
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#!/bin/bash
set -e

current_time=$(date +"%Y-%m-%d %H:%M:%S")
echo "Starting n8n at $current_time"

# 等待 PostgreSQL 就绪
wait_for_postgres() {
    echo "Waiting for PostgreSQL to start..."
    while ! nc -z ${DB_POSTGRESDB_HOST} ${DB_POSTGRESDB_PORT}; do
        sleep 1
    done
    echo "PostgreSQL started"
}

wait_for_postgres

# 设置 N8N 环境变量
export N8N_ENCRYPTION_KEY="${N8N_ENCRYPTION_KEY:-n8n8n8n}"
# 允许使用所有内建模块
export NODE_FUNCTION_ALLOW_BUILTIN=*
# 允许使用外部 npm 模块
export NODE_FUNCTION_ALLOW_EXTERNAL=*
# Activate automatic data pruning
export EXECUTIONS_DATA_PRUNE=true
# Number of hours after execution that n8n deletes data
export EXECUTIONS_DATA_MAX_AGE=36
# Number of executions to store
export EXECUTIONS_DATA_PRUNE_MAX_COUNT=1000
# Save executions ending in errors
export EXECUTIONS_DATA_SAVE_ON_ERROR=all
# Save successful executions
export EXECUTIONS_DATA_SAVE_ON_SUCCESS=all
# Don't save node progress for each execution
export EXECUTIONS_DATA_SAVE_ON_PROGRESS=false
# Don't save manually launched executions
export EXECUTIONS_DATA_SAVE_MANUAL_EXECUTIONS=false

# 设置文件权限
export N8N_ENFORCE_SETTINGS_FILE_PERMISSIONS=true

# 使用绝对路径调用 n8n,添加日志输出
exec n8n start