Raspberry Pi 5 × n8n:プレスリリース自動収集・AI解析システムの全貌/Raspberry Pi 5 × n8n: Building an Automated Railway Press Release AI-Analysis System

Raspberry Pi 5 × n8n:プレスリリース自動収集・AI解析システムの全貌

日々更新される101社もの鉄道会社のプレスリリース。新車導入やダイヤ改正など、鉄道ファンにとって見逃せない情報を、すべて手動で追うのは至難の業です。

そこで今回、省電力かつパワフルな Raspberry Pi 5 (8GB) をサーバーとして構築し、n8nによる自動収集・AI解析パイプラインを実装しました。本記事では、このシステムの全容と、それを支える「サーバー管理の3種の神器」について解説します。

1. システム構成:サーバー管理の「3種の神器」

安定した自動化運用には、OSからコンテナまでを監視・制御する環境が不可欠です。私の環境では、以下の3つのツールを組み合わせています。

  • SSH (Secure Shell): サーバー構築の基本。CLIによる緻密な設定変更やログ確認に不可欠です。
  • Cockpit: ブラウザ上で動作するOS管理GUICPU・メモリ負荷、ネットワーク状況などを可視化し、システム全体の健康状態を一目で把握できます。
  • Portainer: Docker管理の決定版。今回メインで稼働している「n8n」のようなコンテナ群を、Web GUIから直感的に操作・更新可能です。

2. 鉄道リリース自動収集・AI解析フロー

このシステムは、以下のステップで情報を「自分専用の日報」へと昇華させます。

  1. 自動巡回(クローリング): 定期的に鉄道各社のプレスリリースサイトを自動巡回。
  2. 情報抽出: Webサイト構造の変化にも対応したリストを管理し、今日更新された情報のみを抽出。
  3. PDF/Web解析: リンク先がWebページかPDFファイルかを問わず、内容をスクレイピング。
  4. Slack通知: 生成された日報(.docx形式)をSlackへ自動アップロード。手動でAIと協業でファクトチェックを行える環境を整えました。

3. なぜ「Raspberry Pi 5」なのか

このシステムは、家庭内の省電力な環境で完結しています。ラズパイ5の持つ高い処理能力と、Ubuntu Server 24.04 LTSの安定性が、n8nによる複雑な処理を支えています。

単なる「自動化」ではなく、「いかにメンテしやすくするか」という運用体制まで含めて設計したことで、非常に信頼性の高い情報収集基盤となりました。

まとめ:セルフホスティングの可能性

Raspberry Pi 5一台と、SSH/Cockpit/Portainerの組み合わせがあれば、ここまで高度な情報収集・解析システムを自宅で構築できます。

今後は、過去データとの差分検知や、特定の車両形式に絞った通知など、さらに機能拡張を進める予定です。セルフホスティングで自分だけの情報網を構築する楽しさを、ぜひ体験してみてください。

ちなみにn8nAPIを活用してAIに要約してそのままブログ記事に投稿することも可能だが、明らかなハルシネーション(嘘)書かれることが普通に出てくるうえ、回数を超えると従量課金なので無料プランだともうできなくなったり費用が余計にかかったりするからSlackに通知だけでとどめている。

本記事のシステムは個人的な情報収集を目的としています。運用にあたっては、各社のWebサイト利用規約やrobots.txtを尊重しましょう。

 

Raspberry Pi 5 × n8n: Building an Automated Press Release AI-Analysis System

Monitoring press releases from over 101 railway companies—covering everything from new rolling stock introductions to major timetable revisions—is a daunting task for any enthusiast. Tracking these manually is simply impractical.

To solve this, I built an automated collection and AI-analysis pipeline using a power-efficient yet powerful Raspberry Pi 5 (8GB) as a home server. In this article, I will explain the full architecture of this system and the "Three Pillars of Server Management" that keep it running smoothly.

1. System Architecture: The "Three Pillars" of Server Management

Stable automation requires a robust environment to monitor and control everything from the OS to individual containers. My setup relies on these three essential tools:

  • SSH (Secure Shell): The foundation of server building. Essential for precise configuration changes and log analysis via CLI.
  • Cockpit: A web-based GUI for OS management. It provides a dashboard to visualize CPU, memory, and network loads, allowing me to check system health at a glance.
  • Portainer: The gold standard for Docker management. It allows me to manage, update, and monitor containerized services like n8n directly through an intuitive Web GUI.

2. The Railway Intelligence Pipeline

This system transforms raw data into a personalized "Daily Briefing" through the following workflow:

  1. Automated Crawling: Periodically traverses the press release sites of railway operators across all of Japan’s prefectures—from major hubs in Tokyo and Osaka to regional lines in Hokkaido, Kyushu, and beyond.
  2. Information Extraction: Manages site structures to isolate only the content updated within the last 24 hours.
  3. PDF/Web Analysis: Seamlessly scrapes content, whether the source is a standard web page or a complex PDF document.
  4. Slack Integration: Automatically uploads a generated summary (.docx) to Slack. This allows me to perform human-in-the-loop fact-checking before final consumption.

3. Why the "Raspberry Pi 5"?

This system runs entirely within a low-power home environment. The processing power of the Pi 5, combined with the rock-solid stability of Ubuntu Server 24.04 LTS, perfectly handles the complex workflows orchestrated by n8n.

Rather than focusing solely on "automation," I designed this system with "ease of maintenance" in mind, resulting in a highly reliable intelligence-gathering platform.

Conclusion: The Power of Self-Hosting

With just a Raspberry Pi 5 and the combination of SSH, Cockpit, and Portainer, you can build a sophisticated intelligence-gathering system right in your own home.

Note: While n8n can technically be used to push AI-summarized content directly to a blog via API, I have opted to keep the output limited to Slack notifications. AI models can frequently produce "hallucinations" (inaccurate info), and API-based automated posting can quickly exceed free-tier quotas, leading to unexpected costs.

Moving forward, I plan to expand the system to include differential analysis of historical data and targeted notifications based on specific train models or geographic regions. I encourage everyone to experience the thrill of building your own information network through self-hosting!

Disclaimer: This system is designed for personal information gathering. When deploying such tools, please ensure you respect the terms of service of each website and strictly adhere to their robots.txt directives.

 


コメント

このブログの人気の投稿

東日本旅客鉄道E8系新幹線、相次ぐ補助電源装置故障の深層 — 製造メーカー三菱電機の関与と今後の展望/East Japan Railway E8 Shinkansen, the depths of a series of auxiliary power supply failures — Involvement of manufacturer Mitsubishi Electric and future prospects

令和の発車メロディーについての公式発表/JR East Official announcement about the departure melody of Reiwa

JR東日本E501系がJR九州へ譲渡する事に対する問題点について/Issues Concerning the Transfer of JR East E501 Series Trains to JR Kyushu