n8nの自動更新
中級
これはDevOps分野の自動化ワークフローで、12個のノードを含みます。主にIf, Code, HttpRequest, ScheduleTriggerなどのノードを使用。 バージョン確認とPortainer Webhookを使ってn8nのアップデートを自動化
前提条件
- •ターゲットAPIの認証情報が必要な場合あり
カテゴリー
ワークフロープレビュー
ノード接続関係を可視化、ズームとパンをサポート
ワークフローをエクスポート
以下のJSON設定をn8nにインポートして、このワークフローを使用できます
{
"id": "5TGOTlmPdfRCmmfe",
"meta": {
"instanceId": "dcb1c5ac6ea74a8d48a18ebc0df6103a2b23cb36997704a343a62b1831c8eccd"
},
"name": "n8n-autoupdate",
"tags": [],
"nodes": [
{
"id": "f1b6e1f4-1de3-4334-8a6a-72917d5612e3",
"name": "Portainer Webhook",
"type": "n8n-nodes-base.httpRequest",
"position": [
1184,
80
],
"parameters": {
"url": "https://portainer.tld.com/api/stacks/webhooks/606e8503-8824-43b1-a67c-cf95abbee1a8",
"method": "POST",
"options": {
"response": {
"response": {}
},
"allowUnauthorizedCerts": false
}
},
"typeVersion": 4.2
},
{
"id": "8cde31ed-6b9c-4451-8ce7-95b846d7e356",
"name": "スケジュールトリガー",
"type": "n8n-nodes-base.scheduleTrigger",
"position": [
-80,
80
],
"parameters": {
"rule": {
"interval": [
{
"field": "hours",
"hoursInterval": 16,
"triggerAtMinute": 8
}
]
}
},
"typeVersion": 1.2
},
{
"id": "8756bed1-42d0-4f5f-904c-2d5294002f74",
"name": "最新のn8nバージョンを取得",
"type": "n8n-nodes-base.httpRequest",
"position": [
144,
80
],
"parameters": {
"url": "https://registry.npmjs.org/n8n/latest",
"options": {
"fullResponse": false
}
},
"typeVersion": 2
},
{
"id": "938334e9-c0b1-476e-a816-4269946d7a41",
"name": "条件分岐",
"type": "n8n-nodes-base.if",
"position": [
864,
80
],
"parameters": {
"options": {},
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "a2d169a3-7aa2-46f5-bdb2-f0d53a011b5c",
"operator": {
"type": "string",
"operation": "notEquals"
},
"leftValue": "={{ $('Get the latest n8n version').item.json.version }}",
"rightValue": "={{ $json.versionCli }}"
}
]
}
},
"typeVersion": 2.2,
"alwaysOutputData": false
},
{
"id": "4802535d-c004-442a-bbd1-610d540e924d",
"name": "ローカルのn8nバージョン",
"type": "n8n-nodes-base.code",
"position": [
640,
80
],
"parameters": {
"jsCode": "const text = $input.first().json.data;\nconst match = text.match(/n8n_version_info\\{[^}]*version=\"(v[\\d.]+)\"/);\n\nif (match) {\n const version = match[1].replace(/^v/, ''); // v entfernen\n return [{ json: { versionCli: version } }];\n} else {\n throw new Error(\"Version info not found in metrics output\");\n}\n"
},
"typeVersion": 2
},
{
"id": "cee62d71-075b-4bf0-a800-b4fa2fee9ebe",
"name": "付箋",
"type": "n8n-nodes-base.stickyNote",
"position": [
-112,
-16
],
"parameters": {
"width": 160,
"height": 272,
"content": "## Cron\nEvery 16 Hours at minute 8"
},
"typeVersion": 1
},
{
"id": "94d2e06e-daf3-4260-929c-584144fbe486",
"name": "付箋1",
"type": "n8n-nodes-base.stickyNote",
"position": [
80,
-16
],
"parameters": {
"width": 208,
"height": 272,
"content": "## Latest Version\nFetch from npmjs"
},
"typeVersion": 1
},
{
"id": "e1a8d5f8-d672-4475-9ea0-e2eda0028702",
"name": "付箋2",
"type": "n8n-nodes-base.stickyNote",
"position": [
320,
-16
],
"parameters": {
"width": 224,
"height": 272,
"content": "## Get Metrics\nFetch from local install"
},
"typeVersion": 1
},
{
"id": "47c26e66-ba89-4903-a948-22b1162bf1e5",
"name": "ローカルのn8nメトリクスを取得",
"type": "n8n-nodes-base.httpRequest",
"position": [
368,
80
],
"parameters": {
"url": "https://127.0.0.1/metrics",
"options": {
"allowUnauthorizedCerts": true
}
},
"typeVersion": 4.2
},
{
"id": "4bf82532-cc70-4071-83f6-3550392b1590",
"name": "付箋3",
"type": "n8n-nodes-base.stickyNote",
"position": [
576,
-16
],
"parameters": {
"width": 224,
"height": 272,
"content": "## Installed Version\nExtract from metrics"
},
"typeVersion": 1
},
{
"id": "b11bd405-761f-4328-af3e-0a79c985f654",
"name": "付箋4",
"type": "n8n-nodes-base.stickyNote",
"position": [
832,
-16
],
"parameters": {
"width": 256,
"height": 272,
"content": "## If Update available\nProceed with the workflow"
},
"typeVersion": 1
},
{
"id": "559a1933-1bc6-4fc4-bcb2-2ef76364dc0e",
"name": "付箋5",
"type": "n8n-nodes-base.stickyNote",
"position": [
1120,
-16
],
"parameters": {
"width": 256,
"height": 272,
"content": "## Start Update\nUsing webhook, but SSH might be useful aswell"
},
"typeVersion": 1
}
],
"active": false,
"pinData": {},
"settings": {
"executionOrder": "v1"
},
"versionId": "1f5d34fd-158e-44a5-8438-f235f4265d00",
"connections": {
"938334e9-c0b1-476e-a816-4269946d7a41": {
"main": [
[
{
"node": "f1b6e1f4-1de3-4334-8a6a-72917d5612e3",
"type": "main",
"index": 0
}
]
]
},
"8cde31ed-6b9c-4451-8ce7-95b846d7e356": {
"main": [
[
{
"node": "8756bed1-42d0-4f5f-904c-2d5294002f74",
"type": "main",
"index": 0
}
]
]
},
"4802535d-c004-442a-bbd1-610d540e924d": {
"main": [
[
{
"node": "938334e9-c0b1-476e-a816-4269946d7a41",
"type": "main",
"index": 0
}
]
]
},
"47c26e66-ba89-4903-a948-22b1162bf1e5": {
"main": [
[
{
"node": "4802535d-c004-442a-bbd1-610d540e924d",
"type": "main",
"index": 0
}
]
]
},
"8756bed1-42d0-4f5f-904c-2d5294002f74": {
"main": [
[
{
"node": "47c26e66-ba89-4903-a948-22b1162bf1e5",
"type": "main",
"index": 0
}
]
]
}
}
}よくある質問
このワークフローの使い方は?
上記のJSON設定コードをコピーし、n8nインスタンスで新しいワークフローを作成して「JSONからインポート」を選択、設定を貼り付けて認証情報を必要に応じて変更してください。
このワークフローはどんな場面に適していますか?
中級 - DevOps
有料ですか?
このワークフローは完全無料です。ただし、ワークフローで使用するサードパーティサービス(OpenAI APIなど)は別途料金が発生する場合があります。
関連ワークフロー
UniFi コントローラー: リリース時にチェックし、アップグレードを実行
SSHとTelegram通知を利用したUniFiコントローラー更新の自動化
If
Ssh
Code
+
If
Ssh
Code
11 ノードDominic Spatz
DevOps
API稼働時間監視の自動化と即時ダウンalert
API稼働時間監視、WhatsAppアラート付き、Googleスheets管理
If
Code
Wait
+
If
Code
Wait
17 ノードOneclick AI Squad
DevOps
自動化されたウェブサイトの稼働時間監視とメールアラート、GitHubステータスページの更新
自動ウェブサイトアップタイム監視とメールアラートおよびGitHubステータスページ更新
If
Code
Gmail
+
If
Code
Gmail
19 ノードLinearloop Team
DevOps
GitHub への自動化 n8n ワークフロー バックアップおよび削除の追跡
n8n のワーキングフローを GitHub へ自動バックアップし、削除を追跡
If
N8n
Set
+
If
N8n
Set
31 ノードMarcial Ambriz
DevOps
n8nバックアップマスターv3
GitHubへのワークフロー自動バックアップ、メール/telegram通知対応
If
Code
Gmail
+
If
Code
Gmail
21 ノードBuilds.Cool
DevOps
Typebot ワークフローと GitHub を相互同期、Typebot API を使用
TypebotフローとGitHubを双方向に同期し、Typebot APIを使用
If
Set
Code
+
If
Set
Code
31 ノードMarcial Ambriz
DevOps