8
n8n 中文网amn8n.com

自动n8n更新器(Docker)

高级

这是一个AI领域的自动化工作流,包含 26 个节点。主要使用 If, Set, Ssh, Telegram, HttpRequest 等节点,结合人工智能技术实现智能自动化。 自动n8n更新器(Docker)

前置要求
  • Telegram Bot Token
  • 可能需要目标 API 的认证凭证
  • Google Gemini API Key
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "meta": {
    "instanceId": "e409ea34548a2afe2dffba31130cd1cf2e98ebe2afaeed2a63caf2a0582d1da0",
    "templateCredsSetupCompleted": true
  },
  "nodes": [
    {
      "id": "d8e5e551-4018-4e17-8a4e-ca946c8ae8f5",
      "name": "Docker 路径",
      "type": "n8n-nodes-base.set",
      "position": [
        300,
        -240
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "9027cc7c-e73f-4e9b-9cfc-537e038f735c",
              "name": "docker_path",
              "type": "string",
              "value": "./n8n-docker-caddy"
            },
            {
              "id": "8ddad746-f3c9-40fa-86f9-b62c5616317b",
              "name": "worker_command",
              "type": "string",
              "value": "--scale n8n-worker=4"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "7ae77004-c55b-4f72-8015-99d061b1d23a",
      "name": "更新 Docker",
      "type": "n8n-nodes-base.ssh",
      "position": [
        3380,
        -380
      ],
      "parameters": {
        "cwd": "={{ $('Docker Path').last().json.docker_path }}",
        "command": "=nohup sh -c \"docker compose pull && docker compose down && docker compose up -d {{ $json.worker_command }}\" > update.log 2>&1 &"
      },
      "credentials": {
        "sshPassword": {
          "id": "a8H4iJwMRDIdjKPi",
          "name": "SSH root N8N Hetzner"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "f76323fa-b464-498c-bb88-e8df8f49d9fc",
      "name": "获取 n8n 当前版本",
      "type": "n8n-nodes-base.ssh",
      "position": [
        600,
        -240
      ],
      "parameters": {
        "cwd": "={{ $('Docker Path').last().json.docker_path }}",
        "command": "=docker inspect $(docker ps -q --filter \"name=n8n\")"
      },
      "credentials": {
        "sshPassword": {
          "id": "a8H4iJwMRDIdjKPi",
          "name": "SSH root N8N Hetzner"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "ae4196a1-0eff-4628-8eeb-e12f0e78f14f",
      "name": "获取实例设置",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -200,
        -240
      ],
      "parameters": {
        "url": "={{ $env.WEBHOOK_URL }}rest/settings",
        "options": {}
      },
      "typeVersion": 4.2
    },
    {
      "id": "51b5d013-9027-4f98-a3d7-26d0e08a6968",
      "name": "是否为 Docker",
      "type": "n8n-nodes-base.if",
      "position": [
        20,
        -240
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "loose"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "4021cef9-daa5-448e-9df3-d38e2cafe2ed",
              "operator": {
                "type": "boolean",
                "operation": "true",
                "singleValue": true
              },
              "leftValue": "={{ $json.data.isDocker }}",
              "rightValue": ""
            }
          ]
        },
        "looseTypeValidation": true
      },
      "typeVersion": 2.2
    },
    {
      "id": "bb82d25b-9419-4887-ba38-710f0803b66a",
      "name": "获取版本的最后更新",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1040,
        -240
      ],
      "parameters": {
        "url": "=https://registry.hub.docker.com/v2/repositories/n8nio/n8n/tags/{{ $json.n8n_target_version }}",
        "options": {}
      },
      "typeVersion": 4.2
    },
    {
      "id": "390d5794-d41a-4544-b27b-c07028116e2f",
      "name": "目标版本",
      "type": "n8n-nodes-base.set",
      "position": [
        820,
        -240
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "3eb04423-6d04-4371-8dfe-a092996a9235",
              "name": "n8n_target_version",
              "type": "string",
              "value": "={{ $json.stdout.parseJson()[0].Config.Image.replaceAll(\"docker.n8n.io/n8nio/n8n:\", \"\").trim() }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "760cfb7e-9b50-4075-9bb2-b804650dc591",
      "name": "获取当前版本",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1260,
        -240
      ],
      "parameters": {
        "url": "=https://registry.hub.docker.com/v2/repositories/n8nio/n8n/tags/{{ $('Get Instance\\'s Settings').last().json.data.versionCli }}",
        "options": {}
      },
      "typeVersion": 4.2
    },
    {
      "id": "6694185e-3b73-436f-93fb-4595e0719c65",
      "name": "需要更新?",
      "type": "n8n-nodes-base.if",
      "position": [
        1480,
        -240
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "79ba3ace-f894-438f-a8da-0616419ffff7",
              "operator": {
                "type": "string",
                "operation": "notEquals"
              },
              "leftValue": "={{ $json.digest }}",
              "rightValue": "={{ $('Get Version\\'s Last Update').item.json.digest }}"
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "35e1a71d-048e-4b20-a618-f8172a386d2f",
      "name": "Google Gemini 聊天模型",
      "type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
      "position": [
        2440,
        -240
      ],
      "parameters": {
        "options": {
          "temperature": 0
        },
        "modelName": "models/gemma-3n-e4b-it"
      },
      "credentials": {
        "googlePalmApi": {
          "id": "946zxjAmpu4T9iRc",
          "name": "Auto-Credential-ff526bee-2ab1-400a-9934-c5808dab40af"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "a20184f7-031f-4170-a8a3-e33b458445e9",
      "name": "已批准?",
      "type": "n8n-nodes-base.if",
      "position": [
        2960,
        -340
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "7590024e-2f4d-491f-a6c1-aa906e7aa755",
              "operator": {
                "type": "boolean",
                "operation": "true",
                "singleValue": true
              },
              "leftValue": "={{ $json.data.approved }}",
              "rightValue": ""
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "076a776b-7423-4baf-89ea-05f7518a4999",
      "name": "便签",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1700,
        -920
      ],
      "parameters": {
        "color": 6,
        "width": 1460,
        "height": 840,
        "content": "## ⚠️ 手动批准部分"
      },
      "typeVersion": 1
    },
    {
      "id": "7bda6df1-dc3c-4e91-90e6-a35139214829",
      "name": "每小时",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        -420,
        -240
      ],
      "parameters": {
        "rule": {
          "interval": [
            {
              "field": "hours"
            }
          ]
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "998f0a3c-7982-4f52-9ff8-14af41efc0b8",
      "name": "在过去几小时内发布?",
      "type": "n8n-nodes-base.if",
      "position": [
        2080,
        -460
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "d91e9b77-800d-455f-9a10-109b9177a7d3",
              "operator": {
                "type": "dateTime",
                "operation": "after"
              },
              "leftValue": "={{ $json.published_at }}",
              "rightValue": "={{ $now.minus(1, 'hour') }}"
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "ab634afa-8c58-4245-bea3-27bf7fde7362",
      "name": "便签1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2660,
        -540
      ],
      "parameters": {
        "color": 3,
        "width": 260,
        "height": 380,
        "content": "### 💬 批准通知"
      },
      "typeVersion": 1
    },
    {
      "id": "4a627e14-42da-4df5-884b-3160f24da852",
      "name": "便签 2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2300,
        -700
      ],
      "parameters": {
        "color": 7,
        "width": 340,
        "height": 600,
        "content": "### 🤖 AI 发布摘要"
      },
      "typeVersion": 1
    },
    {
      "id": "a1e0423e-de37-4ede-a32f-4e7a3632d9c2",
      "name": "便签 3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1980,
        -760
      ],
      "parameters": {
        "color": 7,
        "width": 300,
        "height": 460,
        "content": "### 🕒 时间检查"
      },
      "typeVersion": 1
    },
    {
      "id": "9bc3cc2e-5153-4bfa-9886-2f95a58693c9",
      "name": "便签 4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1720,
        -640
      ],
      "parameters": {
        "color": 7,
        "height": 480,
        "content": "### 📝 获取发布说明"
      },
      "typeVersion": 1
    },
    {
      "id": "fe5322e0-af4a-4280-b548-e6e79f05abff",
      "name": "发布概览",
      "type": "@n8n/n8n-nodes-langchain.chainLlm",
      "position": [
        2340,
        -460
      ],
      "parameters": {
        "text": "=<role>\nYou are an expert technical writer and software release analyst specializing in the n8n automation platform. You have a deep understanding of the n8n user base, which ranges from non-technical business users to experienced developers. Your expertise lies in quickly parsing technical changelogs and identifying the changes that have the most significant impact on users.\n</rol>\n\n<instructions>\n<goal>\nYour goal is to analyze raw n8n release notes and extract a concise, human-readable summary of the most important changes. The summary should be easily digestible for n8n users and developers, highlighting only the key new features, critical fixes, and major enhancements.\n</goal>\n\n<context>\nThe n8n release notes are provided in a markdown-like format, typically generated from GitHub. They are structured with headings like `### Features`, `### Bug Fixes`, and `### Enhancements`.\n\nYour task is to prioritize the information based on its impact:\n1.  **Highest Priority:** New Features (especially new nodes or major core functionalities) and Breaking Changes.\n2.  **High Priority:** Significant Enhancements to existing popular nodes or core platform capabilities.\n3.  **Medium Priority:** Critical Bug Fixes, especially those related to security (XSS, authorization), data integrity, or core execution failures.\n4.  **Low Priority (to be ignored):** Minor bug fixes, documentation updates, internal refactoring, dependency updates, or changes to very niche nodes.\n\nYou must filter out the noise and focus only on what a user *needs* to know about the new version.\n</context>\n\n<examples>\n<example_1>\n<inputs>\n<release_notes>\n### [1.99.1](https://github.com/n8n-io/n8n/compare/n8n@1.99.0...n8n@1.99.1) (2025-06-19)\n\n\n### Bug Fixes\n\n* **core:** Fix pdf extract not working ([#16463](https://github.com/n8n-io/n8n/issues/16463)) ([0d69ea4](https://github.com/n8n-io/n8n/commit/0d69ea4f5bdd1216bd06ad5ae4e60eec6cc948b3))\n* **core:** Prevent unauthorised workflow termination ([#16405](https://github.com/n8n-io/n8n/issues/16405)) ([e5edc60](https://github.com/n8n-io/n8n/commit/e5edc60e344924230baafb11fa1f0af788e9ca9a))\n* **n8n Form Node:** Prevent XSS with video and source tags ([#16329](https://github.com/n8n-io/n8n/issues/16329)) ([7940384](https://github.com/n8n-io/n8n/commit/7940384a85041a1890b1203d69c092c887312500))\n</release_notes>\n</inputs>\n<output>\nThis release focuses on important security and stability fixes:\n- A critical security vulnerability (XSS) in the n8n Form Node has been patched.\n- An issue that could allow unauthorized workflow termination has been resolved.\n- The PDF extraction functionality in the core has been fixed.\n</output>\n</example_1>\n\n<example_2>\n<inputs>\n<release_notes>\n## [1.98.0](https://github.com/n8n-io/n8n/compare/n8n@1.97.2...n8n@1.98.0) (2025-06-12)\n\n\n### Features\n\n* **Airtable Trigger Node:** Add new trigger node ([#16201](https://github.com/n8n-io/n8n/issues/16201)) ([a1b2c3d](https://github.com/n8n-io/n8n/commit/a1b2c3d...))\n\n### Enhancements\n\n* **Google Sheets Node:** Add 'overwrite' option for writing data ([#16115](https://github.com/n8n-io/n8n/issues/16115)) ([e4f5g6h](https://github.com/n8n-io/n8n/commit/e4f5g6h...))\n\n### Bug Fixes\n\n* **UI:** Corrected typo in settings panel ([#16300](https://github.com/n8n-io/n8n/issues/16300)) ([i7j8k9l](https://github.com/n8n-io/n8n/commit/i7j8k9l...))\n</release_notes>\n</inputs>\n<output>\nKey highlights for this version:\n- **New Node:** A new Airtable Trigger node has been introduced, allowing workflows to start based on Airtable record changes.\n- **Google Sheets Node:** The node has been enhanced with a new 'overwrite' option when writing data to a sheet.\n</output>\n</example_2>\n\n<example_3>\n<inputs>\n<release_notes>\n## [1.97.3](https://github.com/n8n-io/n8n/compare/n8n@1.97.2...n8n@1.97.3) (2025-06-10)\n\n\n### Chores\n\n* **deps:** update dependency `some-package` to v2.5.1\n* **docs:** clarify wording in credentials page\n</release_notes>\n</inputs>\n<output>\nThis release contains minor maintenance and documentation updates.\n</output>\n</example_3>\n</examples>\n\n<output_format>\n- A short, unordered bulleted list (using `-`) or a brief paragraph.\n- Use clear, benefit-oriented language. (e.g., \"You can now...\" or \"Resolved an issue that caused...\").\n- Rephrase the technical commit messages into plain English.\n- Do not include the version number, date, GitHub issue numbers, or commit hashes in your output.\n- If there are no significant changes (e.g., only chores, docs, or minor dependency updates), you MUST output the exact phrase: `This release contains minor maintenance and documentation updates.`\n</output_format>\n</instructions>\n\n<inputs>\n<release_notes>\n{{ $json.body }}\n</release_notes>\n</inputs",
        "batching": {},
        "promptType": "define"
      },
      "typeVersion": 1.7
    },
    {
      "id": "66ea6a79-47f5-4f21-9eb9-8ac1176c3d73",
      "name": "批准更新",
      "type": "n8n-nodes-base.telegram",
      "position": [
        2740,
        -340
      ],
      "webhookId": "d7023716-c968-44bb-b888-d20a7c6d544a",
      "parameters": {
        "message": "=New n8n Version {{ $('Get n8n Github Release').item.json.name || \"\"}}\n\n{{ $('Release Overview').last().json.text }}",
        "options": {
          "limitWaitTime": {
            "values": {
              "resumeUnit": "days"
            }
          },
          "appendAttribution": true
        },
        "operation": "sendAndWait",
        "approvalOptions": {
          "values": {
            "approvalType": "double",
            "approveLabel": "✅ Update",
            "disapproveLabel": "❌ Ignore"
          }
        }
      },
      "credentials": {
        "telegramApi": {
          "id": "gSws2Z84sGJFBxoz",
          "name": "n8n_ai_workflow_bot"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "64444209-7876-4ec7-b8c1-b7fba75468ae",
      "name": "便签 5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        200,
        -520
      ],
      "parameters": {
        "color": 5,
        "width": 300,
        "height": 440,
        "content": "### ⚙️ 在此配置您的服务器路径"
      },
      "typeVersion": 1
    },
    {
      "id": "a2a8d86a-85cd-4911-86a2-265260529093",
      "name": "便签6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        520,
        -400
      ],
      "parameters": {
        "color": 3,
        "width": 260,
        "height": 320,
        "content": "### 🔒 SSH 连接"
      },
      "typeVersion": 1
    },
    {
      "id": "fcc4251e-9f4d-48c0-82fd-7e7adad0158b",
      "name": "便签7",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        980,
        -420
      ],
      "parameters": {
        "color": 7,
        "width": 660,
        "height": 340,
        "content": "### 💡 更新检测工作原理"
      },
      "typeVersion": 1
    },
    {
      "id": "ef12ba27-3b50-47a2-8a2a-6feaef6e8be7",
      "name": "获取 n8n Github 发布",
      "type": "n8n-nodes-base.httpRequest",
      "onError": "continueErrorOutput",
      "position": [
        1780,
        -340
      ],
      "parameters": {
        "url": "=https://api.github.com/repos/n8n-io/n8n/releases/{{ $('Target Version').last().json.n8n_target_version }}",
        "options": {}
      },
      "typeVersion": 4.2
    },
    {
      "id": "bb657976-70ce-496e-8620-eed07d2cb1c9",
      "name": "便签8",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -280,
        -480
      ],
      "parameters": {
        "color": 7,
        "width": 260,
        "height": 400,
        "content": "### 🔎 获取实例信息"
      },
      "typeVersion": 1
    },
    {
      "id": "c89f3f43-7af1-4778-811b-e545743f1cbd",
      "name": "### 替换 Airtable 连接",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        3180,
        -820
      ],
      "parameters": {
        "color": 4,
        "width": 520,
        "height": 620,
        "content": "### 🚀 最后一步:执行更新"
      },
      "typeVersion": 1
    }
  ],
  "pinData": {},
  "connections": {
    "Is Docker": {
      "main": [
        [
          {
            "node": "Docker Path",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Approved ?": {
      "main": [
        [
          {
            "node": "Update Docker",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Every Hour": {
      "main": [
        [
          {
            "node": "Get Instance's Settings",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Docker Path": {
      "main": [
        [
          {
            "node": "Get n8n Current Version",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Update Docker": {
      "main": [
        []
      ]
    },
    "Approve Update": {
      "main": [
        [
          {
            "node": "Approved ?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Needs Update ?": {
      "main": [
        [
          {
            "node": "Get n8n Github Release",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Target Version": {
      "main": [
        [
          {
            "node": "Get Version's Last Update",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Release Overview": {
      "main": [
        [
          {
            "node": "Approve Update",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Current Version": {
      "main": [
        [
          {
            "node": "Needs Update ?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get n8n Github Release": {
      "main": [
        [
          {
            "node": "Published In Last Hours ?",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Approve Update",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Instance's Settings": {
      "main": [
        [
          {
            "node": "Is Docker",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get n8n Current Version": {
      "main": [
        [
          {
            "node": "Target Version",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Google Gemini Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "Release Overview",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Get Version's Last Update": {
      "main": [
        [
          {
            "node": "Get Current Version",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Published In Last Hours ?": {
      "main": [
        [
          {
            "node": "Release Overview",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

复制上方的 JSON 配置代码,在您的 n8n 实例中创建新工作流并选择「从 JSON 导入」,粘贴配置后根据需要修改凭证设置即可。

这个工作流适合什么场景?

高级 - 人工智能

需要付费吗?

本工作流完全免费,您可以直接导入使用。但请注意,工作流中使用的第三方服务(如 OpenAI API)可能需要您自行付费。

工作流信息
难度等级
高级
节点数量26
分类1
节点类型9
难度说明

适合高级用户,包含 16+ 个节点的复杂工作流

作者
Lucas Peyrin

Lucas Peyrin

@lucaspeyrin

Innovative builder with a passion for crafting automation solutions that solve real-world challenges. From streamlining workflows to driving efficiency, my work empowers teams and individuals to achieve more with less effort. Experienced in developing scalable tools and strategies that deliver results with n8n, supabase and cline.

外部链接
在 n8n.io 查看

分享此工作流