diff --git a/app/Containers/Dashboard/UI/API/Controllers/DeployController.php b/app/Containers/Dashboard/UI/API/Controllers/DeployController.php new file mode 100644 index 0000000..c00af53 --- /dev/null +++ b/app/Containers/Dashboard/UI/API/Controllers/DeployController.php @@ -0,0 +1,44 @@ +lockFile)) { + return response()->json([ + 'error' => 'Deploy already in progress' + ], 409); + } + + Process::run('nohup php artisan deploy:run > /dev/null 2>&1 &'); + + return response()->json(['message' => 'Deploy started']); + } + + public function status(): JsonResponse + { + if (!File::exists($this->statusFile)) { + return response()->json([ + 'running' => false, + 'step' => 0, + 'total_steps' => 12, + 'current_step' => '', + 'logs' => [], + 'error' => null, + ]); + } + + $status = json_decode(File::get($this->statusFile), true); + return response()->json($status); + } +} diff --git a/app/Containers/Dashboard/UI/API/Routes/api.php b/app/Containers/Dashboard/UI/API/Routes/api.php new file mode 100644 index 0000000..fb4c042 --- /dev/null +++ b/app/Containers/Dashboard/UI/API/Routes/api.php @@ -0,0 +1,7 @@ +group(function () { + require __DIR__.'/../Containers/Dashboard/UI/API/Routes/api.php'; +});