8
n8n 中文网amn8n.com

自托管应用自动更新(Coolify 部署)

高级

这是一个DevOps, Multimodal AI领域的自动化工作流,包含 18 个节点。主要使用 If, Set, Merge, HttpRequest, ManualTrigger 等节点。 使用 Coolify 部署实现自托管应用自动更新

前置要求
  • 可能需要目标 API 的认证凭证
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "meta": {
    "instanceId": "96b96d0aa1e4ff5d5b6779332b149e3ef3364191562d79083d0309cf3ddfa53e"
  },
  "nodes": [
    {
      "id": "74922542-1a88-41fd-83ca-9ff2b1599b50",
      "name": "置顶 • 概述",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -272,
        16
      ],
      "parameters": {
        "color": 3,
        "width": 520,
        "height": 872,
        "content": "## 概述"
      },
      "typeVersion": 1
    },
    {
      "id": "34b0fe1d-6b44-4847-a4fe-16a23730cdd0",
      "name": "置顶 • 手动触发器",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        256,
        304
      ],
      "parameters": {
        "color": "blue",
        "width": 384,
        "height": 220,
        "content": "## 手动触发器"
      },
      "typeVersion": 1
    },
    {
      "id": "c2f1cd58-bf94-4be0-a938-5b758c966798",
      "name": "置顶 • 计划",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        256,
        16
      ],
      "parameters": {
        "color": "blue",
        "width": 376,
        "height": 272,
        "content": "## 计划触发器"
      },
      "typeVersion": 1
    },
    {
      "id": "00114438-dacd-43a4-b344-ea20ec8fab78",
      "name": "置顶 • N8N 设置",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        656,
        0
      ],
      "parameters": {
        "color": 5,
        "width": 468,
        "height": 344,
        "content": "## N8N 设置(HTTP 请求)"
      },
      "typeVersion": 1
    },
    {
      "id": "165a79fe-1a72-4308-9595-8b253ac213f5",
      "name": "置顶 • GitHub 最新",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        608,
        560
      ],
      "parameters": {
        "color": 5,
        "width": 516,
        "height": 324,
        "content": "## GitHub 最新(HTTP 请求)"
      },
      "typeVersion": 1
    },
    {
      "id": "29a1e319-7c3f-4442-8563-9ae0dc6dd2f3",
      "name": "置顶 • 合并 SQL",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1136,
        32
      ],
      "parameters": {
        "color": "orange",
        "width": 328,
        "height": 528,
        "content": "## 合并(SQL)"
      },
      "typeVersion": 1
    },
    {
      "id": "80a0247d-df92-416a-8737-2d7319af0cef",
      "name": "置顶 • 设置",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1520,
        144
      ],
      "parameters": {
        "color": "orange",
        "width": 356,
        "height": 420,
        "content": "## 设置(标准化)"
      },
      "typeVersion": 1
    },
    {
      "id": "7f5d83a6-5510-414f-9ccb-c3e31bd4b748",
      "name": "置顶 • IF",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1888,
        144
      ],
      "parameters": {
        "color": "red",
        "width": 420,
        "height": 420,
        "content": "## IF(比较)"
      },
      "typeVersion": 1
    },
    {
      "id": "86697e08-a3a2-49ee-af28-8540e7f9983e",
      "name": "置顶 • 部署",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2384,
        112
      ],
      "parameters": {
        "color": "purple",
        "width": 460,
        "height": 348,
        "content": "## 部署(HTTP 请求)"
      },
      "typeVersion": 1
    },
    {
      "id": "f8ae7d2b-4458-4686-b7e5-7737c5d7b95a",
      "name": "每当您想要开始更新检查时进行计划",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        496,
        160
      ],
      "parameters": {
        "rule": {
          "interval": [
            {}
          ]
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "cb7eadb0-7fa3-479c-9fd4-4ef804844999",
      "name": "无操作,不执行任何操作",
      "type": "n8n-nodes-base.noOp",
      "position": [
        2448,
        496
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "3217fe2c-eae5-4499-9008-33d4cd7b0f09",
      "name": "如果两个版本不同,则更新镜像",
      "type": "n8n-nodes-base.if",
      "position": [
        2064,
        368
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "c8ee8d9d-1227-4738-a315-478475601721",
              "operator": {
                "type": "string",
                "operation": "notEquals"
              },
              "leftValue": "={{ $json.actualn8nversion }}",
              "rightValue": "={{ $json.newn8nversion }}"
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "81a3cf57-6269-4237-8671-0a1e5f46c15d",
      "name": "调用 COOLIFY 或类似服务以更新镜像",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        2448,
        288
      ],
      "parameters": {
        "url": "https://app.coolify.io/api/v1/services/your-services-uuid/restart?latest=true",
        "options": {},
        "authentication": "genericCredentialType",
        "genericAuthType": "httpBearerAuth"
      },
      "credentials": {
        "httpBearerAuth": {
          "id": "M2C49Bi5D2s9DGwo",
          "name": "Coolify n8n autom aifb token"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "3675b8ea-b9d3-4383-9422-d4335f7bc5f4",
      "name": "重命名变量并统一格式",
      "type": "n8n-nodes-base.set",
      "position": [
        1680,
        368
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "a7787c92-705f-445f-8eee-a36c3555203c",
              "name": "actualn8nversion",
              "type": "string",
              "value": "={{ $json.versionCli }}"
            },
            {
              "id": "7e6dc6fa-44be-4e52-bf5c-1ebf4262f18a",
              "name": "newn8nversion",
              "type": "string",
              "value": "={{ $json.name.split(\"@\")[1] }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "16bd29a3-b38a-42ec-97e7-533e145eae65",
      "name": "合并机器人数据并仅传递我们需要的内容",
      "type": "n8n-nodes-base.merge",
      "position": [
        1200,
        368
      ],
      "parameters": {
        "mode": "combineBySql",
        "query": "SELECT\n  input1.data->versionCli AS versionCli,\n  input2.name AS name\nFROM input1\nLEFT JOIN input2 ON 1=1;",
        "options": {
          "emptyQueryResult": "success"
        }
      },
      "typeVersion": 3.2
    },
    {
      "id": "50112ebc-7fda-4cb9-94a1-4d7cd924e657",
      "name": "当点击“执行工作流”时",
      "type": "n8n-nodes-base.manualTrigger",
      "position": [
        496,
        384
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "6d60b6eb-9827-4d46-b4ee-27aedefc7801",
      "name": "调用您的 N8N 实例并检索版本",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        976,
        176
      ],
      "parameters": {
        "url": "https://yourn8ndomain/rest/settings",
        "options": {}
      },
      "typeVersion": 4.2
    },
    {
      "id": "59b20003-8247-43e1-aa68-7435055aa6e9",
      "name": "调用 GITHUB 并检索最新的 n8n 镜像稳定版本",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        960,
        704
      ],
      "parameters": {
        "url": "https://api.github.com/repos/n8n-io/n8n/releases/latest",
        "options": {}
      },
      "typeVersion": 4.2
    }
  ],
  "pinData": {},
  "connections": {
    "Rename variable and unify format": {
      "main": [
        [
          {
            "node": "If the 2 versions is not the same make an update of image",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "When clicking ‘Execute workflow": {
      "main": [
        [
          {
            "node": "CALL GITHUB and retrieve the last n8n image stable version",
            "type": "main",
            "index": 0
          },
          {
            "node": "CALL YOUR N8N INSTANCE and retrieve the version",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Merge bot data and pass just what we need": {
      "main": [
        [
          {
            "node": "Rename variable and unify format",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "CALL YOUR N8N INSTANCE and retrieve the version": {
      "main": [
        [
          {
            "node": "Merge bot data and pass just what we need",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Schedule every time you want start the update check": {
      "main": [
        [
          {
            "node": "CALL YOUR N8N INSTANCE and retrieve the version",
            "type": "main",
            "index": 0
          },
          {
            "node": "CALL GITHUB and retrieve the last n8n image stable version",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "If the 2 versions is not the same make an update of image": {
      "main": [
        [
          {
            "node": "CALL COOLIFY OR SIMILAR SERVICE FOR UPDATE IMAGE",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "No Operation, do nothing",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "CALL GITHUB and retrieve the last n8n image stable version": {
      "main": [
        [
          {
            "node": "Merge bot data and pass just what we need",
            "type": "main",
            "index": 1
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

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

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

高级 - 开发运维, 多模态 AI

需要付费吗?

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

工作流信息
难度等级
高级
节点数量18
分类2
节点类型8
难度说明

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

作者
Edoardo Guzzi

Edoardo Guzzi

@mredodos

Automation expert with 10+ years in programming, AI, Chrome extensions, and mobile apps. Specializing in PHP, JS, and Python, I design custom n8n workflows to streamline processes and boost productivity. Explore my templates or contact me for tailored solutions.

外部链接
在 n8n.io 查看

分享此工作流