バグ #740
未完了
自動化スクリプト実行機能実装 - クイックスクリプト統合 (子チケット)
Redmine Admin さんが約13時間前に追加.
約6時間前に更新.
説明
自動化スクリプト実行機能実装 - クイックスクリプト統合¶
🎯 概要¶
VPS-ROOT環境で利用している自動化スクリプト(vps_status、compose_restart等)の実行・管理機能を実装します。
📋 実装対象¶
1. API エンドポイント¶
-
GET /api/v1/scripts
- 利用可能スクリプト一覧
-
POST /api/v1/scripts/execute
- スクリプト実行
-
GET /api/v1/scripts/execution/:id
- 実行状況取得
-
GET /api/v1/scripts/history
- 実行履歴取得
-
POST /api/v1/scripts/schedule
- スケジュール設定
-
GET /api/v1/scripts/scheduled
- スケジュール済みタスク一覧
2. 主要関数¶
executeScript(scriptType: string, args?: ScriptArgs): Promise<ExecutionResult>
executeVPSStatus(): Promise<VPSStatusResult>
executeComposeRestart(service?: string): Promise<ComposeResult>
executeNginxReload(): Promise<NginxReloadResult>
getExecutionHistory(filters?: ExecutionFilters): Promise<ExecutionHistory[]>
scheduleScript(script: ScheduledScript): Promise<void>
3. UI コンポーネント¶
-
QuickScriptsPage.tsx
- スクリプト実行画面
-
ScriptSelectionGrid
- スクリプト選択グリッド
-
ExecutionOutputTerminal
- 実行結果ターミナル
-
ExecutionHistoryTable
- 実行履歴テーブル
-
ParameterInputForm
- パラメータ入力フォーム
🔧 技術仕様¶
対応スクリプト¶
-
vps_status
- VPS状況確認
-
compose_restart
- Docker Compose再起動
-
nginx_reload
- Nginx設定再読み込み
-
quick_fix
- 自動修復処理
-
docker_detail
- Docker詳細確認
-
system_backup
- システムバックアップ
安全性・実行管理¶
- スクリプト実行権限制御 (Operator以上)
- パラメータ検証・サニタイズ
- 実行タイムアウト設定
- 並行実行制限・キューイング
- 実行結果の記録・監査
✅ 完了条件¶
🔗 関連チケット¶
親チケット: インフラヘルパーサービス基盤構築
📅 期限¶
Phase 1 - 基盤実装: 2025年6月30日まで
📋 自動化スクリプト実行機能実装 - 現状・詳細仕様追記¶
🔍 現在の実装状況
API エンドポイント実装状況 (/api/v1/scripts
)¶
エンドポイント |
メソッド |
実装状況 |
パラメータ |
レスポンス |
/available |
GET |
📋 設計完了 |
- |
{scripts[]} |
/execute |
POST |
📋 設計完了 |
{scriptType, args?} |
{executionId} |
/execute/vps-status |
POST |
📋 設計完了 |
- |
{result} |
/execute/compose-restart |
POST |
📋 設計完了 |
{service?} |
{result} |
/execute/nginx-reload |
POST |
📋 設計完了 |
- |
{result} |
/execute/quick-fix |
POST |
📋 設計完了 |
- |
{result} |
/executions |
GET |
📋 設計完了 |
?limit&offset |
{executions[]} |
/executions/:id |
GET |
📋 設計完了 |
- |
{execution} |
/executions/:id/output |
GET |
📋 設計完了 |
- |
{output} |
/executions/:id/cancel |
POST |
⭕ 未着手 |
- |
{success} |
/schedules |
GET |
⭕ 未着手 |
- |
{schedules[]} |
/schedules |
POST |
⭕ 未着手 |
{script, cron} |
{scheduleId} |
/schedules/:id |
PUT |
⭕ 未着手 |
{cron, enabled} |
{success} |
/schedules/:id |
DELETE |
⭕ 未着手 |
- |
{success} |
関数実装状況 (0/16 開発中、12/16 設計完了、4/16 未着手)¶
ファイル: /src/services/scripts/ScriptExecutionService.ts
📋 スクリプト実行関数 (設計完了)¶
// 基本実行機能 - 設計完了
async executeScript(scriptType: string, args?: ScriptArgs): Promise<ExecutionResult> // 設計完了
async getAvailableScripts(): Promise<ScriptInfo[]> // 設計完了
async getExecutionHistory(filters?: ExecutionFilters): Promise<ExecutionHistory[]> // 設計完了
async getExecutionStatus(executionId: string): Promise<ExecutionStatus> // 設計完了
async getExecutionOutput(executionId: string): Promise<ExecutionOutput> // 設計完了
// 専用スクリプト実行 - 設計完了
async executeVPSStatus(): Promise<VPSStatusResult> // 設計完了
async executeComposeRestart(service?: string): Promise<ComposeResult> // 設計完了
async executeNginxReload(): Promise<NginxReloadResult> // 設計完了
async executeQuickFix(): Promise<QuickFixResult> // 設計完了
async executeDockerDetail(): Promise<DockerDetailResult> // 設計完了
async executeSystemBackup(): Promise<BackupResult> // 設計完了
// セキュリティ・検証 - 設計完了
async validateScriptSafety(script: ScriptInfo): Promise<SafetyResult> // 設計完了
⭕ 未実装機能¶
// 実行制御 - 未着手
async cancelExecution(executionId: string): Promise<CancelResult> // 未着手
// スケジュール管理 - 未着手
async scheduleScript(script: ScheduledScript): Promise<void> // 未着手
async getScheduledScripts(): Promise<ScheduledScript[]> // 未着手
async updateSchedule(scheduleId: string, schedule: Partial<ScheduledScript>): Promise<void> // 未着手
🔧 技術仕様詳細
対応スクリプト (全設計完了)¶
- ✅
vps_status
- VPS状況確認
- ✅
compose_restart
- Docker Compose再起動
- ✅
nginx_reload
- Nginx設定再読み込み
- ✅
quick_fix
- 自動修復処理
- ✅
docker_detail
- Docker詳細確認
- ✅
system_backup
- システムバックアップ
安全性・実行管理¶
- 📋 スクリプト実行権限制御 (Operator以上) - 設計完了
- 📋 パラメータ検証・サニタイズ - 設計完了
- 📋 実行タイムアウト設定 - 設計完了
- 📋 並行実行制限・キューイング - 設計完了
- 📋 実行結果の記録・監査 - 設計完了
📈 進捗サマリー
-
API エンドポイント: 0/14 (0%) 開発中、9/14 (64%) 設計完了、5/14 (36%) 未着手
-
スクリプト実行関数: 0/16 (0%) 開発中、12/16 (75%) 設計完了、4/16 (25%) 未着手
-
UI コンポーネント: 要実装
-
スケジュール機能: 未着手
VPS環境で利用中の自動化スクリプトとの統合は設計完了。スケジュール機能とキャンセル機能が未着手。基本実行機能から実装開始!
他の形式にエクスポート: Atom
PDF