Repository navigation
Expand file tree
/
Copy pathsetup.html
More file actions
186 lines (163 loc) · 10.4 KB
/
Copy pathsetup.html
File metadata and controls
186 lines (163 loc) · 10.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
<!DOCTYPE html>
<html lang="ja">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>セットアップ — Pipeline Docs</title>
<meta name="description" content="Pipeline のインストール、起動、最初のワークロード追加、ワーカー追加、systemd 常駐化までの手順。" />
<link rel="icon" type="image/x-icon" href="assets/favicon.ico" />
<link rel="icon" type="image/png" sizes="32x32" href="assets/icon-32.png" />
<link rel="stylesheet" href="assets/site.css" />
<link rel="stylesheet" href="assets/docs.css" />
<script>try{var t=localStorage.getItem('pipeline-docs-theme');if(t)document.documentElement.setAttribute('data-theme',t);}catch(e){}</script>
</head>
<body class="docs" data-page="setup">
<header class="docs-header">
<button class="icon-btn hamburger" aria-label="メニュー切替">
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"><path d="M3 6h18M3 12h18M3 18h18"/></svg>
</button>
<a class="brand" href="./"><img src="assets/icon-64.png" alt="" /><span class="brand-text">Pipeline</span><span class="brand-tag">Docs</span></a>
<div class="spacer"></div>
<div class="docs-search"><input type="text" id="docs-search-input" placeholder="ドキュメントを絞り込み ( / )" autocomplete="off" aria-label="検索" /></div>
<a class="hlink labelled" href="https://github.com/paps-jp/pipeline" target="_blank" rel="noopener" aria-label="GitHub">
<svg width="18" height="18" viewBox="0 0 16 16" fill="currentColor"><path d="M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.76-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.01 8.01 0 0 0 16 8c0-4.42-3.58-8-8-8z"/></svg>
<span>GitHub</span>
</a>
<button class="icon-btn theme-toggle" aria-label="テーマ切替">
<svg class="sun" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"><circle cx="12" cy="12" r="4"/><path d="M12 2v2M12 20v2M4.9 4.9l1.4 1.4M17.7 17.7l1.4 1.4M2 12h2M20 12h2M4.9 19.1l1.4-1.4M17.7 6.3l1.4-1.4"/></svg>
<svg class="moon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"><path d="M21 12.8A9 9 0 1 1 11.2 3a7 7 0 0 0 9.8 9.8z"/></svg>
</button>
</header>
<div class="sb-backdrop"></div>
<div class="docs-layout">
<aside class="docs-sidebar" id="docs-sidebar"></aside>
<main class="docs-main">
<article class="docs-article">
<div class="docs-breadcrumb"><a href="manual.html">Docs</a> / はじめに / セットアップ</div>
<h1>セットアップ</h1>
<p class="lead">制御プレーン1ホスト + ワーカー1ホスト以上、という構成を想定しています。小規模であれば同一ホストで両方動かしても構いません。</p>
<h2>必要要件</h2>
<table>
<tr><th>項目</th><th>バージョン</th><th>備考</th></tr>
<tr><td>Python</td><td>3.12以上</td><td>制御プレーン / ワーカー共通</td></tr>
<tr><td>Node.js</td><td>18以上</td><td>Web UI ビルド時のみ (配布済 build を使うなら不要)</td></tr>
<tr><td>OS</td><td>Linux 推奨</td><td>制御プレーン用。Mac / WSL でも開発できます。</td></tr>
<tr><td>SQLite</td><td>3.35以上</td><td>ALTER TABLE DROP COLUMN を使うため</td></tr>
<tr><td>GPUホスト</td><td>任意</td><td>NVIDIA GPU + ドライバ + nvidia-smi (GPU メトリクスを取る場合)</td></tr>
</table>
<h2>インストール (制御プレーン)</h2>
<pre><code>git clone https://github.com/paps-jp/pipeline
cd pipeline
# venv作成
python3.12 -m venv .venv
source .venv/bin/activate # Windows: .venv\Scripts\activate
# パッケージインストール (editable)
pip install -e .</code></pre>
<p>これで <code>pipeline</code> コマンドが venv の中に入ります。</p>
<h2>初回起動</h2>
<p>まずは単一プロセス mode が最短です。SQLite DB は初回起動時に自動作成されます。</p>
<pre><code>pipeline run --dev
# → http://localhost:8000 (SQLite: ./pipeline.db、ワンタイム管理者PWが表示されます)</code></pre>
<p>本番寄りに DB とポートを明示するなら:</p>
<pre><code>pipeline run \
--host 0.0.0.0 \
--port 8000 \
--db-url sqlite:///./pipeline.db \
--log-level info</code></pre>
<p>ブラウザで <code>http://localhost:8000</code> を開き、ダッシュボードが表示されれば OK です。</p>
<div class="callout">
<strong>初回はワークロードゼロです。</strong> 「稼働ワーカー」「最近の失敗」「キュー深さ」の3パネルは全て空状態で表示されます。これは正常です。
</div>
<h2>Web UI ビルド</h2>
<p>repo にビルド済バンドルは含まれないため、初回はビルドが必要です。</p>
<pre><code>cd web
npm install
npm run build
# → FastAPI が配信する静的ファイルが出力される</code></pre>
<p>その後 <code>pipeline run …</code> を再起動すると新 UI を配信します。開発時 (ホットリロード) は <code>npm run dev</code> を使います。<code>localhost:5173</code> が立ち上がり、<code>/api</code> は制御プレーンへ proxy されます。</p>
<h2>最初のワークロード</h2>
<p>repo に <code>examples/plugins/echo_sample/</code> が同梱されています。これで動作確認できます。</p>
<ol>
<li>Web UI → <strong>ワークロード</strong> → <strong>新規作成</strong></li>
<li>基本情報: slug <code>echo-test</code> / 表示名 <code>Echoテスト</code></li>
<li>実行モード: <strong>python_module</strong> を選択</li>
<li>プラグイン: <code>echo-sample</code> / モジュール: <code>main</code></li>
<li>設定: prefix <code>[echo]</code> / sleep_secs <code>0</code> / fail_pk_substr 空文字</li>
<li><strong>作成</strong> すると一覧に <code>echo-test</code> が追加されます。</li>
<li>その行の <strong>📨 投入</strong> で pk に <code>hello</code> を入れて投入します。</li>
<li>同じ行の <strong>履歴</strong> で、run が緑色 (success) で表示されます。</li>
</ol>
<p>1件実行できれば制御プレーンは正常です。次はワーカーを別ホストに追加します。</p>
<h2>ワーカーをホストに追加</h2>
<h3>方法1: 手動</h3>
<p>ワーカーを動かすホストで同じ手順で venv + pip install を行い、起動します。worker は pull 型なので、起動するだけで自動 join します。</p>
<pre><code>pipeline worker \
--control-url http://<control-host>:8000 \
--worker-id worker-host-a \
--log-level info</code></pre>
<p>制御プレーンの Web UI → <strong>ワーカー</strong> でこのホストが <code>active</code> と表示されます。特定 workload をそのホストに限定したいときは、workload の <code>host_affinity</code> にホスト名を入れます (<a href="configuration.html#workload-のフィールド">設定リファレンス</a>)。</p>
<h3>方法2: Deploy タブから配信</h3>
<ol>
<li>Web UI → <strong>Hosts</strong> で SSH 接続先を登録し、公開鍵をホストの <code>authorized_keys</code> に追記します。</li>
<li>Web UI → <strong>Deploy</strong> で「配信パス」(何をどこへ + setup/service コマンド) を登録します。</li>
<li><strong>Deploy now</strong> で一括 rsync + restart。詳細は <a href="web-ui.html#deploy">Web UI ガイドの Deploy</a> を参照。</li>
</ol>
<h2>systemd 常駐化</h2>
<h3>制御プレーン</h3>
<pre><code># /etc/systemd/system/pipeline-control.service
[Unit]
Description=Pipeline control plane
After=network.target
[Service]
Type=simple
User=youruser
WorkingDirectory=/opt/pipeline
ExecStart=/opt/pipeline/.venv/bin/pipeline run \
--host 0.0.0.0 --port 8000 \
--db-url sqlite:////opt/pipeline/data/pipeline.db \
--log-level info
Restart=on-failure
RestartSec=5
[Install]
WantedBy=multi-user.target</code></pre>
<h3>ワーカー</h3>
<pre><code># /etc/systemd/system/pipeline-worker.service
[Unit]
Description=Pipeline worker
After=network.target
[Service]
Type=simple
User=youruser
WorkingDirectory=/opt/pipeline
ExecStart=/opt/pipeline/.venv/bin/pipeline worker \
--control-url http://<control-host>:8000 \
--worker-id %H \
--log-level info
Restart=on-failure
RestartSec=5
[Install]
WantedBy=multi-user.target</code></pre>
<pre><code>sudo systemctl daemon-reload
sudo systemctl enable --now pipeline-control # 制御プレーン側
sudo systemctl enable --now pipeline-worker # 各ワーカー側</code></pre>
<h2>動作確認</h2>
<p>curl で API を叩いて状態を確認できます。</p>
<pre><code>curl http://localhost:8000/api/v1/status
# → {"version":"...","mode":"control","db_url":"sqlite:///./pipeline.db","now":"..."}
curl http://localhost:8000/api/v1/workers
# → {"workers":[{"id":"worker-host-a","host":"...","state":"active",...}],"total":1}
curl http://localhost:8000/api/v1/dashboard/overview
# → {"running":[...],"recent_failures":[...],"queue_depths":[...]}</code></pre>
<p>続いて詳しい使い方は <a href="web-ui.html">Web UI ガイド</a>や <a href="plugin-sdk.html">プラグインSDK</a> をご覧ください。</p>
<nav class="docs-pager" id="docs-pager"></nav>
<div class="docs-foot">
<span>Pipeline — GUI-first batch fleet · <a href="https://paps-jp.github.io/" target="_blank" rel="noopener">ぱっぷすラボ</a></span>
<span><a href="https://github.com/paps-jp/pipeline">GitHub</a> · <a href="./">ホーム</a></span>
</div>
</article>
</main>
<aside class="docs-toc" id="docs-toc"></aside>
</div>
<script src="assets/docs.js" defer></script>
</body>
</html>