n8n-db / run.sh
fuliai's picture
Update run.sh
5e2e20b verified
raw
history blame
768 Bytes
#!/bin/bash
# 确保以 postgres 用户身份运行
if [ "$(id -u)" -ne 1000 ]; then
echo "切换到 UID 为 1000 的 postgres 用户运行"
exec gosu postgres "$0" "$@"
fi
# 启动 PostgreSQL 服务
docker-entrypoint.sh postgres &
# 检查 PostgreSQL 服务是否已启动
echo "等待 PostgreSQL 服务启动..."
until pg_isready -h localhost; do
sleep 3
done
echo "PostgreSQL 服务已启动!"
# 执行数据库导入脚本
echo "运行数据库导入脚本..."
/app/import-db.sh
sleep 3
# export N8N_USER_FOLDER=${DATA_DIR}
export N8N_ENCRYPTION_KEY="n8n8n8n"
# Allows usage of all builtin modules
export NODE_FUNCTION_ALLOW_BUILTIN=*
# Allow usage of external npm modules.
export NODE_FUNCTION_ALLOW_EXTERNAL=*
# 使用绝对路径调用 n8n
exec n8n