An open-source, self-hostable PaaS alternative to Vercel, Heroku & Netlify that lets you easily deploy static sites, databases, full-stack applications and 360+ one-click services on your own servers.
PHP coolifydatabasesdeploymentdockerdocker-composeinertiajslaravelmariadbmysqlnextjsnodejsphppostgresredisself-hostedself-hostingserverstatic-sitesveltesvelte5
feat(api): add endpoints for retrieving application logs and deployments
Andras Bacsai9f67633f2cff
diff --git a/app/Console/Commands/OpenApi.php b/app/Console/Commands/OpenApi.phpindex 6cbcb310c3..3cef854777 100644--- a/app/Console/Commands/OpenApi.php+++ b/app/Console/Commands/OpenApi.php@@ -4,6 +4,7 @@ namespace App\Console\Commands;use Illuminate\Console\Command;use Illuminate\Support\Facades\Process;+use Symfony\Component\Yaml\Yaml;class OpenApi extends Command{@@ -29,5 +30,10 @@ class OpenApi extends Command$error = preg_replace('/^\h*\v+/m', '', $error);echo $error;echo $process->output();++ $yaml = file_get_contents('openapi.yaml');+ $json = json_encode(Yaml::parse($yaml), JSON_PRETTY_PRINT);+ file_put_contents('openapi.json', $json);+ echo "Converted OpenAPI YAML to JSON.\n";}}diff --git a/app/Http/Controllers/Api/DeployController.php b/app/Http/Controllers/Api/DeployController.phpindex 65ed11d9cf..424c2cc760 100644--- a/app/Http/Controllers/Api/DeployController.php+++ b/app/Http/Controllers/Api/DeployController.php@@ -328,7 +328,7 @@ class DeployController extends Controllersummary: 'List application deployments',description: 'List application deployments by using the app uuid',path: '/deployments/applications/{uuid}',- operationId: 'list-deployments',+ operationId: 'list-deployments-by-app-uuid',security: [['bearerAuth' => []],],diff --git a/openapi.json b/openapi.jsonindex 1d7d69fe73..98447067ef 100644--- a/openapi.json+++ b/openapi.json@@ -2105,6 +2105,70 @@]}},+ "\/applications\/{uuid}\/logs": {+ "get": {+ "tags": [+ "Applications"+ ],+ "summary": "Get application logs.",+ "description": "Get application logs by UUID.",+ "operationId": "get-application-logs-by-uuid",+ "parameters": [+ {+ "name": "uuid",+ "in": "path",+ "description": "UUID of the application.",+ "required": true,+ "schema": {+ "type": "string",+ "format": "uuid"+ }+ },+ {+ "name": "lines",+ "in": "query",+ "description": "Number of lines to show from the end of the logs.",+ "required": false,+ "schema": {+ "type": "integer",+ "format": "int32",+ "default": 100+ }+ }+ ],+ "responses": {+ "200": {+ "description": "Get application logs by UUID.",+ "content": {+ "application\/json": {+ "schema": {+ "properties": {+ "logs": {+ "type": "string"+ }+ },+ "type": "object"+ }+ }+ }+ },+ "401": {+ "$ref": "#\/components\/responses\/401"+ },+ "400": {+ "$ref": "#\/components\/responses\/400"+ },+ "404": {+ "$ref": "#\/components\/responses\/404"+ }+ },+ "security": [+ {+ "bearerAuth": []+ }+ ]+ }+ },"\/applications\/{uuid}\/envs": {"get": {"tags": [@@ -4481,7 +4545,7 @@{"name": "pr","in": "query",- "description": "Pull request ID",+ "description": "Pull Request Id for deploying specific PR builds. Cannot be used with tag parameter.","schema": {"type": "integer"}@@ -4531,6 +4595,42 @@]}},+ "\/deployments\/applications\/{uuid}": {+ "get": {+ "tags": [+ "Deployments"+ ],+ "summary": "List application deployments",+ "description": "List application deployments by using the app uuid",+ "operationId": "list-deployments-by-app-uuid",+ "responses": {+ "200": {+ "description": "List application deployments by using the app uuid.",+ "content": {+ "application\/json": {+ "schema": {+ "type": "array",+ "items": {+ "$ref": "#\/components\/schemas\/Application"+ }+ }+ }+ }+ },+ "401": {+ "$ref": "#\/components\/responses\/401"+ },+ "400": {+ "$ref": "#\/components\/responses\/400"+ }+ },+ "security": [+ {+ "bearerAuth": []+ }+ ]+ }+ },"\/version": {"get": {"summary": "Version",@@ -5862,8 +5962,8 @@"tags": ["Services"],- "summary": "Create",- "description": "Create a one-click service",+ "summary": "Create service",+ "description": "Create a one-click \/ custom service","operationId": "create-service","requestBody": {"required": true,@@ -6013,7 +6113,7 @@},"responses": {"201": {- "description": "Create a service.",+ "description": "Service created successfully.","content": {"application\/json": {"schema": {@@ -6185,6 +6285,114 @@"bearerAuth": []}]+ },+ "patch": {+ "tags": [+ "Services"+ ],+ "summary": "Update",+ "description": "Update service by UUID.",+ "operationId": "update-service-by-uuid",+ "requestBody": {+ "description": "Service updated.",+ "required": true,+ "content": {+ "application\/json": {+ "schema": {+ "required": [+ "server_uuid",+ "project_uuid",+ "environment_name",+ "environment_uuid",+ "docker_compose_raw"+ ],+ "properties": {+ "name": {+ "type": "string",+ "description": "The service name."+ },+ "description": {+ "type": "string",+ "description": "The service description."+ },+ "project_uuid": {+ "type": "string",+ "description": "The project UUID."+ },+ "environment_name": {+ "type": "string",+ "description": "The environment name."+ },+ "environment_uuid": {+ "type": "string",+ "description": "The environment UUID."+ },+ "server_uuid": {+ "type": "string",+ "description": "The server UUID."+ },+ "destination_uuid": {+ "type": "string",+ "description": "The destination UUID."+ },+ "instant_deploy": {+ "type": "boolean",+ "description": "The flag to indicate if the service should be deployed instantly."+ },+ "connect_to_docker_network": {+ "type": "boolean",+ "default": false,+ "description": "Connect the service to the predefined docker network."+ },+ "docker_compose_raw": {+ "type": "string",+ "description": "The Docker Compose raw content."+ }+ },+ "type": "object"+ }+ }+ }+ },+ "responses": {+ "200": {+ "description": "Service updated.",+ "content": {+ "application\/json": {+ "schema": {+ "properties": {+ "uuid": {+ "type": "string",+ "description": "Service UUID."+ },+ "domains": {+ "type": "array",+ "items": {+ "type": "string"+ },+ "description": "Service domains."+ }+ },+ "type": "object"+ }+ }+ }+ },+ "401": {+ "$ref": "#\/components\/responses\/401"+ },+ "400": {+ "$ref": "#\/components\/responses\/400"+ },+ "404": {+ "$ref": "#\/components\/responses\/404"+ }+ },+ "security": [+ {+ "bearerAuth": []+ }+ ]}},"\/services\/{uuid}\/envs": {diff --git a/openapi.yaml b/openapi.yamlindex 7cddb7b553..ba4b7193e5 100644--- a/openapi.yaml+++ b/openapi.yaml@@ -3155,7 +3155,7 @@ paths:-name: prin: query- description: 'Pull request id'+ description: 'Pull Request Id for deploying specific PR builds. Cannot be used with tag parameter.'schema:type: integerresponses:@@ -3174,6 +3174,29 @@ paths:security:-bearerAuth: []+ '/deployments/applications/{uuid}':+ get:+ tags:+ - Deployments+ summary: 'List application deployments'+ description: 'List application deployments by using the app uuid'+ operationId: list-deployments-by-app-uuid+ responses:+ '200':+ description: 'List application deployments by using the app uuid.'+ content:+ application/json:+ schema:+ type: array+ items:+ $ref: '#/components/schemas/Application'+ '401':+ $ref: '#/components/responses/401'+ '400':+ $ref: '#/components/responses/400'+ security:+ -+ bearerAuth: []/version:get:summary: Version@@ -4001,80 +4024,9 @@ paths:post:tags:- Services- summary: Create- description: 'Create a service'+ summary: 'Create service'+ description: 'Create a one-click / custom service'operationId: create-service- requestBody:- required: true- content:- application/json:- schema:- required:- - server_uuid- - project_uuid- - environment_name- - environment_uuid- - docker_compose_raw- properties:- name:- type: string- maxLength: 255- description: 'Name of the service.'- description:- type: string- nullable: true- description: 'Description of the service.'- project_uuid:- type: string- description: 'Project UUID.'- environment_name:- type: string- description: 'Environment name. You need to provide at least one of environment_name or environment_uuid.'- environment_uuid:- type: string- description: 'Environment UUID. You need to provide at least one of environment_name or environment_uuid.'- server_uuid:- type: string- description: 'Server UUID.'- destination_uuid:- type: string- description: 'Destination UUID. Required if server has multiple destinations.'- instant_deploy:- type: boolean- default: false- description: 'Start the service immediately after creation.'- connect_to_docker_network:- type: boolean- default: false- description: 'The flag to connect the service to the predefined Docker network.'- docker_compose_raw:- type: string- description: 'The Docker Compose raw content.'- type: object- responses:- '201':- description: 'Service created successfully.'- content:- application/json:- schema:- properties:- uuid: { type: string, description: 'Service UUID.' }- domains: { type: array, items: { type: string, nullable: true }, description: 'Service domains.' }- type: object- '401':- $ref: '#/components/responses/401'- '400':- $ref: '#/components/responses/400'- security:- -- bearerAuth: []- /services/one-click:- post:- tags:- - Services- summary: 'Create one-click'- description: 'Create a one-click service'- operationId: create-one-click-servicerequestBody:required: truecontent:@@ -4277,7 +4229,7 @@ paths:connect_to_docker_network:type: booleandefault: false- description: 'The flag to connect the service to the predefined Docker network.'+ description: 'Connect the service to the predefined docker network.'docker_compose_raw:type: stringdescription: 'The Docker Compose raw content.'