Merge remote-tracking branch 'origin/next' into volume-backups-server-s3

This commit is contained in:
Andras Bacsai
2026-07-19 21:45:26 +02:00
38 changed files with 379 additions and 651 deletions
@@ -3849,9 +3849,9 @@ class ApplicationsController extends Controller
]);
}
#[OA\Get(
#[OA\Post(
summary: 'Start',
description: 'Start application. `Post` request is also accepted.',
description: 'Start application.',
path: '/applications/{uuid}/start',
operationId: 'start-application-by-uuid',
security: [
@@ -3973,9 +3973,9 @@ class ApplicationsController extends Controller
);
}
#[OA\Get(
#[OA\Post(
summary: 'Stop',
description: 'Stop application. `Post` request is also accepted.',
description: 'Stop application.',
path: '/applications/{uuid}/stop',
operationId: 'stop-application-by-uuid',
security: [
@@ -4066,9 +4066,9 @@ class ApplicationsController extends Controller
);
}
#[OA\Get(
#[OA\Post(
summary: 'Restart',
description: 'Restart application. `Post` request is also accepted.',
description: 'Restart application.',
path: '/applications/{uuid}/restart',
operationId: 'restart-application-by-uuid',
security: [
@@ -3050,9 +3050,9 @@ class DatabasesController extends Controller
return moveResourceToEnvironment($request, $database, 'Database', $teamId);
}
#[OA\Get(
#[OA\Post(
summary: 'Start',
description: 'Start database. `Post` request is also accepted.',
description: 'Start database.',
path: '/databases/{uuid}/start',
operationId: 'start-database-by-uuid',
security: [
@@ -3137,9 +3137,9 @@ class DatabasesController extends Controller
);
}
#[OA\Get(
#[OA\Post(
summary: 'Stop',
description: 'Stop database. `Post` request is also accepted.',
description: 'Stop database.',
path: '/databases/{uuid}/stop',
operationId: 'stop-database-by-uuid',
security: [
@@ -3236,9 +3236,9 @@ class DatabasesController extends Controller
);
}
#[OA\Get(
#[OA\Post(
summary: 'Restart',
description: 'Restart database. `Post` request is also accepted.',
description: 'Restart database.',
path: '/databases/{uuid}/restart',
operationId: 'restart-database-by-uuid',
security: [
@@ -304,9 +304,9 @@ class DeployController extends Controller
}
}
#[OA\Get(
#[OA\Post(
summary: 'Deploy',
description: 'Deploy by tag or uuid. `Post` request also accepted with `uuid` and `tag` json body.',
description: 'Deploy by tag or UUID using query parameters or a JSON body.',
path: '/deploy',
operationId: 'deploy-by-tag-or-uuid',
security: [
+10 -2
View File
@@ -3,12 +3,20 @@
namespace App\Http\Controllers\Api;
use App\Http\Controllers\Controller;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Http;
use OpenApi\Attributes as OA;
class OtherController extends Controller
{
public function post_required(): JsonResponse
{
return response()
->json(['message' => 'This endpoint has changed to a POST request.'], 405)
->header('Allow', 'POST');
}
#[OA\Get(
summary: 'Version',
description: 'Get Coolify version.',
@@ -41,7 +49,7 @@ class OtherController extends Controller
return response(config('constants.coolify.version'));
}
#[OA\Get(
#[OA\Post(
summary: 'Enable API',
description: 'Enable API (only with root permissions).',
path: '/enable',
@@ -97,7 +105,7 @@ class OtherController extends Controller
return response()->json(['message' => 'API enabled.'], 200);
}
#[OA\Get(
#[OA\Post(
summary: 'Disable API',
description: 'Disable API (only with root permissions).',
path: '/disable',
+36 -3
View File
@@ -8,6 +8,7 @@ use App\Enums\ProxyStatus;
use App\Enums\ProxyTypes;
use App\Http\Controllers\Controller;
use App\Jobs\DeleteResourceJob;
use App\Jobs\ValidateAndInstallServerJob;
use App\Models\Application;
use App\Models\PrivateKey;
use App\Models\Project;
@@ -887,7 +888,7 @@ class ServersController extends Controller
return response()->json(['message' => 'Server deleted.']);
}
#[OA\Get(
#[OA\Post(
summary: 'Validate',
description: 'Validate server by UUID.',
path: '/servers/{uuid}/validate',
@@ -899,6 +900,19 @@ class ServersController extends Controller
parameters: [
new OA\Parameter(name: 'uuid', in: 'path', required: true, description: 'Server UUID', schema: new OA\Schema(type: 'string')),
],
requestBody: new OA\RequestBody(
required: false,
content: new OA\JsonContent(
properties: [
new OA\Property(
property: 'install',
description: 'Install missing prerequisites and Docker. This can restart the Docker daemon.',
type: 'boolean',
default: false,
),
],
),
),
responses: [
new OA\Response(
response: 201,
@@ -948,14 +962,33 @@ class ServersController extends Controller
return response()->json(['message' => 'Server not found.'], 404);
}
$this->authorize('update', $server);
ValidateServer::dispatch($server);
$validator = customApiValidator($request->all(), [
'install' => 'boolean',
]);
if ($validator->fails()) {
return response()->json([
'message' => 'Validation failed.',
'errors' => $validator->errors(),
], 422);
}
$install = $request->boolean('install', false);
if ($install) {
ValidateAndInstallServerJob::dispatch($server);
} else {
ValidateServer::dispatch($server);
}
auditLog('api.server.validated', [
'team_id' => $teamId,
'server_uuid' => $server->uuid,
'server_name' => $server->name,
'install' => $install,
]);
return response()->json(['message' => 'Validation started.'], 201);
$message = $install ? 'Validation and installation started.' : 'Validation started.';
return response()->json(['message' => $message], 201);
}
}
@@ -498,75 +498,6 @@ class ServiceApplicationsController extends Controller
]);
}
#[OA\Get(
summary: 'Start or redeploy service application container',
description: 'Runs docker compose up for a single compose service (no-deps), optionally pulling the image and rebuilding.',
path: '/services/{uuid}/applications/{app_uuid}/start',
operationId: 'start-service-application-by-service-and-app-uuid',
security: [
['bearerAuth' => []],
],
tags: ['Service applications'],
parameters: [
new OA\Parameter(
name: 'uuid',
in: 'path',
description: 'Service UUID.',
required: true,
schema: new OA\Schema(type: 'string')
),
new OA\Parameter(
name: 'app_uuid',
in: 'path',
description: 'Service application UUID.',
required: true,
schema: new OA\Schema(type: 'string')
),
new OA\Parameter(
name: 'force',
in: 'query',
description: 'When true, passes --build to docker compose up.',
required: false,
schema: new OA\Schema(type: 'boolean', default: false)
),
new OA\Parameter(
name: 'latest',
in: 'query',
description: 'When true, pulls the image for this compose service before up.',
required: false,
schema: new OA\Schema(type: 'boolean', default: false)
),
],
responses: [
new OA\Response(
response: 200,
description: 'Deploy request queued.',
content: [
new OA\MediaType(
mediaType: 'application/json',
schema: new OA\Schema(
type: 'object',
properties: [
'message' => new OA\Property(property: 'message', type: 'string'),
]
)
),
]
),
new OA\Response(
response: 401,
ref: '#/components/responses/401',
),
new OA\Response(
response: 404,
ref: '#/components/responses/404',
),
new OA\Response(
response: 501,
description: 'Swarm not supported.',
),
]
)]
#[OA\Post(
summary: 'Start or redeploy service application container',
description: 'Runs docker compose up for a single compose service (no-deps), optionally pulling the image and rebuilding.',
@@ -635,61 +566,6 @@ class ServiceApplicationsController extends Controller
], 200);
}
#[OA\Get(
summary: 'Restart service application container',
description: 'Restarts a single compose service container (docker restart).',
path: '/services/{uuid}/applications/{app_uuid}/restart',
operationId: 'restart-service-application-by-service-and-app-uuid',
security: [
['bearerAuth' => []],
],
tags: ['Service applications'],
parameters: [
new OA\Parameter(
name: 'uuid',
in: 'path',
description: 'Service UUID.',
required: true,
schema: new OA\Schema(type: 'string')
),
new OA\Parameter(
name: 'app_uuid',
in: 'path',
description: 'Service application UUID.',
required: true,
schema: new OA\Schema(type: 'string')
),
],
responses: [
new OA\Response(
response: 200,
description: 'Restart queued.',
content: [
new OA\MediaType(
mediaType: 'application/json',
schema: new OA\Schema(
type: 'object',
properties: [
'message' => new OA\Property(property: 'message', type: 'string'),
]
)
),
]
),
new OA\Response(
response: 401,
ref: '#/components/responses/401',
),
new OA\Response(
response: 404,
ref: '#/components/responses/404',
),
new OA\Response(
response: 501,
description: 'Swarm not supported.',
),
]
)]
#[OA\Post(
summary: 'Restart service application container',
description: 'Restarts a single compose service container.',
@@ -753,61 +629,6 @@ class ServiceApplicationsController extends Controller
], 200);
}
#[OA\Get(
summary: 'Stop service application container',
description: 'Stops a single compose service container (docker stop).',
path: '/services/{uuid}/applications/{app_uuid}/stop',
operationId: 'stop-service-application-by-service-and-app-uuid',
security: [
['bearerAuth' => []],
],
tags: ['Service applications'],
parameters: [
new OA\Parameter(
name: 'uuid',
in: 'path',
description: 'Service UUID.',
required: true,
schema: new OA\Schema(type: 'string')
),
new OA\Parameter(
name: 'app_uuid',
in: 'path',
description: 'Service application UUID.',
required: true,
schema: new OA\Schema(type: 'string')
),
],
responses: [
new OA\Response(
response: 200,
description: 'Stop queued.',
content: [
new OA\MediaType(
mediaType: 'application/json',
schema: new OA\Schema(
type: 'object',
properties: [
'message' => new OA\Property(property: 'message', type: 'string'),
]
)
),
]
),
new OA\Response(
response: 401,
ref: '#/components/responses/401',
),
new OA\Response(
response: 404,
ref: '#/components/responses/404',
),
new OA\Response(
response: 501,
description: 'Swarm not supported.',
),
]
)]
#[OA\Post(
summary: 'Stop service application container',
description: 'Stops a single compose service container.',
@@ -1970,9 +1970,9 @@ class ServicesController extends Controller
return moveResourceToEnvironment($request, $service, 'Service', $teamId);
}
#[OA\Get(
#[OA\Post(
summary: 'Start',
description: 'Start service. `Post` request is also accepted.',
description: 'Start service.',
path: '/services/{uuid}/start',
operationId: 'start-service-by-uuid',
security: [
@@ -2056,9 +2056,9 @@ class ServicesController extends Controller
);
}
#[OA\Get(
#[OA\Post(
summary: 'Stop',
description: 'Stop service. `Post` request is also accepted.',
description: 'Stop service.',
path: '/services/{uuid}/stop',
operationId: 'stop-service-by-uuid',
security: [
@@ -2154,9 +2154,9 @@ class ServicesController extends Controller
);
}
#[OA\Get(
#[OA\Post(
summary: 'Restart',
description: 'Restart service. `Post` request is also accepted.',
description: 'Restart service.',
path: '/services/{uuid}/restart',
operationId: 'restart-service-by-uuid',
security: [