Merge branch 'coollabsio:main' into feat-forgejo

This commit is contained in:
Italo
2024-07-13 23:27:15 -04:00
committed by GitHub
65 changed files with 938 additions and 414 deletions

View File

@@ -2,8 +2,6 @@
) )
[![Bounty Issues](https://img.shields.io/static/v1?labelColor=grey&color=6366f1&label=Algora&message=%F0%9F%92%8E+Bounty+issues&style=for-the-badge)](https://console.algora.io/org/coollabsio/bounties/new) [![Bounty Issues](https://img.shields.io/static/v1?labelColor=grey&color=6366f1&label=Algora&message=%F0%9F%92%8E+Bounty+issues&style=for-the-badge)](https://console.algora.io/org/coollabsio/bounties/new)
[![Open Bounties](https://img.shields.io/endpoint?url=https%3A%2F%2Fconsole.algora.io%2Fapi%2Fshields%2Fcoollabsio%2Fbounties%3Fstatus%3Dopen&style=for-the-badge)](https://console.algora.io/org/coollabsio/bounties?status=open)
[![Rewarded Bounties](https://img.shields.io/endpoint?url=https%3A%2F%2Fconsole.algora.io%2Fapi%2Fshields%2Fcoollabsio%2Fbounties%3Fstatus%3Dcompleted&style=for-the-badge)](https://console.algora.io/org/coollabsio/bounties?status=completed)
# About the Project # About the Project
@@ -49,6 +47,7 @@ Special thanks to our biggest sponsors!
<a href="https://coolify.ad.vin/?ref=coolify.io" target="_blank"><img src="./other/logos/advin.png" alt="advin logo" width="250"/></a> <a href="https://coolify.ad.vin/?ref=coolify.io" target="_blank"><img src="./other/logos/advin.png" alt="advin logo" width="250"/></a>
<a href="https://trieve.ai/?ref=coolify.io" target="_blank"><img src="./other/logos/trieve_bg.png" alt="trieve logo" width="180"/></a> <a href="https://trieve.ai/?ref=coolify.io" target="_blank"><img src="./other/logos/trieve_bg.png" alt="trieve logo" width="180"/></a>
<a href="https://blacksmith.sh/?ref=coolify.io" target="_blank"><img src="./other/logos/blacksmith.svg" alt="blacksmith logo" width="200"/></a> <a href="https://blacksmith.sh/?ref=coolify.io" target="_blank"><img src="./other/logos/blacksmith.svg" alt="blacksmith logo" width="200"/></a>
<a href="https://latitude.sh/?ref=coolify.io" target="_blank"><img src="./other/logos/latitude.svg" alt="latitude logo" width="200"/></a>
## Github Sponsors ($40+) ## Github Sponsors ($40+)
<a href="https://serpapi.com/?ref=coolify.io"><img width="60px" alt="SerpAPI" src="https://github.com/serpapi.png"/></a> <a href="https://serpapi.com/?ref=coolify.io"><img width="60px" alt="SerpAPI" src="https://github.com/serpapi.png"/></a>

View File

@@ -38,6 +38,12 @@ class StopApplication
} }
} }
} }
if ($application->build_pack === 'dockercompose') {
// remove network
$uuid = $application->uuid;
instant_remote_process(["docker network disconnect {$uuid} coolify-proxy"], $server, false);
instant_remote_process(["docker network rm {$uuid}"], $server, false);
}
} }
} }
} }

View File

@@ -11,6 +11,8 @@ class CleanupDocker
public function handle(Server $server, bool $force = true) public function handle(Server $server, bool $force = true)
{ {
// cleanup docker images, containers, and builder caches
if ($force) { if ($force) {
instant_remote_process(['docker image prune -af'], $server, false); instant_remote_process(['docker image prune -af'], $server, false);
instant_remote_process(['docker container prune -f --filter "label=coolify.managed=true"'], $server, false); instant_remote_process(['docker container prune -f --filter "label=coolify.managed=true"'], $server, false);
@@ -20,5 +22,15 @@ class CleanupDocker
instant_remote_process(['docker container prune -f --filter "label=coolify.managed=true"'], $server, false); instant_remote_process(['docker container prune -f --filter "label=coolify.managed=true"'], $server, false);
instant_remote_process(['docker builder prune -f'], $server, false); instant_remote_process(['docker builder prune -f'], $server, false);
} }
// cleanup networks
// $networks = collectDockerNetworksByServer($server);
// $proxyNetworks = collectProxyDockerNetworksByServer($server);
// $diff = $proxyNetworks->diff($networks);
// if ($diff->count() > 0) {
// $diff->map(function ($network) use ($server) {
// instant_remote_process(["docker network disconnect $network coolify-proxy"], $server);
// instant_remote_process(["docker network rm $network"], $server);
// });
// }
} }
} }

View File

@@ -19,18 +19,16 @@ class StopService
ray('Stopping service: '.$service->name); ray('Stopping service: '.$service->name);
$applications = $service->applications()->get(); $applications = $service->applications()->get();
foreach ($applications as $application) { foreach ($applications as $application) {
instant_remote_process(["docker rm -f {$application->name}-{$service->uuid}"], $service->server); instant_remote_process(["docker rm -f {$application->name}-{$service->uuid}"], $service->server, false);
$application->update(['status' => 'exited']); $application->update(['status' => 'exited']);
} }
$dbs = $service->databases()->get(); $dbs = $service->databases()->get();
foreach ($dbs as $db) { foreach ($dbs as $db) {
instant_remote_process(["docker rm -f {$db->name}-{$service->uuid}"], $service->server); instant_remote_process(["docker rm -f {$db->name}-{$service->uuid}"], $service->server, false);
$db->update(['status' => 'exited']); $db->update(['status' => 'exited']);
} }
instant_remote_process(["docker network disconnect {$service->uuid} coolify-proxy 2>/dev/null"], $service->server, false); instant_remote_process(["docker network disconnect {$service->uuid} coolify-proxy"], $service->server);
instant_remote_process(["docker network rm {$service->uuid} 2>/dev/null"], $service->server, false); instant_remote_process(["docker network rm {$service->uuid}"], $service->server);
// TODO: make notification for databases
// $service->environment->project->team->notify(new StatusChanged($service));
} catch (\Exception $e) { } catch (\Exception $e) {
echo $e->getMessage(); echo $e->getMessage();
ray($e->getMessage()); ray($e->getMessage());

View File

@@ -2,6 +2,7 @@
namespace App\Console\Commands; namespace App\Console\Commands;
use App\Actions\Server\StopSentinel;
use App\Enums\ApplicationDeploymentStatus; use App\Enums\ApplicationDeploymentStatus;
use App\Jobs\CleanupHelperContainersJob; use App\Jobs\CleanupHelperContainersJob;
use App\Models\ApplicationDeploymentQueue; use App\Models\ApplicationDeploymentQueue;
@@ -23,6 +24,16 @@ class Init extends Command
{ {
$this->alive(); $this->alive();
get_public_ips(); get_public_ips();
if (version_compare('4.0.0-beta.312', config('version'), '<=')) {
$servers = Server::all();
foreach ($servers as $server) {
$server->settings->update(['is_metrics_enabled' => false]);
if ($server->isFunctional()) {
StopSentinel::dispatch($server);
}
}
}
$full_cleanup = $this->option('full-cleanup'); $full_cleanup = $this->option('full-cleanup');
$cleanup_deployments = $this->option('cleanup-deployments'); $cleanup_deployments = $this->option('cleanup-deployments');

View File

@@ -27,7 +27,7 @@ class ServiceStatusChanged implements ShouldBroadcast
public function broadcastOn(): ?array public function broadcastOn(): ?array
{ {
if ($this->userId) { if (! is_null($this->userId)) {
return [ return [
new PrivateChannel("user.{$this->userId}"), new PrivateChannel("user.{$this->userId}"),
]; ];

View File

@@ -50,7 +50,7 @@ class Handler extends ExceptionHandler
return response()->json(['message' => $exception->getMessage()], 401); return response()->json(['message' => $exception->getMessage()], 401);
} }
return redirect()->guest($exception->redirectTo() ?? route('login')); return redirect()->guest($exception->redirectTo($request) ?? route('login'));
} }
/** /**
@@ -65,7 +65,7 @@ class Handler extends ExceptionHandler
if ($e instanceof RuntimeException) { if ($e instanceof RuntimeException) {
return; return;
} }
$this->settings = InstanceSettings::get(); $this->settings = \App\Models\InstanceSettings::get();
if ($this->settings->do_not_track) { if ($this->settings->do_not_track) {
return; return;
} }

View File

@@ -683,6 +683,9 @@ class ApplicationsController extends Controller
if (! $request->has('name')) { if (! $request->has('name')) {
$request->offsetSet('name', generate_application_name($request->git_repository, $request->git_branch)); $request->offsetSet('name', generate_application_name($request->git_repository, $request->git_branch));
} }
if ($request->build_pack === 'dockercompose') {
$request->offsetSet('ports_exposes', '80');
}
$validator = customApiValidator($request->all(), [ $validator = customApiValidator($request->all(), [
sharedDataApplications(), sharedDataApplications(),
'git_repository' => 'string|required', 'git_repository' => 'string|required',
@@ -756,6 +759,9 @@ class ApplicationsController extends Controller
if (! $request->has('name')) { if (! $request->has('name')) {
$request->offsetSet('name', generate_application_name($request->git_repository, $request->git_branch)); $request->offsetSet('name', generate_application_name($request->git_repository, $request->git_branch));
} }
if ($request->build_pack === 'dockercompose') {
$request->offsetSet('ports_exposes', '80');
}
$validator = customApiValidator($request->all(), [ $validator = customApiValidator($request->all(), [
sharedDataApplications(), sharedDataApplications(),
'git_repository' => 'string|required', 'git_repository' => 'string|required',
@@ -847,6 +853,9 @@ class ApplicationsController extends Controller
if (! $request->has('name')) { if (! $request->has('name')) {
$request->offsetSet('name', generate_application_name($request->git_repository, $request->git_branch)); $request->offsetSet('name', generate_application_name($request->git_repository, $request->git_branch));
} }
if ($request->build_pack === 'dockercompose') {
$request->offsetSet('ports_exposes', '80');
}
$validator = customApiValidator($request->all(), [ $validator = customApiValidator($request->all(), [
sharedDataApplications(), sharedDataApplications(),
'git_repository' => 'string|required', 'git_repository' => 'string|required',
@@ -1231,6 +1240,16 @@ class ApplicationsController extends Controller
format: 'uuid', format: 'uuid',
) )
), ),
new OA\Parameter(
name: 'cleanup',
in: 'query',
description: 'Delete configurations and volumes.',
required: false,
schema: new OA\Schema(
type: 'boolean',
default: true,
)
),
], ],
responses: [ responses: [
new OA\Response( new OA\Response(
@@ -1264,15 +1283,12 @@ class ApplicationsController extends Controller
public function delete_by_uuid(Request $request) public function delete_by_uuid(Request $request)
{ {
$teamId = getTeamIdFromToken(); $teamId = getTeamIdFromToken();
$cleanup = $request->query->get('cleanup') ?? false; $cleanup = filter_var($request->query->get('cleanup', true), FILTER_VALIDATE_BOOLEAN);
if (is_null($teamId)) { if (is_null($teamId)) {
return invalidTokenResponse(); return invalidTokenResponse();
} }
if (! $request->uuid) {
if ($request->collect()->count() == 0) { return response()->json(['message' => 'UUID is required.'], 404);
return response()->json([
'message' => 'Invalid request.',
], 400);
} }
$application = Application::ownedByCurrentTeamAPI($teamId)->where('uuid', $request->uuid)->first(); $application = Application::ownedByCurrentTeamAPI($teamId)->where('uuid', $request->uuid)->first();
@@ -1281,7 +1297,10 @@ class ApplicationsController extends Controller
'message' => 'Application not found', 'message' => 'Application not found',
], 404); ], 404);
} }
DeleteResourceJob::dispatch($application, $cleanup); DeleteResourceJob::dispatch(
resource: $application,
deleteConfigurations: $cleanup,
deleteVolumes: $cleanup);
return response()->json([ return response()->json([
'message' => 'Application deletion request queued.', 'message' => 'Application deletion request queued.',

View File

@@ -9,6 +9,7 @@ use App\Actions\Database\StopDatabase;
use App\Actions\Database\StopDatabaseProxy; use App\Actions\Database\StopDatabaseProxy;
use App\Enums\NewDatabaseTypes; use App\Enums\NewDatabaseTypes;
use App\Http\Controllers\Controller; use App\Http\Controllers\Controller;
use App\Jobs\DeleteResourceJob;
use App\Models\Project; use App\Models\Project;
use App\Models\Server; use App\Models\Server;
use Illuminate\Http\Request; use Illuminate\Http\Request;
@@ -1528,6 +1529,16 @@ class DatabasesController extends Controller
format: 'uuid', format: 'uuid',
) )
), ),
new OA\Parameter(
name: 'cleanup',
in: 'query',
description: 'Delete configurations and volumes.',
required: false,
schema: new OA\Schema(
type: 'boolean',
default: true,
)
),
], ],
responses: [ responses: [
new OA\Response( new OA\Response(
@@ -1561,6 +1572,7 @@ class DatabasesController extends Controller
public function delete_by_uuid(Request $request) public function delete_by_uuid(Request $request)
{ {
$teamId = getTeamIdFromToken(); $teamId = getTeamIdFromToken();
$cleanup = filter_var($request->query->get('cleanup', true), FILTER_VALIDATE_BOOLEAN);
if (is_null($teamId)) { if (is_null($teamId)) {
return invalidTokenResponse(); return invalidTokenResponse();
} }
@@ -1571,8 +1583,10 @@ class DatabasesController extends Controller
if (! $database) { if (! $database) {
return response()->json(['message' => 'Database not found.'], 404); return response()->json(['message' => 'Database not found.'], 404);
} }
StopDatabase::dispatch($database); DeleteResourceJob::dispatch(
$database->forceDelete(); resource: $database,
deleteConfigurations: $cleanup,
deleteVolumes: $cleanup);
return response()->json([ return response()->json([
'message' => 'Database deletion request queued.', 'message' => 'Database deletion request queued.',

View File

@@ -3,7 +3,6 @@
namespace App\Http\Controllers\Api; namespace App\Http\Controllers\Api;
use App\Http\Controllers\Controller; use App\Http\Controllers\Controller;
use App\Models\InstanceSettings;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use Illuminate\Support\Facades\Http; use Illuminate\Support\Facades\Http;
use OpenApi\Attributes as OA; use OpenApi\Attributes as OA;
@@ -85,7 +84,7 @@ class OtherController extends Controller
if ($teamId !== '0') { if ($teamId !== '0') {
return response()->json(['message' => 'You are not allowed to enable the API.'], 403); return response()->json(['message' => 'You are not allowed to enable the API.'], 403);
} }
$settings = InstanceSettings::get(); $settings = \App\Models\InstanceSettings::get();
$settings->update(['is_api_enabled' => true]); $settings->update(['is_api_enabled' => true]);
return response()->json(['message' => 'API enabled.'], 200); return response()->json(['message' => 'API enabled.'], 200);
@@ -136,7 +135,7 @@ class OtherController extends Controller
if ($teamId !== '0') { if ($teamId !== '0') {
return response()->json(['message' => 'You are not allowed to disable the API.'], 403); return response()->json(['message' => 'You are not allowed to disable the API.'], 403);
} }
$settings = InstanceSettings::get(); $settings = \App\Models\InstanceSettings::get();
$settings->update(['is_api_enabled' => false]); $settings->update(['is_api_enabled' => false]);
return response()->json(['message' => 'API disabled.'], 200); return response()->json(['message' => 'API disabled.'], 200);

View File

@@ -4,7 +4,6 @@ namespace App\Http\Controllers\Api;
use App\Http\Controllers\Controller; use App\Http\Controllers\Controller;
use App\Models\Application; use App\Models\Application;
use App\Models\InstanceSettings;
use App\Models\Project; use App\Models\Project;
use App\Models\Server as ModelsServer; use App\Models\Server as ModelsServer;
use Illuminate\Http\Request; use Illuminate\Http\Request;
@@ -301,7 +300,7 @@ class ServersController extends Controller
$projects = Project::where('team_id', $teamId)->get(); $projects = Project::where('team_id', $teamId)->get();
$domains = collect(); $domains = collect();
$applications = $projects->pluck('applications')->flatten(); $applications = $projects->pluck('applications')->flatten();
$settings = InstanceSettings::get(); $settings = \App\Models\InstanceSettings::get();
if ($applications->count() > 0) { if ($applications->count() > 0) {
foreach ($applications as $application) { foreach ($applications as $application) {
$ip = $application->destination->server->ip; $ip = $application->destination->server->ip;

View File

@@ -2,7 +2,6 @@
namespace App\Http\Middleware; namespace App\Http\Middleware;
use App\Models\InstanceSettings;
use Closure; use Closure;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpFoundation\Response;
@@ -15,7 +14,7 @@ class ApiAllowed
if (isCloud()) { if (isCloud()) {
return $next($request); return $next($request);
} }
$settings = InstanceSettings::get(); $settings = \App\Models\InstanceSettings::get();
if ($settings->is_api_enabled === false) { if ($settings->is_api_enabled === false) {
return response()->json(['success' => true, 'message' => 'API is disabled.'], 403); return response()->json(['success' => true, 'message' => 'API is disabled.'], 403);
} }

View File

@@ -462,7 +462,7 @@ class ApplicationDeploymentJob implements ShouldBeEncrypted, ShouldQueue
if ($this->env_filename) { if ($this->env_filename) {
$command .= " --env-file {$this->workdir}/{$this->env_filename}"; $command .= " --env-file {$this->workdir}/{$this->env_filename}";
} }
$command .= " --project-directory {$this->workdir} -f {$this->workdir}{$this->docker_compose_location} build"; $command .= " --project-name {$this->application->uuid} --project-directory {$this->workdir} -f {$this->workdir}{$this->docker_compose_location} build";
$this->execute_remote_command( $this->execute_remote_command(
[executeInDocker($this->deployment_uuid, $command), 'hidden' => true], [executeInDocker($this->deployment_uuid, $command), 'hidden' => true],
); );
@@ -516,7 +516,7 @@ class ApplicationDeploymentJob implements ShouldBeEncrypted, ShouldQueue
if ($this->env_filename) { if ($this->env_filename) {
$command .= " --env-file {$this->workdir}/{$this->env_filename}"; $command .= " --env-file {$this->workdir}/{$this->env_filename}";
} }
$command .= " --project-directory {$this->workdir} -f {$this->workdir}{$this->docker_compose_location} up -d"; $command .= " --project-name {$this->application->uuid} --project-directory {$this->workdir} -f {$this->workdir}{$this->docker_compose_location} up -d";
$this->execute_remote_command( $this->execute_remote_command(
[executeInDocker($this->deployment_uuid, $command), 'hidden' => true], [executeInDocker($this->deployment_uuid, $command), 'hidden' => true],
); );
@@ -2034,12 +2034,12 @@ COPY ./nginx.conf /etc/nginx/conf.d/default.conf");
if ($this->application->build_pack === 'dockerimage') { if ($this->application->build_pack === 'dockerimage') {
$this->application_deployment_queue->addLogEntry('Pulling latest images from the registry.'); $this->application_deployment_queue->addLogEntry('Pulling latest images from the registry.');
$this->execute_remote_command( $this->execute_remote_command(
[executeInDocker($this->deployment_uuid, "docker compose --project-directory {$this->workdir} pull"), 'hidden' => true], [executeInDocker($this->deployment_uuid, "docker compose --project-name {$this->application->uuid} --project-directory {$this->workdir} pull"), 'hidden' => true],
[executeInDocker($this->deployment_uuid, "{$this->coolify_variables} docker compose --project-directory {$this->workdir} build"), 'hidden' => true], [executeInDocker($this->deployment_uuid, "{$this->coolify_variables} docker compose --project-name {$this->application->uuid} --project-directory {$this->workdir} build"), 'hidden' => true],
); );
} else { } else {
$this->execute_remote_command( $this->execute_remote_command(
[executeInDocker($this->deployment_uuid, "{$this->coolify_variables} docker compose --project-directory {$this->workdir} -f {$this->workdir}{$this->docker_compose_location} build"), 'hidden' => true], [executeInDocker($this->deployment_uuid, "{$this->coolify_variables} docker compose --project-name {$this->application->uuid} --project-directory {$this->workdir} -f {$this->workdir}{$this->docker_compose_location} build"), 'hidden' => true],
); );
} }
$this->application_deployment_queue->addLogEntry('New images built.'); $this->application_deployment_queue->addLogEntry('New images built.');
@@ -2050,17 +2050,17 @@ COPY ./nginx.conf /etc/nginx/conf.d/default.conf");
if ($this->application->build_pack === 'dockerimage') { if ($this->application->build_pack === 'dockerimage') {
$this->application_deployment_queue->addLogEntry('Pulling latest images from the registry.'); $this->application_deployment_queue->addLogEntry('Pulling latest images from the registry.');
$this->execute_remote_command( $this->execute_remote_command(
[executeInDocker($this->deployment_uuid, "docker compose --project-directory {$this->workdir} pull"), 'hidden' => true], [executeInDocker($this->deployment_uuid, "docker compose --project-name {$this->application->uuid} --project-directory {$this->workdir} pull"), 'hidden' => true],
[executeInDocker($this->deployment_uuid, "{$this->coolify_variables} docker compose --project-directory {$this->workdir} up --build -d"), 'hidden' => true], [executeInDocker($this->deployment_uuid, "{$this->coolify_variables} docker compose --project-name {$this->application->uuid} --project-directory {$this->workdir} up --build -d"), 'hidden' => true],
); );
} else { } else {
if ($this->use_build_server) { if ($this->use_build_server) {
$this->execute_remote_command( $this->execute_remote_command(
["{$this->coolify_variables} docker compose --project-directory {$this->configuration_dir} -f {$this->configuration_dir}{$this->docker_compose_location} up --build -d", 'hidden' => true], ["{$this->coolify_variables} docker compose --project-name {$this->application->uuid} --project-directory {$this->configuration_dir} -f {$this->configuration_dir}{$this->docker_compose_location} up --build -d", 'hidden' => true],
); );
} else { } else {
$this->execute_remote_command( $this->execute_remote_command(
[executeInDocker($this->deployment_uuid, "{$this->coolify_variables} docker compose --project-directory {$this->workdir} -f {$this->workdir}{$this->docker_compose_location} up --build -d"), 'hidden' => true], [executeInDocker($this->deployment_uuid, "{$this->coolify_variables} docker compose --project-name {$this->application->uuid} --project-directory {$this->workdir} -f {$this->workdir}{$this->docker_compose_location} up --build -d"), 'hidden' => true],
); );
} }
} }

View File

@@ -28,14 +28,18 @@ class DeleteResourceJob implements ShouldBeEncrypted, ShouldQueue
{ {
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels; use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
public function __construct(public Application|Service|StandalonePostgresql|StandaloneRedis|StandaloneMongodb|StandaloneMysql|StandaloneMariadb|StandaloneKeydb|StandaloneDragonfly|StandaloneClickhouse $resource, public bool $deleteConfigurations = false) {} public function __construct(
public Application|Service|StandalonePostgresql|StandaloneRedis|StandaloneMongodb|StandaloneMysql|StandaloneMariadb|StandaloneKeydb|StandaloneDragonfly|StandaloneClickhouse $resource,
public bool $deleteConfigurations = false,
public bool $deleteVolumes = false) {}
public function handle() public function handle()
{ {
try { try {
$this->resource->forceDelete(); $persistentStorages = collect();
switch ($this->resource->type()) { switch ($this->resource->type()) {
case 'application': case 'application':
$persistentStorages = $this->resource?->persistentStorages()?->get();
StopApplication::run($this->resource); StopApplication::run($this->resource);
break; break;
case 'standalone-postgresql': case 'standalone-postgresql':
@@ -46,6 +50,7 @@ class DeleteResourceJob implements ShouldBeEncrypted, ShouldQueue
case 'standalone-keydb': case 'standalone-keydb':
case 'standalone-dragonfly': case 'standalone-dragonfly':
case 'standalone-clickhouse': case 'standalone-clickhouse':
$persistentStorages = $this->resource?->persistentStorages()?->get();
StopDatabase::run($this->resource); StopDatabase::run($this->resource);
break; break;
case 'service': case 'service':
@@ -53,6 +58,10 @@ class DeleteResourceJob implements ShouldBeEncrypted, ShouldQueue
DeleteService::run($this->resource); DeleteService::run($this->resource);
break; break;
} }
if ($this->deleteVolumes && $this->resource->type() !== 'service') {
$this->resource?->delete_volumes($persistentStorages);
}
if ($this->deleteConfigurations) { if ($this->deleteConfigurations) {
$this->resource?->delete_configurations(); $this->resource?->delete_configurations();
} }
@@ -61,6 +70,7 @@ class DeleteResourceJob implements ShouldBeEncrypted, ShouldQueue
send_internal_notification('ContainerStoppingJob failed with: '.$e->getMessage()); send_internal_notification('ContainerStoppingJob failed with: '.$e->getMessage());
throw $e; throw $e;
} finally { } finally {
$this->resource->forceDelete();
Artisan::queue('cleanup:stucked-resources'); Artisan::queue('cleanup:stucked-resources');
} }
} }

View File

@@ -2,7 +2,6 @@
namespace App\Jobs; namespace App\Jobs;
use App\Models\InstanceSettings;
use App\Models\Server; use App\Models\Server;
use Illuminate\Bus\Queueable; use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldBeEncrypted; use Illuminate\Contracts\Queue\ShouldBeEncrypted;
@@ -36,7 +35,7 @@ class PullCoolifyImageJob implements ShouldBeEncrypted, ShouldQueue
$latest_version = get_latest_version_of_coolify(); $latest_version = get_latest_version_of_coolify();
instant_remote_process(["docker pull -q ghcr.io/coollabsio/coolify:{$latest_version}"], $server, false); instant_remote_process(["docker pull -q ghcr.io/coollabsio/coolify:{$latest_version}"], $server, false);
$settings = InstanceSettings::get(); $settings = \App\Models\InstanceSettings::get();
$current_version = config('version'); $current_version = config('version');
if (! $settings->is_auto_update_enabled) { if (! $settings->is_auto_update_enabled) {
return; return;

View File

@@ -2,7 +2,6 @@
namespace App\Livewire; namespace App\Livewire;
use App\Models\InstanceSettings;
use DanHarrin\LivewireRateLimiting\WithRateLimiting; use DanHarrin\LivewireRateLimiting\WithRateLimiting;
use Illuminate\Notifications\Messages\MailMessage; use Illuminate\Notifications\Messages\MailMessage;
use Illuminate\Support\Facades\Http; use Illuminate\Support\Facades\Http;
@@ -48,7 +47,7 @@ class Help extends Component
] ]
); );
$mail->subject("[HELP]: {$this->subject}"); $mail->subject("[HELP]: {$this->subject}");
$settings = InstanceSettings::get(); $settings = \App\Models\InstanceSettings::get();
$type = set_transanctional_email_settings($settings); $type = set_transanctional_email_settings($settings);
if (! $type) { if (! $type) {
$url = 'https://app.coolify.io/api/feedback'; $url = 'https://app.coolify.io/api/feedback';

View File

@@ -2,7 +2,6 @@
namespace App\Livewire\Notifications; namespace App\Livewire\Notifications;
use App\Models\InstanceSettings;
use App\Models\Team; use App\Models\Team;
use App\Notifications\Test; use App\Notifications\Test;
use Livewire\Component; use Livewire\Component;
@@ -173,7 +172,7 @@ class Email extends Component
public function copyFromInstanceSettings() public function copyFromInstanceSettings()
{ {
$settings = InstanceSettings::get(); $settings = \App\Models\InstanceSettings::get();
if ($settings->smtp_enabled) { if ($settings->smtp_enabled) {
$team = currentTeam(); $team = currentTeam();
$team->update([ $team->update([

View File

@@ -350,7 +350,6 @@ class General extends Component
$this->checkFqdns(); $this->checkFqdns();
$this->application->save(); $this->application->save();
if (! $this->customLabels && $this->application->destination->server->proxyType() !== 'NONE') { if (! $this->customLabels && $this->application->destination->server->proxyType() !== 'NONE') {
$this->customLabels = str(implode('|coolify|', generateLabelsApplication($this->application)))->replace('|coolify|', "\n"); $this->customLabels = str(implode('|coolify|', generateLabelsApplication($this->application)))->replace('|coolify|', "\n");
$this->application->custom_labels = base64_encode($this->customLabels); $this->application->custom_labels = base64_encode($this->customLabels);
@@ -364,6 +363,7 @@ class General extends Component
} }
} }
$this->validate(); $this->validate();
if ($this->ports_exposes !== $this->application->ports_exposes || $this->is_container_label_escape_enabled !== $this->application->settings->is_container_label_escape_enabled) { if ($this->ports_exposes !== $this->application->ports_exposes || $this->is_container_label_escape_enabled !== $this->application->settings->is_container_label_escape_enabled) {
$this->resetDefaultLabels(); $this->resetDefaultLabels();
} }
@@ -390,6 +390,7 @@ class General extends Component
} }
if ($this->application->build_pack === 'dockercompose') { if ($this->application->build_pack === 'dockercompose') {
$this->application->docker_compose_domains = json_encode($this->parsedServiceDomains); $this->application->docker_compose_domains = json_encode($this->parsedServiceDomains);
foreach ($this->parsedServiceDomains as $serviceName => $service) { foreach ($this->parsedServiceDomains as $serviceName => $service) {
$domain = data_get($service, 'domain'); $domain = data_get($service, 'domain');
if ($domain) { if ($domain) {
@@ -399,6 +400,9 @@ class General extends Component
check_domain_usage(resource: $this->application); check_domain_usage(resource: $this->application);
} }
} }
if ($this->application->isDirty('docker_compose_domains')) {
$this->resetDefaultLabels();
}
} }
$this->application->custom_labels = base64_encode($this->customLabels); $this->application->custom_labels = base64_encode($this->customLabels);
$this->application->save(); $this->application->save();

View File

@@ -16,6 +16,8 @@ class Danger extends Component
public bool $delete_configurations = true; public bool $delete_configurations = true;
public bool $delete_volumes = true;
public ?string $modalId = null; public ?string $modalId = null;
public function mount() public function mount()
@@ -31,7 +33,7 @@ class Danger extends Component
try { try {
// $this->authorize('delete', $this->resource); // $this->authorize('delete', $this->resource);
$this->resource->delete(); $this->resource->delete();
DeleteResourceJob::dispatch($this->resource, $this->delete_configurations); DeleteResourceJob::dispatch($this->resource, $this->delete_configurations, $this->delete_volumes);
return redirect()->route('project.resource.index', [ return redirect()->route('project.resource.index', [
'project_uuid' => $this->projectUuid, 'project_uuid' => $this->projectUuid,

View File

@@ -3,32 +3,63 @@
namespace App\Livewire\Project\Shared; namespace App\Livewire\Project\Shared;
use App\Models\Tag; use App\Models\Tag;
use Livewire\Attributes\Validate;
use Livewire\Component; use Livewire\Component;
// Refactored ✅
class Tags extends Component class Tags extends Component
{ {
public $resource = null; public $resource = null;
public ?string $new_tag = null; #[Validate('required|string|min:2')]
public string $newTags;
public $tags = []; public $tags = [];
protected $listeners = [ public $filteredTags = [];
'refresh' => '$refresh',
];
protected $rules = [
'resource.tags.*.name' => 'required|string|min:2',
'new_tag' => 'required|string|min:2',
];
protected $validationAttributes = [
'new_tag' => 'tag',
];
public function mount() public function mount()
{
$this->loadTags();
}
public function loadTags()
{ {
$this->tags = Tag::ownedByCurrentTeam()->get(); $this->tags = Tag::ownedByCurrentTeam()->get();
$this->filteredTags = $this->tags->filter(function ($tag) {
return ! $this->resource->tags->contains($tag);
});
}
public function submit()
{
try {
$this->validate();
$tags = str($this->newTags)->trim()->explode(' ');
foreach ($tags as $tag) {
if (strlen($tag) < 2) {
$this->dispatch('error', 'Invalid tag.', "Tag <span class='dark:text-warning'>$tag</span> is invalid. Min length is 2.");
continue;
}
if ($this->resource->tags()->where('name', $tag)->exists()) {
$this->dispatch('error', 'Duplicate tags.', "Tag <span class='dark:text-warning'>$tag</span> already added.");
continue;
}
$found = Tag::ownedByCurrentTeam()->where(['name' => $tag])->exists();
if (! $found) {
$found = Tag::create([
'name' => $tag,
'team_id' => currentTeam()->id,
]);
}
$this->resource->tags()->attach($found->id);
}
$this->refresh();
} catch (\Exception $e) {
return handleError($e, $this);
}
} }
public function addTag(string $id, string $name) public function addTag(string $id, string $name)
@@ -39,8 +70,9 @@ class Tags extends Component
return; return;
} }
$this->resource->tags()->syncWithoutDetaching($id); $this->resource->tags()->attach($id);
$this->refresh(); $this->refresh();
$this->dispatch('success', 'Tag added.');
} catch (\Exception $e) { } catch (\Exception $e) {
return handleError($e, $this); return handleError($e, $this);
} }
@@ -50,12 +82,12 @@ class Tags extends Component
{ {
try { try {
$this->resource->tags()->detach($id); $this->resource->tags()->detach($id);
$found_more_tags = Tag::ownedByCurrentTeam()->find($id);
$found_more_tags = Tag::where(['id' => $id, 'team_id' => currentTeam()->id])->first(); if ($found_more_tags && $found_more_tags->applications()->count() == 0 && $found_more_tags->services()->count() == 0) {
if ($found_more_tags->applications()->count() == 0 && $found_more_tags->services()->count() == 0) {
$found_more_tags->delete(); $found_more_tags->delete();
} }
$this->refresh(); $this->refresh();
$this->dispatch('success', 'Tag deleted.');
} catch (\Exception $e) { } catch (\Exception $e) {
return handleError($e, $this); return handleError($e, $this);
} }
@@ -63,41 +95,8 @@ class Tags extends Component
public function refresh() public function refresh()
{ {
$this->resource->load(['tags']); $this->resource->refresh(); // Remove this when legacy_model_binding is false
$this->tags = Tag::ownedByCurrentTeam()->get(); $this->loadTags();
$this->new_tag = null; $this->reset('newTags');
}
public function submit()
{
try {
$this->validate([
'new_tag' => 'required|string|min:2',
]);
$tags = str($this->new_tag)->trim()->explode(' ');
foreach ($tags as $tag) {
if ($this->resource->tags()->where('name', $tag)->exists()) {
$this->dispatch('error', 'Duplicate tags.', "Tag <span class='dark:text-warning'>$tag</span> already added.");
continue;
}
$found = Tag::where(['name' => $tag, 'team_id' => currentTeam()->id])->first();
if (! $found) {
$found = Tag::create([
'name' => $tag,
'team_id' => currentTeam()->id,
]);
}
$this->resource->tags()->syncWithoutDetaching($found->id);
}
$this->refresh();
} catch (\Exception $e) {
return handleError($e, $this);
}
}
public function render()
{
return view('livewire.project.shared.tags');
} }
} }

View File

@@ -4,49 +4,61 @@ namespace App\Livewire\Project\Shared;
use Livewire\Component; use Livewire\Component;
// Refactored ✅
class Webhooks extends Component class Webhooks extends Component
{ {
public $resource; public $resource;
public ?string $deploywebhook = null; public ?string $deploywebhook;
public ?string $githubManualWebhook = null; public ?string $githubManualWebhook;
public ?string $gitlabManualWebhook = null; public ?string $gitlabManualWebhook;
public ?string $bitbucketManualWebhook = null; public ?string $bitbucketManualWebhook;
public ?string $giteaManualWebhook = null; public ?string $giteaManualWebhook;
protected $rules = [ public ?string $githubManualWebhookSecret = null;
'resource.manual_webhook_secret_github' => 'nullable|string',
'resource.manual_webhook_secret_gitlab' => 'nullable|string',
'resource.manual_webhook_secret_bitbucket' => 'nullable|string',
'resource.manual_webhook_secret_gitea' => 'nullable|string',
];
public function saveSecret() public ?string $gitlabManualWebhookSecret = null;
public ?string $bitbucketManualWebhookSecret = null;
public ?string $giteaManualWebhookSecret = null;
public function mount()
{
// ray()->clearAll();
// ray()->showQueries();
$this->deploywebhook = generateDeployWebhook($this->resource);
$this->githubManualWebhookSecret = data_get($this->resource, 'manual_webhook_secret_github');
$this->githubManualWebhook = generateGitManualWebhook($this->resource, 'github');
$this->gitlabManualWebhookSecret = data_get($this->resource, 'manual_webhook_secret_gitlab');
$this->gitlabManualWebhook = generateGitManualWebhook($this->resource, 'gitlab');
$this->bitbucketManualWebhookSecret = data_get($this->resource, 'manual_webhook_secret_bitbucket');
$this->bitbucketManualWebhook = generateGitManualWebhook($this->resource, 'bitbucket');
$this->giteaManualWebhookSecret = data_get($this->resource, 'manual_webhook_secret_gitea');
$this->giteaManualWebhook = generateGitManualWebhook($this->resource, 'gitea');
}
public function submit()
{ {
try { try {
$this->validate(); $this->authorize('update', $this->resource);
$this->resource->save(); $this->resource->update([
'manual_webhook_secret_github' => $this->githubManualWebhookSecret,
'manual_webhook_secret_gitlab' => $this->gitlabManualWebhookSecret,
'manual_webhook_secret_bitbucket' => $this->bitbucketManualWebhookSecret,
'manual_webhook_secret_gitea' => $this->giteaManualWebhookSecret,
]);
$this->dispatch('success', 'Secret Saved.'); $this->dispatch('success', 'Secret Saved.');
} catch (\Exception $e) { } catch (\Exception $e) {
return handleError($e, $this); return handleError($e, $this);
} }
} }
public function mount()
{
$this->deploywebhook = generateDeployWebhook($this->resource);
$this->githubManualWebhook = generateGitManualWebhook($this->resource, 'github');
$this->gitlabManualWebhook = generateGitManualWebhook($this->resource, 'gitlab');
$this->bitbucketManualWebhook = generateGitManualWebhook($this->resource, 'bitbucket');
$this->giteaManualWebhook = generateGitManualWebhook($this->resource, 'gitea');
}
public function render()
{
return view('livewire.project.shared.webhooks');
}
} }

View File

@@ -18,7 +18,7 @@ class Index extends Component
public function mount() public function mount()
{ {
if (isInstanceAdmin()) { if (isInstanceAdmin()) {
$settings = InstanceSettings::get(); $settings = \App\Models\InstanceSettings::get();
$database = StandalonePostgresql::whereName('coolify-db')->first(); $database = StandalonePostgresql::whereName('coolify-db')->first();
$s3s = S3Storage::whereTeamId(0)->get() ?? []; $s3s = S3Storage::whereTeamId(0)->get() ?? [];
if ($database) { if ($database) {

View File

@@ -29,7 +29,7 @@ class License extends Component
abort(404); abort(404);
} }
$this->instance_id = config('app.id'); $this->instance_id = config('app.id');
$this->settings = InstanceSettings::get(); $this->settings = \App\Models\InstanceSettings::get();
} }
public function render() public function render()

View File

@@ -4,7 +4,6 @@ namespace App\Livewire\Source\Github;
use App\Jobs\GithubAppPermissionJob; use App\Jobs\GithubAppPermissionJob;
use App\Models\GithubApp; use App\Models\GithubApp;
use App\Models\InstanceSettings;
use Illuminate\Support\Facades\Http; use Illuminate\Support\Facades\Http;
use Livewire\Component; use Livewire\Component;
@@ -100,7 +99,7 @@ class Change extends Component
return redirect()->route('source.all'); return redirect()->route('source.all');
} }
$this->applications = $this->github_app->applications; $this->applications = $this->github_app->applications;
$settings = InstanceSettings::get(); $settings = \App\Models\InstanceSettings::get();
$this->github_app->makeVisible('client_secret')->makeVisible('webhook_secret'); $this->github_app->makeVisible('client_secret')->makeVisible('webhook_secret');
$this->name = str($this->github_app->name)->kebab(); $this->name = str($this->github_app->name)->kebab();

View File

@@ -23,7 +23,7 @@ class Index extends Component
if (data_get(currentTeam(), 'subscription') && isSubscriptionActive()) { if (data_get(currentTeam(), 'subscription') && isSubscriptionActive()) {
return redirect()->route('subscription.show'); return redirect()->route('subscription.show');
} }
$this->settings = InstanceSettings::get(); $this->settings = \App\Models\InstanceSettings::get();
$this->alreadySubscribed = currentTeam()->subscription()->exists(); $this->alreadySubscribed = currentTeam()->subscription()->exists();
} }

View File

@@ -94,6 +94,7 @@ use Visus\Cuid2\Cuid2;
'created_at' => ['type' => 'string', 'format' => 'date-time', 'description' => 'The date and time when the application was created.'], 'created_at' => ['type' => 'string', 'format' => 'date-time', 'description' => 'The date and time when the application was created.'],
'updated_at' => ['type' => 'string', 'format' => 'date-time', 'description' => 'The date and time when the application was last updated.'], 'updated_at' => ['type' => 'string', 'format' => 'date-time', 'description' => 'The date and time when the application was last updated.'],
'deleted_at' => ['type' => 'string', 'format' => 'date-time', 'nullable' => true, 'description' => 'The date and time when the application was deleted.'], 'deleted_at' => ['type' => 'string', 'format' => 'date-time', 'nullable' => true, 'description' => 'The date and time when the application was deleted.'],
'compose_parsing_version' => ['type' => 'string', 'description' => 'How Coolify parse the compose file.'],
] ]
)] )]
@@ -122,17 +123,12 @@ class Application extends BaseModel
ApplicationSetting::create([ ApplicationSetting::create([
'application_id' => $application->id, 'application_id' => $application->id,
]); ]);
$application->compose_parsing_version = '2';
$application->save();
}); });
static::deleting(function ($application) { static::forceDeleting(function ($application) {
$application->update(['fqdn' => null]); $application->update(['fqdn' => null]);
$application->settings()->delete(); $application->settings()->delete();
$storages = $application->persistentStorages()->get();
$server = data_get($application, 'destination.server');
if ($server) {
foreach ($storages as $storage) {
instant_remote_process(["docker volume rm -f $storage->name"], $server, false);
}
}
$application->persistentStorages()->delete(); $application->persistentStorages()->delete();
$application->environment_variables()->delete(); $application->environment_variables()->delete();
$application->environment_variables_preview()->delete(); $application->environment_variables_preview()->delete();
@@ -158,6 +154,23 @@ class Application extends BaseModel
} }
} }
public function delete_volumes(?Collection $persistentStorages)
{
if ($this->build_pack === 'dockercompose') {
$server = data_get($this, 'destination.server');
ray('Deleting volumes');
instant_remote_process(["cd {$this->dirOnServer()} && docker compose down -v"], $server, false);
} else {
if ($persistentStorages->count() === 0) {
return;
}
$server = data_get($this, 'destination.server');
foreach ($persistentStorages as $storage) {
instant_remote_process(["docker volume rm -f $storage->name"], $server, false);
}
}
}
public function additional_servers() public function additional_servers()
{ {
return $this->belongsToMany(Server::class, 'additional_destinations') return $this->belongsToMany(Server::class, 'additional_destinations')
@@ -775,6 +788,11 @@ class Application extends BaseModel
return "/artifacts/{$uuid}"; return "/artifacts/{$uuid}";
} }
public function dirOnServer()
{
return application_configuration_dir()."/{$this->uuid}";
}
public function setGitImportSettings(string $deployment_uuid, string $git_clone_command, bool $public = false) public function setGitImportSettings(string $deployment_uuid, string $git_clone_command, bool $public = false)
{ {
$baseDir = $this->generateBaseDir($deployment_uuid); $baseDir = $this->generateBaseDir($deployment_uuid);
@@ -897,7 +915,7 @@ class Application extends BaseModel
$commands->push("echo 'Checking out $branch'"); $commands->push("echo 'Checking out $branch'");
} }
$git_clone_command = "{$git_clone_command} && cd {$baseDir} && GIT_SSH_COMMAND=\"ssh -o ConnectTimeout=30 -p {$customPort} -o Port={$customPort} -o LogLevel=ERROR -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -i /root/.ssh/id_rsa\" git fetch origin $branch && ".$this->buildGitCheckoutCommand($pr_branch_name); $git_clone_command = "{$git_clone_command} && cd {$baseDir} && GIT_SSH_COMMAND=\"ssh -o ConnectTimeout=30 -p {$customPort} -o Port={$customPort} -o LogLevel=ERROR -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -i /root/.ssh/id_rsa\" git fetch origin $branch && ".$this->buildGitCheckoutCommand($pr_branch_name);
} elseif ($git_type === 'github') { } elseif ($git_type === 'github' || $git_type === 'gitea') {
$branch = "pull/{$pull_request_id}/head:$pr_branch_name"; $branch = "pull/{$pull_request_id}/head:$pr_branch_name";
if ($exec_in_docker) { if ($exec_in_docker) {
$commands->push(executeInDocker($deployment_uuid, "echo 'Checking out $branch'")); $commands->push(executeInDocker($deployment_uuid, "echo 'Checking out $branch'"));
@@ -941,7 +959,7 @@ class Application extends BaseModel
$commands->push("echo 'Checking out $branch'"); $commands->push("echo 'Checking out $branch'");
} }
$git_clone_command = "{$git_clone_command} && cd {$baseDir} && GIT_SSH_COMMAND=\"ssh -o ConnectTimeout=30 -p {$customPort} -o Port={$customPort} -o LogLevel=ERROR -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -i /root/.ssh/id_rsa\" git fetch origin $branch && ".$this->buildGitCheckoutCommand($pr_branch_name); $git_clone_command = "{$git_clone_command} && cd {$baseDir} && GIT_SSH_COMMAND=\"ssh -o ConnectTimeout=30 -p {$customPort} -o Port={$customPort} -o LogLevel=ERROR -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -i /root/.ssh/id_rsa\" git fetch origin $branch && ".$this->buildGitCheckoutCommand($pr_branch_name);
} elseif ($git_type === 'github') { } elseif ($git_type === 'github' || $git_type === 'gitea') {
$branch = "pull/{$pull_request_id}/head:$pr_branch_name"; $branch = "pull/{$pull_request_id}/head:$pr_branch_name";
if ($exec_in_docker) { if ($exec_in_docker) {
$commands->push(executeInDocker($deployment_uuid, "echo 'Checking out $branch'")); $commands->push(executeInDocker($deployment_uuid, "echo 'Checking out $branch'"));

View File

@@ -318,11 +318,11 @@ respond 404
public function setupDynamicProxyConfiguration() public function setupDynamicProxyConfiguration()
{ {
$settings = InstanceSettings::get(); $settings = \App\Models\InstanceSettings::get();
$dynamic_config_path = $this->proxyPath().'/dynamic'; $dynamic_config_path = $this->proxyPath().'/dynamic';
if ($this->proxyType() === 'TRAEFIK_V2') { if ($this->proxyType() === 'TRAEFIK_V2') {
$file = "$dynamic_config_path/coolify.yaml"; $file = "$dynamic_config_path/coolify.yaml";
if (empty($settings->fqdn) || (isCloud() && $this->id !== 0)) { if (empty($settings->fqdn) || (isCloud() && $this->id !== 0) || ! $this->isLocalhost()) {
instant_remote_process([ instant_remote_process([
"rm -f $file", "rm -f $file",
], $this); ], $this);
@@ -428,7 +428,7 @@ respond 404
} }
} elseif ($this->proxyType() === 'CADDY') { } elseif ($this->proxyType() === 'CADDY') {
$file = "$dynamic_config_path/coolify.caddy"; $file = "$dynamic_config_path/coolify.caddy";
if (empty($settings->fqdn) || (isCloud() && $this->id !== 0)) { if (empty($settings->fqdn) || (isCloud() && $this->id !== 0) || ! $this->isLocalhost()) {
instant_remote_process([ instant_remote_process([
"rm -f $file", "rm -f $file",
], $this); ], $this);

View File

@@ -3,6 +3,7 @@
namespace App\Models; namespace App\Models;
use Illuminate\Database\Eloquent\Casts\Attribute; use Illuminate\Database\Eloquent\Casts\Attribute;
use Illuminate\Database\Eloquent\Collection;
use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Relations\HasMany; use Illuminate\Database\Eloquent\Relations\HasMany;
use Illuminate\Database\Eloquent\SoftDeletes; use Illuminate\Database\Eloquent\SoftDeletes;
@@ -31,16 +32,9 @@ class StandaloneClickhouse extends BaseModel
'is_readonly' => true, 'is_readonly' => true,
]); ]);
}); });
static::deleting(function ($database) { static::forceDeleting(function ($database) {
$storages = $database->persistentStorages()->get();
$server = data_get($database, 'destination.server');
if ($server) {
foreach ($storages as $storage) {
instant_remote_process(["docker volume rm -f $storage->name"], $server, false);
}
}
$database->scheduledBackups()->delete();
$database->persistentStorages()->delete(); $database->persistentStorages()->delete();
$database->scheduledBackups()->delete();
$database->environment_variables()->delete(); $database->environment_variables()->delete();
$database->tags()->detach(); $database->tags()->detach();
}); });
@@ -91,6 +85,17 @@ class StandaloneClickhouse extends BaseModel
} }
} }
public function delete_volumes(Collection $persistentStorages)
{
if ($persistentStorages->count() === 0) {
return;
}
$server = data_get($this, 'destination.server');
foreach ($persistentStorages as $storage) {
instant_remote_process(["docker volume rm -f $storage->name"], $server, false);
}
}
public function realStatus() public function realStatus()
{ {
return $this->getRawOriginal('status'); return $this->getRawOriginal('status');

View File

@@ -3,6 +3,7 @@
namespace App\Models; namespace App\Models;
use Illuminate\Database\Eloquent\Casts\Attribute; use Illuminate\Database\Eloquent\Casts\Attribute;
use Illuminate\Database\Eloquent\Collection;
use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Relations\HasMany; use Illuminate\Database\Eloquent\Relations\HasMany;
use Illuminate\Database\Eloquent\SoftDeletes; use Illuminate\Database\Eloquent\SoftDeletes;
@@ -31,16 +32,9 @@ class StandaloneDragonfly extends BaseModel
'is_readonly' => true, 'is_readonly' => true,
]); ]);
}); });
static::deleting(function ($database) { static::forceDeleting(function ($database) {
$database->scheduledBackups()->delete();
$storages = $database->persistentStorages()->get();
$server = data_get($database, 'destination.server');
if ($server) {
foreach ($storages as $storage) {
instant_remote_process(["docker volume rm -f $storage->name"], $server, false);
}
}
$database->persistentStorages()->delete(); $database->persistentStorages()->delete();
$database->scheduledBackups()->delete();
$database->environment_variables()->delete(); $database->environment_variables()->delete();
$database->tags()->detach(); $database->tags()->detach();
}); });
@@ -91,6 +85,17 @@ class StandaloneDragonfly extends BaseModel
} }
} }
public function delete_volumes(Collection $persistentStorages)
{
if ($persistentStorages->count() === 0) {
return;
}
$server = data_get($this, 'destination.server');
foreach ($persistentStorages as $storage) {
instant_remote_process(["docker volume rm -f $storage->name"], $server, false);
}
}
public function realStatus() public function realStatus()
{ {
return $this->getRawOriginal('status'); return $this->getRawOriginal('status');

View File

@@ -3,6 +3,7 @@
namespace App\Models; namespace App\Models;
use Illuminate\Database\Eloquent\Casts\Attribute; use Illuminate\Database\Eloquent\Casts\Attribute;
use Illuminate\Database\Eloquent\Collection;
use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Relations\HasMany; use Illuminate\Database\Eloquent\Relations\HasMany;
use Illuminate\Database\Eloquent\SoftDeletes; use Illuminate\Database\Eloquent\SoftDeletes;
@@ -31,16 +32,9 @@ class StandaloneKeydb extends BaseModel
'is_readonly' => true, 'is_readonly' => true,
]); ]);
}); });
static::deleting(function ($database) { static::forceDeleting(function ($database) {
$database->scheduledBackups()->delete();
$storages = $database->persistentStorages()->get();
$server = data_get($database, 'destination.server');
if ($server) {
foreach ($storages as $storage) {
instant_remote_process(["docker volume rm -f $storage->name"], $server, false);
}
}
$database->persistentStorages()->delete(); $database->persistentStorages()->delete();
$database->scheduledBackups()->delete();
$database->environment_variables()->delete(); $database->environment_variables()->delete();
$database->tags()->detach(); $database->tags()->detach();
}); });
@@ -91,6 +85,17 @@ class StandaloneKeydb extends BaseModel
} }
} }
public function delete_volumes(Collection $persistentStorages)
{
if ($persistentStorages->count() === 0) {
return;
}
$server = data_get($this, 'destination.server');
foreach ($persistentStorages as $storage) {
instant_remote_process(["docker volume rm -f $storage->name"], $server, false);
}
}
public function realStatus() public function realStatus()
{ {
return $this->getRawOriginal('status'); return $this->getRawOriginal('status');

View File

@@ -3,6 +3,7 @@
namespace App\Models; namespace App\Models;
use Illuminate\Database\Eloquent\Casts\Attribute; use Illuminate\Database\Eloquent\Casts\Attribute;
use Illuminate\Database\Eloquent\Collection;
use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Relations\HasMany; use Illuminate\Database\Eloquent\Relations\HasMany;
use Illuminate\Database\Eloquent\SoftDeletes; use Illuminate\Database\Eloquent\SoftDeletes;
@@ -31,16 +32,9 @@ class StandaloneMariadb extends BaseModel
'is_readonly' => true, 'is_readonly' => true,
]); ]);
}); });
static::deleting(function ($database) { static::forceDeleting(function ($database) {
$storages = $database->persistentStorages()->get();
$server = data_get($database, 'destination.server');
if ($server) {
foreach ($storages as $storage) {
instant_remote_process(["docker volume rm -f $storage->name"], $server, false);
}
}
$database->scheduledBackups()->delete();
$database->persistentStorages()->delete(); $database->persistentStorages()->delete();
$database->scheduledBackups()->delete();
$database->environment_variables()->delete(); $database->environment_variables()->delete();
$database->tags()->detach(); $database->tags()->detach();
}); });
@@ -91,6 +85,17 @@ class StandaloneMariadb extends BaseModel
} }
} }
public function delete_volumes(Collection $persistentStorages)
{
if ($persistentStorages->count() === 0) {
return;
}
$server = data_get($this, 'destination.server');
foreach ($persistentStorages as $storage) {
instant_remote_process(["docker volume rm -f $storage->name"], $server, false);
}
}
public function realStatus() public function realStatus()
{ {
return $this->getRawOriginal('status'); return $this->getRawOriginal('status');

View File

@@ -3,6 +3,7 @@
namespace App\Models; namespace App\Models;
use Illuminate\Database\Eloquent\Casts\Attribute; use Illuminate\Database\Eloquent\Casts\Attribute;
use Illuminate\Database\Eloquent\Collection;
use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Relations\HasMany; use Illuminate\Database\Eloquent\Relations\HasMany;
use Illuminate\Database\Eloquent\SoftDeletes; use Illuminate\Database\Eloquent\SoftDeletes;
@@ -35,16 +36,9 @@ class StandaloneMongodb extends BaseModel
'is_readonly' => true, 'is_readonly' => true,
]); ]);
}); });
static::deleting(function ($database) { static::forceDeleting(function ($database) {
$storages = $database->persistentStorages()->get();
$server = data_get($database, 'destination.server');
if ($server) {
foreach ($storages as $storage) {
instant_remote_process(["docker volume rm -f $storage->name"], $server, false);
}
}
$database->scheduledBackups()->delete();
$database->persistentStorages()->delete(); $database->persistentStorages()->delete();
$database->scheduledBackups()->delete();
$database->environment_variables()->delete(); $database->environment_variables()->delete();
$database->tags()->detach(); $database->tags()->detach();
}); });
@@ -95,6 +89,17 @@ class StandaloneMongodb extends BaseModel
} }
} }
public function delete_volumes(Collection $persistentStorages)
{
if ($persistentStorages->count() === 0) {
return;
}
$server = data_get($this, 'destination.server');
foreach ($persistentStorages as $storage) {
instant_remote_process(["docker volume rm -f $storage->name"], $server, false);
}
}
public function realStatus() public function realStatus()
{ {
return $this->getRawOriginal('status'); return $this->getRawOriginal('status');

View File

@@ -3,6 +3,7 @@
namespace App\Models; namespace App\Models;
use Illuminate\Database\Eloquent\Casts\Attribute; use Illuminate\Database\Eloquent\Casts\Attribute;
use Illuminate\Database\Eloquent\Collection;
use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Relations\HasMany; use Illuminate\Database\Eloquent\Relations\HasMany;
use Illuminate\Database\Eloquent\SoftDeletes; use Illuminate\Database\Eloquent\SoftDeletes;
@@ -32,16 +33,9 @@ class StandaloneMysql extends BaseModel
'is_readonly' => true, 'is_readonly' => true,
]); ]);
}); });
static::deleting(function ($database) { static::forceDeleting(function ($database) {
$storages = $database->persistentStorages()->get();
$server = data_get($database, 'destination.server');
if ($server) {
foreach ($storages as $storage) {
instant_remote_process(["docker volume rm -f $storage->name"], $server, false);
}
}
$database->scheduledBackups()->delete();
$database->persistentStorages()->delete(); $database->persistentStorages()->delete();
$database->scheduledBackups()->delete();
$database->environment_variables()->delete(); $database->environment_variables()->delete();
$database->tags()->detach(); $database->tags()->detach();
}); });
@@ -92,6 +86,17 @@ class StandaloneMysql extends BaseModel
} }
} }
public function delete_volumes(Collection $persistentStorages)
{
if ($persistentStorages->count() === 0) {
return;
}
$server = data_get($this, 'destination.server');
foreach ($persistentStorages as $storage) {
instant_remote_process(["docker volume rm -f $storage->name"], $server, false);
}
}
public function realStatus() public function realStatus()
{ {
return $this->getRawOriginal('status'); return $this->getRawOriginal('status');

View File

@@ -3,6 +3,7 @@
namespace App\Models; namespace App\Models;
use Illuminate\Database\Eloquent\Casts\Attribute; use Illuminate\Database\Eloquent\Casts\Attribute;
use Illuminate\Database\Eloquent\Collection;
use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Relations\HasMany; use Illuminate\Database\Eloquent\Relations\HasMany;
use Illuminate\Database\Eloquent\SoftDeletes; use Illuminate\Database\Eloquent\SoftDeletes;
@@ -32,16 +33,9 @@ class StandalonePostgresql extends BaseModel
'is_readonly' => true, 'is_readonly' => true,
]); ]);
}); });
static::deleting(function ($database) { static::forceDeleting(function ($database) {
$storages = $database->persistentStorages()->get();
$server = data_get($database, 'destination.server');
if ($server) {
foreach ($storages as $storage) {
instant_remote_process(["docker volume rm -f $storage->name"], $server, false);
}
}
$database->scheduledBackups()->delete();
$database->persistentStorages()->delete(); $database->persistentStorages()->delete();
$database->scheduledBackups()->delete();
$database->environment_variables()->delete(); $database->environment_variables()->delete();
$database->tags()->detach(); $database->tags()->detach();
}); });
@@ -61,6 +55,18 @@ class StandalonePostgresql extends BaseModel
} }
} }
public function delete_volumes(Collection $persistentStorages)
{
if ($persistentStorages->count() === 0) {
return;
}
$server = data_get($this, 'destination.server');
foreach ($persistentStorages as $storage) {
ray('Deleting volume: '.$storage->name);
instant_remote_process(["docker volume rm -f $storage->name"], $server, false);
}
}
public function isConfigurationChanged(bool $save = false) public function isConfigurationChanged(bool $save = false)
{ {
$newConfigHash = $this->image.$this->ports_mappings.$this->postgres_initdb_args.$this->postgres_host_auth_method; $newConfigHash = $this->image.$this->ports_mappings.$this->postgres_initdb_args.$this->postgres_host_auth_method;

View File

@@ -3,6 +3,7 @@
namespace App\Models; namespace App\Models;
use Illuminate\Database\Eloquent\Casts\Attribute; use Illuminate\Database\Eloquent\Casts\Attribute;
use Illuminate\Database\Eloquent\Collection;
use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Relations\HasMany; use Illuminate\Database\Eloquent\Relations\HasMany;
use Illuminate\Database\Eloquent\SoftDeletes; use Illuminate\Database\Eloquent\SoftDeletes;
@@ -27,16 +28,9 @@ class StandaloneRedis extends BaseModel
'is_readonly' => true, 'is_readonly' => true,
]); ]);
}); });
static::deleting(function ($database) { static::forceDeleting(function ($database) {
$database->scheduledBackups()->delete();
$storages = $database->persistentStorages()->get();
$server = data_get($database, 'destination.server');
if ($server) {
foreach ($storages as $storage) {
instant_remote_process(["docker volume rm -f $storage->name"], $server, false);
}
}
$database->persistentStorages()->delete(); $database->persistentStorages()->delete();
$database->scheduledBackups()->delete();
$database->environment_variables()->delete(); $database->environment_variables()->delete();
$database->tags()->detach(); $database->tags()->detach();
}); });
@@ -87,6 +81,17 @@ class StandaloneRedis extends BaseModel
} }
} }
public function delete_volumes(Collection $persistentStorages)
{
if ($persistentStorages->count() === 0) {
return;
}
$server = data_get($this, 'destination.server');
foreach ($persistentStorages as $storage) {
instant_remote_process(["docker volume rm -f $storage->name"], $server, false);
}
}
public function realStatus() public function realStatus()
{ {
return $this->getRawOriginal('status'); return $this->getRawOriginal('status');

View File

@@ -2,7 +2,6 @@
namespace App\Notifications\Channels; namespace App\Notifications\Channels;
use App\Models\InstanceSettings;
use App\Models\User; use App\Models\User;
use Exception; use Exception;
use Illuminate\Mail\Message; use Illuminate\Mail\Message;
@@ -14,7 +13,7 @@ class TransactionalEmailChannel
{ {
public function send(User $notifiable, Notification $notification): void public function send(User $notifiable, Notification $notification): void
{ {
$settings = InstanceSettings::get(); $settings = \App\Models\InstanceSettings::get();
if (! data_get($settings, 'smtp_enabled') && ! data_get($settings, 'resend_enabled')) { if (! data_get($settings, 'smtp_enabled') && ! data_get($settings, 'resend_enabled')) {
Log::info('SMTP/Resend not enabled'); Log::info('SMTP/Resend not enabled');

View File

@@ -18,7 +18,7 @@ class ResetPassword extends Notification
public function __construct($token) public function __construct($token)
{ {
$this->settings = InstanceSettings::get(); $this->settings = \App\Models\InstanceSettings::get();
$this->token = $token; $this->token = $token;
} }

View File

@@ -2,8 +2,10 @@
namespace App\Providers; namespace App\Providers;
use App\Models\InstanceSettings;
use App\Models\PersonalAccessToken; use App\Models\PersonalAccessToken;
use Illuminate\Support\Facades\Http; use Illuminate\Support\Facades\Http;
use Illuminate\Support\Facades\View;
use Illuminate\Support\ServiceProvider; use Illuminate\Support\ServiceProvider;
use Laravel\Sanctum\Sanctum; use Laravel\Sanctum\Sanctum;
@@ -14,6 +16,7 @@ class AppServiceProvider extends ServiceProvider
public function boot(): void public function boot(): void
{ {
Sanctum::usePersonalAccessTokenModel(PersonalAccessToken::class); Sanctum::usePersonalAccessTokenModel(PersonalAccessToken::class);
Http::macro('github', function (string $api_url, ?string $github_access_token = null) { Http::macro('github', function (string $api_url, ?string $github_access_token = null) {
if ($github_access_token) { if ($github_access_token) {
return Http::withHeaders([ return Http::withHeaders([
@@ -27,5 +30,9 @@ class AppServiceProvider extends ServiceProvider
])->baseUrl($api_url); ])->baseUrl($api_url);
} }
}); });
// if (! env('CI')) {
// View::share('instanceSettings', InstanceSettings::get());
// }
} }
} }

View File

@@ -6,7 +6,6 @@ use App\Actions\Fortify\CreateNewUser;
use App\Actions\Fortify\ResetUserPassword; use App\Actions\Fortify\ResetUserPassword;
use App\Actions\Fortify\UpdateUserPassword; use App\Actions\Fortify\UpdateUserPassword;
use App\Actions\Fortify\UpdateUserProfileInformation; use App\Actions\Fortify\UpdateUserProfileInformation;
use App\Models\InstanceSettings;
use App\Models\OauthSetting; use App\Models\OauthSetting;
use App\Models\User; use App\Models\User;
use Illuminate\Cache\RateLimiting\Limit; use Illuminate\Cache\RateLimiting\Limit;
@@ -45,7 +44,7 @@ class FortifyServiceProvider extends ServiceProvider
{ {
Fortify::createUsersUsing(CreateNewUser::class); Fortify::createUsersUsing(CreateNewUser::class);
Fortify::registerView(function () { Fortify::registerView(function () {
$settings = InstanceSettings::get(); $settings = \App\Models\InstanceSettings::get();
if (! $settings->is_registration_enabled) { if (! $settings->is_registration_enabled) {
return redirect()->route('login'); return redirect()->route('login');
} }
@@ -57,7 +56,7 @@ class FortifyServiceProvider extends ServiceProvider
}); });
Fortify::loginView(function () { Fortify::loginView(function () {
$settings = InstanceSettings::get(); $settings = \App\Models\InstanceSettings::get();
$enabled_oauth_providers = OauthSetting::where('enabled', true)->get(); $enabled_oauth_providers = OauthSetting::where('enabled', true)->get();
$users = User::count(); $users = User::count();
if ($users == 0) { if ($users == 0) {

View File

@@ -40,6 +40,7 @@ const SUPPORTED_OS = [
'ubuntu debian raspbian', 'ubuntu debian raspbian',
'centos fedora rhel ol rocky amzn almalinux', 'centos fedora rhel ol rocky amzn almalinux',
'sles opensuse-leap opensuse-tumbleweed', 'sles opensuse-leap opensuse-tumbleweed',
'arch',
]; ];
const SHARED_VARIABLE_TYPES = ['team', 'project', 'environment']; const SHARED_VARIABLE_TYPES = ['team', 'project', 'environment'];

View File

@@ -5,7 +5,24 @@ use App\Models\Application;
use App\Models\Server; use App\Models\Server;
use Symfony\Component\Yaml\Yaml; use Symfony\Component\Yaml\Yaml;
function connectProxyToNetworks(Server $server) function collectProxyDockerNetworksByServer(Server $server)
{
if (! $server->isFunctional()) {
return collect();
}
$proxyType = $server->proxyType();
if (is_null($proxyType) || $proxyType === 'NONE') {
return collect();
}
$networks = instant_remote_process(['docker inspect --format="{{json .NetworkSettings.Networks }}" coolify-proxy'], $server, false);
$networks = collect($networks)->map(function ($network) {
return collect(json_decode($network))->keys();
})->flatten()->unique();
return $networks;
}
function collectDockerNetworksByServer(Server $server)
{ {
if ($server->isSwarm()) { if ($server->isSwarm()) {
$networks = collect($server->swarmDockers)->map(function ($docker) { $networks = collect($server->swarmDockers)->map(function ($docker) {
@@ -43,6 +60,18 @@ function connectProxyToNetworks(Server $server)
if ($networks->count() === 0) { if ($networks->count() === 0) {
$networks = collect(['coolify-overlay']); $networks = collect(['coolify-overlay']);
} }
} else {
if ($networks->count() === 0) {
$networks = collect(['coolify']);
}
}
return $networks;
}
function connectProxyToNetworks(Server $server)
{
$networks = collectDockerNetworksByServer($server);
if ($server->isSwarm()) {
$commands = $networks->map(function ($network) { $commands = $networks->map(function ($network) {
return [ return [
"echo 'Connecting coolify-proxy to $network network...'", "echo 'Connecting coolify-proxy to $network network...'",
@@ -51,9 +80,6 @@ function connectProxyToNetworks(Server $server)
]; ];
}); });
} else { } else {
if ($networks->count() === 0) {
$networks = collect(['coolify']);
}
$commands = $networks->map(function ($network) { $commands = $networks->map(function ($network) {
return [ return [
"echo 'Connecting coolify-proxy to $network network...'", "echo 'Connecting coolify-proxy to $network network...'",

View File

@@ -244,13 +244,13 @@ function generate_application_name(string $git_repository, string $git_branch, ?
function is_transactional_emails_active(): bool function is_transactional_emails_active(): bool
{ {
return isEmailEnabled(InstanceSettings::get()); return isEmailEnabled(\App\Models\InstanceSettings::get());
} }
function set_transanctional_email_settings(?InstanceSettings $settings = null): ?string function set_transanctional_email_settings(?InstanceSettings $settings = null): ?string
{ {
if (! $settings) { if (! $settings) {
$settings = InstanceSettings::get(); $settings = \App\Models\InstanceSettings::get();
} }
config()->set('mail.from.address', data_get($settings, 'smtp_from_address')); config()->set('mail.from.address', data_get($settings, 'smtp_from_address'));
config()->set('mail.from.name', data_get($settings, 'smtp_from_name')); config()->set('mail.from.name', data_get($settings, 'smtp_from_name'));
@@ -284,7 +284,7 @@ function base_ip(): string
if (isDev()) { if (isDev()) {
return 'localhost'; return 'localhost';
} }
$settings = InstanceSettings::get(); $settings = \App\Models\InstanceSettings::get();
if ($settings->public_ipv4) { if ($settings->public_ipv4) {
return "$settings->public_ipv4"; return "$settings->public_ipv4";
} }
@@ -312,7 +312,7 @@ function getFqdnWithoutPort(string $fqdn)
*/ */
function base_url(bool $withPort = true): string function base_url(bool $withPort = true): string
{ {
$settings = InstanceSettings::get(); $settings = \App\Models\InstanceSettings::get();
if ($settings->fqdn) { if ($settings->fqdn) {
return $settings->fqdn; return $settings->fqdn;
} }
@@ -379,7 +379,7 @@ function send_internal_notification(string $message): void
} }
function send_user_an_email(MailMessage $mail, string $email, ?string $cc = null): void function send_user_an_email(MailMessage $mail, string $email, ?string $cc = null): void
{ {
$settings = InstanceSettings::get(); $settings = \App\Models\InstanceSettings::get();
$type = set_transanctional_email_settings($settings); $type = set_transanctional_email_settings($settings);
if (! $type) { if (! $type) {
throw new Exception('No email settings found.'); throw new Exception('No email settings found.');
@@ -774,6 +774,8 @@ function parseDockerComposeFile(Service|Application $resource, bool $isNew = fal
$allServices = get_service_templates(); $allServices = get_service_templates();
$topLevelVolumes = collect(data_get($yaml, 'volumes', [])); $topLevelVolumes = collect(data_get($yaml, 'volumes', []));
$topLevelNetworks = collect(data_get($yaml, 'networks', [])); $topLevelNetworks = collect(data_get($yaml, 'networks', []));
$topLevelConfigs = collect(data_get($yaml, 'configs', []));
$topLevelSecrets = collect(data_get($yaml, 'secrets', []));
$services = data_get($yaml, 'services'); $services = data_get($yaml, 'services');
$generatedServiceFQDNS = collect([]); $generatedServiceFQDNS = collect([]);
@@ -1402,6 +1404,8 @@ function parseDockerComposeFile(Service|Application $resource, bool $isNew = fal
'services' => $services->toArray(), 'services' => $services->toArray(),
'volumes' => $topLevelVolumes->toArray(), 'volumes' => $topLevelVolumes->toArray(),
'networks' => $topLevelNetworks->toArray(), 'networks' => $topLevelNetworks->toArray(),
'configs' => $topLevelConfigs->toArray(),
'secrets' => $topLevelSecrets->toArray(),
]; ];
$yaml = data_forget($yaml, 'services.*.volumes.*.content'); $yaml = data_forget($yaml, 'services.*.volumes.*.content');
$resource->docker_compose_raw = Yaml::dump($yaml, 10, 2); $resource->docker_compose_raw = Yaml::dump($yaml, 10, 2);
@@ -1441,6 +1445,8 @@ function parseDockerComposeFile(Service|Application $resource, bool $isNew = fal
} }
$topLevelNetworks = collect(data_get($yaml, 'networks', [])); $topLevelNetworks = collect(data_get($yaml, 'networks', []));
$topLevelConfigs = collect(data_get($yaml, 'configs', []));
$topLevelSecrets = collect(data_get($yaml, 'secrets', []));
$services = data_get($yaml, 'services'); $services = data_get($yaml, 'services');
$generatedServiceFQDNS = collect([]); $generatedServiceFQDNS = collect([]);
@@ -1482,128 +1488,263 @@ function parseDockerComposeFile(Service|Application $resource, bool $isNew = fal
$baseName = generateApplicationContainerName($resource, $pull_request_id); $baseName = generateApplicationContainerName($resource, $pull_request_id);
$containerName = "$serviceName-$baseName"; $containerName = "$serviceName-$baseName";
if (count($serviceVolumes) > 0) { if ($resource->compose_parsing_version === '1') {
$serviceVolumes = $serviceVolumes->map(function ($volume) use ($resource, $topLevelVolumes, $pull_request_id) { if (count($serviceVolumes) > 0) {
if (is_string($volume)) { $serviceVolumes = $serviceVolumes->map(function ($volume) use ($resource, $topLevelVolumes, $pull_request_id) {
$volume = str($volume); if (is_string($volume)) {
if ($volume->contains(':') && ! $volume->startsWith('/')) { $volume = str($volume);
$name = $volume->before(':'); if ($volume->contains(':') && ! $volume->startsWith('/')) {
$mount = $volume->after(':');
if ($name->startsWith('.') || $name->startsWith('~')) {
$dir = base_configuration_dir().'/applications/'.$resource->uuid;
if ($name->startsWith('.')) {
$name = $name->replaceFirst('.', $dir);
}
if ($name->startsWith('~')) {
$name = $name->replaceFirst('~', $dir);
}
if ($pull_request_id !== 0) {
$name = $name."-pr-$pull_request_id";
}
$volume = str("$name:$mount");
} else {
if ($pull_request_id !== 0) {
$name = $name."-pr-$pull_request_id";
$volume = str("$name:$mount");
if ($topLevelVolumes->has($name)) {
$v = $topLevelVolumes->get($name);
if (data_get($v, 'driver_opts.type') === 'cifs') {
// Do nothing
} else {
if (is_null(data_get($v, 'name'))) {
data_set($v, 'name', $name);
data_set($topLevelVolumes, $name, $v);
}
}
} else {
$topLevelVolumes->put($name, [
'name' => $name,
]);
}
} else {
if ($topLevelVolumes->has($name->value())) {
$v = $topLevelVolumes->get($name->value());
if (data_get($v, 'driver_opts.type') === 'cifs') {
// Do nothing
} else {
if (is_null(data_get($v, 'name'))) {
data_set($topLevelVolumes, $name->value(), $v);
}
}
} else {
$topLevelVolumes->put($name->value(), [
'name' => $name->value(),
]);
}
}
}
} else {
if ($volume->startsWith('/')) {
$name = $volume->before(':'); $name = $volume->before(':');
$mount = $volume->after(':'); $mount = $volume->after(':');
if ($pull_request_id !== 0) { if ($name->startsWith('.') || $name->startsWith('~')) {
$name = $name."-pr-$pull_request_id"; $dir = base_configuration_dir().'/applications/'.$resource->uuid;
} if ($name->startsWith('.')) {
$volume = str("$name:$mount"); $name = $name->replaceFirst('.', $dir);
} }
} if ($name->startsWith('~')) {
} elseif (is_array($volume)) { $name = $name->replaceFirst('~', $dir);
$source = data_get($volume, 'source'); }
$target = data_get($volume, 'target'); if ($pull_request_id !== 0) {
$read_only = data_get($volume, 'read_only'); $name = $name."-pr-$pull_request_id";
if ($source && $target) { }
if ((str($source)->startsWith('.') || str($source)->startsWith('~'))) { $volume = str("$name:$mount");
$dir = base_configuration_dir().'/applications/'.$resource->uuid;
if (str($source, '.')) {
$source = str($source)->replaceFirst('.', $dir);
}
if (str($source, '~')) {
$source = str($source)->replaceFirst('~', $dir);
}
if ($pull_request_id !== 0) {
$source = $source."-pr-$pull_request_id";
}
if ($read_only) {
data_set($volume, 'source', $source.':'.$target.':ro');
} else { } else {
data_set($volume, 'source', $source.':'.$target); if ($pull_request_id !== 0) {
} $name = $name."-pr-$pull_request_id";
} else { $volume = str("$name:$mount");
if ($pull_request_id !== 0) { if ($topLevelVolumes->has($name)) {
$source = $source."-pr-$pull_request_id"; $v = $topLevelVolumes->get($name);
} if (data_get($v, 'driver_opts.type') === 'cifs') {
if ($read_only) { // Do nothing
data_set($volume, 'source', $source.':'.$target.':ro'); } else {
} else { if (is_null(data_get($v, 'name'))) {
data_set($volume, 'source', $source.':'.$target); data_set($v, 'name', $name);
} data_set($topLevelVolumes, $name, $v);
if (! str($source)->startsWith('/')) { }
if ($topLevelVolumes->has($source)) {
$v = $topLevelVolumes->get($source);
if (data_get($v, 'driver_opts.type') === 'cifs') {
// Do nothing
} else {
if (is_null(data_get($v, 'name'))) {
data_set($v, 'name', $source);
data_set($topLevelVolumes, $source, $v);
} }
} else {
$topLevelVolumes->put($name, [
'name' => $name,
]);
} }
} else { } else {
$topLevelVolumes->put($source, [ if ($topLevelVolumes->has($name->value())) {
'name' => $source, $v = $topLevelVolumes->get($name->value());
]); if (data_get($v, 'driver_opts.type') === 'cifs') {
// Do nothing
} else {
if (is_null(data_get($v, 'name'))) {
data_set($topLevelVolumes, $name->value(), $v);
}
}
} else {
$topLevelVolumes->put($name->value(), [
'name' => $name->value(),
]);
}
}
}
} else {
if ($volume->startsWith('/')) {
$name = $volume->before(':');
$mount = $volume->after(':');
if ($pull_request_id !== 0) {
$name = $name."-pr-$pull_request_id";
}
$volume = str("$name:$mount");
}
}
} elseif (is_array($volume)) {
$source = data_get($volume, 'source');
$target = data_get($volume, 'target');
$read_only = data_get($volume, 'read_only');
if ($source && $target) {
if ((str($source)->startsWith('.') || str($source)->startsWith('~'))) {
$dir = base_configuration_dir().'/applications/'.$resource->uuid;
if (str($source, '.')) {
$source = str($source)->replaceFirst('.', $dir);
}
if (str($source, '~')) {
$source = str($source)->replaceFirst('~', $dir);
}
if ($pull_request_id !== 0) {
$source = $source."-pr-$pull_request_id";
}
if ($read_only) {
data_set($volume, 'source', $source.':'.$target.':ro');
} else {
data_set($volume, 'source', $source.':'.$target);
}
} else {
if ($pull_request_id !== 0) {
$source = $source."-pr-$pull_request_id";
}
if ($read_only) {
data_set($volume, 'source', $source.':'.$target.':ro');
} else {
data_set($volume, 'source', $source.':'.$target);
}
if (! str($source)->startsWith('/')) {
if ($topLevelVolumes->has($source)) {
$v = $topLevelVolumes->get($source);
if (data_get($v, 'driver_opts.type') === 'cifs') {
// Do nothing
} else {
if (is_null(data_get($v, 'name'))) {
data_set($v, 'name', $source);
data_set($topLevelVolumes, $source, $v);
}
}
} else {
$topLevelVolumes->put($source, [
'name' => $source,
]);
}
} }
} }
} }
} }
} if (is_array($volume)) {
if (is_array($volume)) { return data_get($volume, 'source');
return data_get($volume, 'source'); }
}
return $volume->value(); return $volume->value();
}); });
data_set($service, 'volumes', $serviceVolumes->toArray()); data_set($service, 'volumes', $serviceVolumes->toArray());
}
} elseif ($resource->compose_parsing_version === '2') {
if (count($serviceVolumes) > 0) {
$serviceVolumes = $serviceVolumes->map(function ($volume) use ($resource, $topLevelVolumes, $pull_request_id) {
if (is_string($volume)) {
$volume = str($volume);
if ($volume->contains(':') && ! $volume->startsWith('/')) {
$name = $volume->before(':');
$mount = $volume->after(':');
if ($name->startsWith('.') || $name->startsWith('~')) {
$dir = base_configuration_dir().'/applications/'.$resource->uuid;
if ($name->startsWith('.')) {
$name = $name->replaceFirst('.', $dir);
}
if ($name->startsWith('~')) {
$name = $name->replaceFirst('~', $dir);
}
if ($pull_request_id !== 0) {
$name = $name."-pr-$pull_request_id";
}
$volume = str("$name:$mount");
} else {
if ($pull_request_id !== 0) {
$uuid = $resource->uuid;
$name = $uuid."-$name-pr-$pull_request_id";
$volume = str("$name:$mount");
if ($topLevelVolumes->has($name)) {
$v = $topLevelVolumes->get($name);
if (data_get($v, 'driver_opts.type') === 'cifs') {
// Do nothing
} else {
if (is_null(data_get($v, 'name'))) {
data_set($v, 'name', $name);
data_set($topLevelVolumes, $name, $v);
}
}
} else {
$topLevelVolumes->put($name, [
'name' => $name,
]);
}
} else {
$uuid = $resource->uuid;
$name = str($uuid."-$name");
$volume = str("$name:$mount");
if ($topLevelVolumes->has($name->value())) {
$v = $topLevelVolumes->get($name->value());
if (data_get($v, 'driver_opts.type') === 'cifs') {
// Do nothing
} else {
if (is_null(data_get($v, 'name'))) {
data_set($topLevelVolumes, $name->value(), $v);
}
}
} else {
$topLevelVolumes->put($name->value(), [
'name' => $name->value(),
]);
}
}
}
} else {
if ($volume->startsWith('/')) {
$name = $volume->before(':');
$mount = $volume->after(':');
if ($pull_request_id !== 0) {
$name = $name."-pr-$pull_request_id";
}
$volume = str("$name:$mount");
}
}
} elseif (is_array($volume)) {
$source = data_get($volume, 'source');
$target = data_get($volume, 'target');
$read_only = data_get($volume, 'read_only');
if ($source && $target) {
$uuid = $resource->uuid;
if ((str($source)->startsWith('.') || str($source)->startsWith('~'))) {
$dir = base_configuration_dir().'/applications/'.$resource->uuid;
if (str($source, '.')) {
$source = str($source)->replaceFirst('.', $dir);
}
if (str($source, '~')) {
$source = str($source)->replaceFirst('~', $dir);
}
if ($pull_request_id === 0) {
$source = $uuid."-$source";
} else {
$source = $uuid."-$source-pr-$pull_request_id";
}
if ($read_only) {
data_set($volume, 'source', $source.':'.$target.':ro');
} else {
data_set($volume, 'source', $source.':'.$target);
}
} else {
if ($pull_request_id === 0) {
$source = $uuid."-$source";
} else {
$source = $uuid."-$source-pr-$pull_request_id";
}
if ($read_only) {
data_set($volume, 'source', $source.':'.$target.':ro');
} else {
data_set($volume, 'source', $source.':'.$target);
}
if (! str($source)->startsWith('/')) {
if ($topLevelVolumes->has($source)) {
$v = $topLevelVolumes->get($source);
if (data_get($v, 'driver_opts.type') === 'cifs') {
// Do nothing
} else {
if (is_null(data_get($v, 'name'))) {
data_set($v, 'name', $source);
data_set($topLevelVolumes, $source, $v);
}
}
} else {
$topLevelVolumes->put($source, [
'name' => $source,
]);
}
}
}
}
}
if (is_array($volume)) {
return data_get($volume, 'source');
}
return $volume->value();
});
data_set($service, 'volumes', $serviceVolumes->toArray());
}
} }
if ($pull_request_id !== 0 && count($serviceDependencies) > 0) { if ($pull_request_id !== 0 && count($serviceDependencies) > 0) {
@@ -1892,14 +2033,20 @@ function parseDockerComposeFile(Service|Application $resource, bool $isNew = fal
domains: $fqdns, domains: $fqdns,
serviceLabels: $serviceLabels, serviceLabels: $serviceLabels,
generate_unique_uuid: $resource->build_pack === 'dockercompose', generate_unique_uuid: $resource->build_pack === 'dockercompose',
image: data_get($service, 'image') image: data_get($service, 'image'),
is_force_https_enabled: $resource->isForceHttpsEnabled(),
is_gzip_enabled: $resource->isGzipEnabled(),
is_stripprefix_enabled: $resource->isStripprefixEnabled(),
)); ));
$serviceLabels = $serviceLabels->merge(fqdnLabelsForCaddy( $serviceLabels = $serviceLabels->merge(fqdnLabelsForCaddy(
network: $resource->destination->network, network: $resource->destination->network,
uuid: $resource->uuid, uuid: $resource->uuid,
domains: $fqdns, domains: $fqdns,
serviceLabels: $serviceLabels, serviceLabels: $serviceLabels,
image: data_get($service, 'image') image: data_get($service, 'image'),
is_force_https_enabled: $resource->isForceHttpsEnabled(),
is_gzip_enabled: $resource->isGzipEnabled(),
is_stripprefix_enabled: $resource->isStripprefixEnabled(),
)); ));
} }
} }
@@ -1945,6 +2092,8 @@ function parseDockerComposeFile(Service|Application $resource, bool $isNew = fal
'services' => $services->toArray(), 'services' => $services->toArray(),
'volumes' => $topLevelVolumes->toArray(), 'volumes' => $topLevelVolumes->toArray(),
'networks' => $topLevelNetworks->toArray(), 'networks' => $topLevelNetworks->toArray(),
'configs' => $topLevelConfigs->toArray(),
'secrets' => $topLevelSecrets->toArray(),
]; ];
if ($isSameDockerComposeFile) { if ($isSameDockerComposeFile) {
$resource->docker_compose_raw = Yaml::dump($yaml, 10, 2); $resource->docker_compose_raw = Yaml::dump($yaml, 10, 2);
@@ -2109,7 +2258,7 @@ function validate_dns_entry(string $fqdn, Server $server)
if (str($host)->contains('sslip.io')) { if (str($host)->contains('sslip.io')) {
return true; return true;
} }
$settings = InstanceSettings::get(); $settings = \App\Models\InstanceSettings::get();
$is_dns_validation_enabled = data_get($settings, 'is_dns_validation_enabled'); $is_dns_validation_enabled = data_get($settings, 'is_dns_validation_enabled');
if (! $is_dns_validation_enabled) { if (! $is_dns_validation_enabled) {
return true; return true;
@@ -2168,7 +2317,7 @@ function ip_match($ip, $cidrs, &$match = null)
return false; return false;
} }
function checkIfDomainIsAlreadyUsed(Collection|array $domains, ?string $teamId, string $uuid) function checkIfDomainIsAlreadyUsed(Collection|array $domains, ?string $teamId = null, ?string $uuid = null)
{ {
if (is_null($teamId)) { if (is_null($teamId)) {
return response()->json(['error' => 'Team ID is required.'], 400); return response()->json(['error' => 'Team ID is required.'], 400);
@@ -2184,8 +2333,12 @@ function checkIfDomainIsAlreadyUsed(Collection|array $domains, ?string $teamId,
return str($domain); return str($domain);
}); });
$applications = Application::ownedByCurrentTeamAPI($teamId)->get(['fqdn', 'uuid'])->filter(fn ($app) => $app->uuid !== $uuid); $applications = Application::ownedByCurrentTeamAPI($teamId)->get(['fqdn', 'uuid']);
$serviceApplications = ServiceApplication::ownedByCurrentTeamAPI($teamId)->get(['fqdn', 'uuid'])->filter(fn ($app) => $app->uuid !== $uuid); $serviceApplications = ServiceApplication::ownedByCurrentTeamAPI($teamId)->get(['fqdn', 'uuid']);
if ($uuid) {
$applications = $applications->filter(fn ($app) => $app->uuid !== $uuid);
$serviceApplications = $serviceApplications->filter(fn ($app) => $app->uuid !== $uuid);
}
$domainFound = false; $domainFound = false;
foreach ($applications as $app) { foreach ($applications as $app) {
if (is_null($app->fqdn)) { if (is_null($app->fqdn)) {
@@ -2225,7 +2378,7 @@ function checkIfDomainIsAlreadyUsed(Collection|array $domains, ?string $teamId,
if ($domainFound) { if ($domainFound) {
return true; return true;
} }
$settings = InstanceSettings::get(); $settings = \App\Models\InstanceSettings::get();
if (data_get($settings, 'fqdn')) { if (data_get($settings, 'fqdn')) {
$domain = data_get($settings, 'fqdn'); $domain = data_get($settings, 'fqdn');
if (str($domain)->endsWith('/')) { if (str($domain)->endsWith('/')) {
@@ -2242,7 +2395,6 @@ function check_domain_usage(ServiceApplication|Application|null $resource = null
if ($resource) { if ($resource) {
if ($resource->getMorphClass() === 'App\Models\Application' && $resource->build_pack === 'dockercompose') { if ($resource->getMorphClass() === 'App\Models\Application' && $resource->build_pack === 'dockercompose') {
$domains = data_get(json_decode($resource->docker_compose_domains, true), '*.domain'); $domains = data_get(json_decode($resource->docker_compose_domains, true), '*.domain');
ray($domains);
$domains = collect($domains); $domains = collect($domains);
} else { } else {
$domains = collect($resource->fqdns); $domains = collect($resource->fqdns);
@@ -2298,7 +2450,7 @@ function check_domain_usage(ServiceApplication|Application|null $resource = null
} }
} }
if ($resource) { if ($resource) {
$settings = InstanceSettings::get(); $settings = \App\Models\InstanceSettings::get();
if (data_get($settings, 'fqdn')) { if (data_get($settings, 'fqdn')) {
$domain = data_get($settings, 'fqdn'); $domain = data_get($settings, 'fqdn');
if (str($domain)->endsWith('/')) { if (str($domain)->endsWith('/')) {
@@ -2373,7 +2525,7 @@ function get_public_ips()
{ {
try { try {
echo "Refreshing public ips!\n"; echo "Refreshing public ips!\n";
$settings = InstanceSettings::get(); $settings = \App\Models\InstanceSettings::get();
[$first, $second] = Process::concurrently(function (Pool $pool) { [$first, $second] = Process::concurrently(function (Pool $pool) {
$pool->path(__DIR__)->command('curl -4s https://ifconfig.io'); $pool->path(__DIR__)->command('curl -4s https://ifconfig.io');
$pool->path(__DIR__)->command('curl -6s https://ifconfig.io'); $pool->path(__DIR__)->command('curl -6s https://ifconfig.io');

View File

@@ -32,6 +32,7 @@
"poliander/cron": "^3.0", "poliander/cron": "^3.0",
"purplepixie/phpdns": "^2.1", "purplepixie/phpdns": "^2.1",
"pusher/pusher-php-server": "^7.2", "pusher/pusher-php-server": "^7.2",
"resend/resend-laravel": "^0.13.0",
"sentry/sentry-laravel": "^4.6", "sentry/sentry-laravel": "^4.6",
"socialiteproviders/microsoft-azure": "^5.1", "socialiteproviders/microsoft-azure": "^5.1",
"spatie/laravel-activitylog": "^4.7.3", "spatie/laravel-activitylog": "^4.7.3",
@@ -106,4 +107,4 @@
}, },
"minimum-stability": "stable", "minimum-stability": "stable",
"prefer-stable": true "prefer-stable": true
} }

128
composer.lock generated
View File

@@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically" "This file is @generated automatically"
], ],
"content-hash": "c7c9cc002a9765c2395717c69ba8bfc6", "content-hash": "cb17445966de6094aef5a92ee59d1d77",
"packages": [ "packages": [
{ {
"name": "amphp/amp", "name": "amphp/amp",
@@ -7129,6 +7129,132 @@
], ],
"time": "2024-07-01T14:24:45+00:00" "time": "2024-07-01T14:24:45+00:00"
}, },
{
"name": "resend/resend-laravel",
"version": "v0.13.0",
"source": {
"type": "git",
"url": "https://github.com/resend/resend-laravel.git",
"reference": "23aed22df0d0b23c2952da2aaed6a8b88d301a8a"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/resend/resend-laravel/zipball/23aed22df0d0b23c2952da2aaed6a8b88d301a8a",
"reference": "23aed22df0d0b23c2952da2aaed6a8b88d301a8a",
"shasum": ""
},
"require": {
"illuminate/http": "^10.0|^11.0",
"illuminate/support": "^10.0|^11.0",
"php": "^8.1",
"resend/resend-php": "^0.12.0",
"symfony/mailer": "^6.2|^7.0"
},
"require-dev": {
"friendsofphp/php-cs-fixer": "^3.14",
"mockery/mockery": "^1.5",
"orchestra/testbench": "^8.17|^9.0",
"pestphp/pest": "^2.0"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-main": "1.x-dev"
},
"laravel": {
"providers": [
"Resend\\Laravel\\ResendServiceProvider"
]
}
},
"autoload": {
"psr-4": {
"Resend\\Laravel\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Resend and contributors",
"homepage": "https://github.com/resend/resend-laravel/contributors"
}
],
"description": "Resend for Laravel",
"homepage": "https://resend.com/",
"keywords": [
"api",
"client",
"laravel",
"php",
"resend",
"sdk"
],
"support": {
"issues": "https://github.com/resend/resend-laravel/issues",
"source": "https://github.com/resend/resend-laravel/tree/v0.13.0"
},
"time": "2024-07-08T18:51:42+00:00"
},
{
"name": "resend/resend-php",
"version": "v0.12.0",
"source": {
"type": "git",
"url": "https://github.com/resend/resend-php.git",
"reference": "37fb79bb8160ce2de521bf37484ba59e89236521"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/resend/resend-php/zipball/37fb79bb8160ce2de521bf37484ba59e89236521",
"reference": "37fb79bb8160ce2de521bf37484ba59e89236521",
"shasum": ""
},
"require": {
"guzzlehttp/guzzle": "^7.5",
"php": "^8.1.0"
},
"require-dev": {
"friendsofphp/php-cs-fixer": "^3.13",
"mockery/mockery": "^1.6",
"pestphp/pest": "^2.0"
},
"type": "library",
"autoload": {
"files": [
"src/Resend.php"
],
"psr-4": {
"Resend\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Resend and contributors",
"homepage": "https://github.com/resend/resend-php/contributors"
}
],
"description": "Resend PHP library.",
"homepage": "https://resend.com/",
"keywords": [
"api",
"client",
"php",
"resend",
"sdk"
],
"support": {
"issues": "https://github.com/resend/resend-php/issues",
"source": "https://github.com/resend/resend-php/tree/v0.12.0"
},
"time": "2024-03-04T03:16:28+00:00"
},
{ {
"name": "revolt/event-loop", "name": "revolt/event-loop",
"version": "v1.0.6", "version": "v1.0.6",

View File

@@ -7,7 +7,7 @@ return [
// The release version of your application // The release version of your application
// Example with dynamic git hash: trim(exec('git --git-dir ' . base_path('.git') . ' log --pretty="%h" -n1 HEAD')) // Example with dynamic git hash: trim(exec('git --git-dir ' . base_path('.git') . ' log --pretty="%h" -n1 HEAD'))
'release' => '4.0.0-beta.308', 'release' => '4.0.0-beta.313',
// When left empty or `null` the Laravel environment will be used // When left empty or `null` the Laravel environment will be used
'environment' => config('app.env'), 'environment' => config('app.env'),

View File

@@ -1,3 +1,3 @@
<?php <?php
return '4.0.0-beta.308'; return '4.0.0-beta.313';

View File

@@ -0,0 +1,28 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::table('applications', function (Blueprint $table) {
$table->string('compose_parsing_version')->default('1');
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('applications', function (Blueprint $table) {
$table->dropColumn('compose_parsing_version');
});
}
};

View File

@@ -27,14 +27,14 @@ class InstanceSettingsSeeder extends Seeder
$ipv4 = Process::run('curl -4s https://ifconfig.io')->output(); $ipv4 = Process::run('curl -4s https://ifconfig.io')->output();
$ipv4 = trim($ipv4); $ipv4 = trim($ipv4);
$ipv4 = filter_var($ipv4, FILTER_VALIDATE_IP); $ipv4 = filter_var($ipv4, FILTER_VALIDATE_IP);
$settings = InstanceSettings::get(); $settings = \App\Models\InstanceSettings::get();
if (is_null($settings->public_ipv4) && $ipv4) { if (is_null($settings->public_ipv4) && $ipv4) {
$settings->update(['public_ipv4' => $ipv4]); $settings->update(['public_ipv4' => $ipv4]);
} }
$ipv6 = Process::run('curl -6s https://ifconfig.io')->output(); $ipv6 = Process::run('curl -6s https://ifconfig.io')->output();
$ipv6 = trim($ipv6); $ipv6 = trim($ipv6);
$ipv6 = filter_var($ipv6, FILTER_VALIDATE_IP); $ipv6 = filter_var($ipv6, FILTER_VALIDATE_IP);
$settings = InstanceSettings::get(); $settings = \App\Models\InstanceSettings::get();
if (is_null($settings->public_ipv6) && $ipv6) { if (is_null($settings->public_ipv6) && $ipv6) {
$settings->update(['public_ipv6' => $ipv6]); $settings->update(['public_ipv6' => $ipv6]);
} }

View File

@@ -17,6 +17,7 @@ ARG TARGETPLATFORM
# https://github.com/cloudflare/cloudflared/releases # https://github.com/cloudflare/cloudflared/releases
ARG CLOUDFLARED_VERSION=2024.4.1 ARG CLOUDFLARED_VERSION=2024.4.1
ARG POSTGRES_VERSION=15 ARG POSTGRES_VERSION=15
ARG CI=true
WORKDIR /var/www/html WORKDIR /var/www/html

View File

@@ -1343,6 +1343,14 @@ paths:
schema: schema:
type: string type: string
format: uuid format: uuid
-
name: cleanup
in: query
description: 'Delete configurations and volumes.'
required: false
schema:
type: boolean
default: true
responses: responses:
'200': '200':
description: 'Application deleted.' description: 'Application deleted.'
@@ -1799,6 +1807,14 @@ paths:
schema: schema:
type: string type: string
format: uuid format: uuid
-
name: cleanup
in: query
description: 'Delete configurations and volumes.'
required: false
schema:
type: boolean
default: true
responses: responses:
'200': '200':
description: 'Database deleted.' description: 'Database deleted.'
@@ -4026,6 +4042,9 @@ components:
format: date-time format: date-time
nullable: true nullable: true
description: 'The date and time when the application was deleted.' description: 'The date and time when the application was deleted.'
compose_parsing_version:
type: string
description: 'How Coolify parse the compose file.'
type: object type: object
ApplicationDeploymentQueue: ApplicationDeploymentQueue:
description: 'Project model' description: 'Project model'

1
other/logos/latitude.svg Normal file
View File

@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="349" height="64" fill="#ffffff" viewBox="0 0 349 64" ><path fill="#ffffff" d="M76.094 52V7.581h-6.917V52h6.917zM95.64 52.761c3.616 0 7.677-1.776 9.518-4.759V52h6.853V22.43h-6.853v3.997c-1.841-2.982-5.394-4.759-9.328-4.759-9.201 0-14.722 6.854-14.722 15.547 0 8.693 5.013 15.546 14.531 15.546zm1.015-6.155c-5.394 0-8.63-3.997-8.63-9.391s3.236-9.392 8.63-9.392c5.901 0 8.756 4.316 8.756 9.392s-2.855 9.391-8.756 9.391zM132.621 46.162c-2.729 0-4.315-.634-4.315-5.774V28.204h6.79V22.43h-6.79v-8.947h-6.917v8.947h-5.013v5.774h5.013v13.77c0 9.963 6.219 10.407 9.582 10.407 2.031 0 4.061-.19 5.14-.381v-6.092c-.698.127-2.411.254-3.49.254zM144.247 18.178c3.045 0 5.14-2.284 5.14-5.14 0-2.855-2.095-5.14-5.14-5.14-3.046 0-5.14 2.285-5.14 5.14 0 2.856 2.094 5.14 5.14 5.14zM147.673 52V22.43h-6.853V52h6.853zM168.299 46.162c-2.728 0-4.315-.634-4.315-5.774V28.204h6.79V22.43h-6.79v-8.947h-6.916v8.947h-5.013v5.774h5.013v13.77c0 9.963 6.218 10.407 9.581 10.407 2.031 0 4.061-.19 5.14-.381v-6.092c-.698.127-2.411.254-3.49.254zM187.159 52.761c4.251 0 7.361-1.713 9.137-4.886V52h6.917V22.43h-6.917v16.689c0 4.251-1.903 7.741-7.17 7.741-4.505 0-6.028-2.792-6.028-7.551v-16.88h-6.917v18.593c0 7.932 4.505 11.74 10.978 11.74zM232.247 26.427c-1.84-2.982-5.394-4.759-9.328-4.759-9.201 0-14.722 6.854-14.722 15.547 0 8.693 5.013 15.546 14.532 15.546 3.616 0 7.678-1.776 9.518-4.759V52h6.853V7.581h-6.853v18.846zm-8.503 20.18c-5.394 0-8.63-3.998-8.63-9.392 0-5.394 3.236-9.392 8.63-9.392 5.901 0 8.757 4.316 8.757 9.392s-2.856 9.391-8.757 9.391zM273.099 35.692c0-8.313-5.711-14.024-14.15-14.024-9.011 0-14.849 6.092-14.849 15.547 0 9.582 5.774 15.546 15.102 15.546 7.107 0 12.691-3.87 13.58-9.39h-6.98c-1.142 2.283-3.173 3.362-6.6 3.362-5.013 0-8.058-2.538-8.249-7.234h21.956c.127-1.65.19-2.601.19-3.807zm-22.146-1.46c.064-4.188 2.983-7.107 7.869-7.107 4.759 0 7.424 2.539 7.487 7.108h-15.356zM281.59 52.508c2.983 0 5.394-2.475 5.394-5.394s-2.411-5.33-5.394-5.33a5.321 5.321 0 00-5.33 5.33c0 2.919 2.348 5.394 5.33 5.394zM303.931 52.761c7.17 0 11.675-3.426 11.675-9.2 0-4.189-2.665-7.234-6.853-8.44l-5.901-1.713c-2.729-.762-3.681-1.84-3.681-3.427 0-1.777 1.777-3.046 4.252-3.046 3.236 0 5.14 1.46 5.14 3.934h6.789c0-5.71-4.441-9.2-11.675-9.2-6.6 0-11.359 3.68-11.359 8.693 0 4.188 2.348 7.17 6.473 8.312l5.901 1.587c3.173.825 3.871 1.84 3.871 3.49 0 2.094-1.65 3.49-4.252 3.49-3.553 0-6.028-1.777-6.028-4.315h-6.917c0 5.647 5.331 9.835 12.565 9.835zM337.5 21.668c-4.378 0-7.805 1.714-9.645 4.886V7.581h-6.916V52h6.916V35.755c0-5.203 2.538-8.185 7.044-8.185 4.822 0 6.472 2.728 6.472 9.01V52h6.917V33.408c0-7.742-3.681-11.74-10.788-11.74zM50.552 47.654l-5.29 15.762H14.805l5.29-15.762h30.457zM33.744.584H14.863L0 44.875h18.88L33.744.584z" data-darkreader-inline-fill="" style="--darkreader-inline-fill: #ffffff;"></path></svg>

After

Width:  |  Height:  |  Size: 2.8 KiB

View File

@@ -8,7 +8,7 @@
@use('App\Models\InstanceSettings') @use('App\Models\InstanceSettings')
@php @php
$instanceSettings = InstanceSettings::first(); $instanceSettings = \App\Models\InstanceSettings::get();
$name = null; $name = null;
if ($instanceSettings) { if ($instanceSettings) {

View File

@@ -109,7 +109,7 @@
<livewire:project.service.storage :resource="$application" /> <livewire:project.service.storage :resource="$application" />
</div> </div>
<div x-cloak x-show="activeTab === 'webhooks'"> <div x-cloak x-show="activeTab === 'webhooks'">
<livewire:project.shared.webhooks :resource="$application" /> <livewire:project.shared.webhooks :resource="$application" lazy />
</div> </div>
<div x-cloak x-show="activeTab === 'previews'"> <div x-cloak x-show="activeTab === 'previews'">
<livewire:project.application.previews :application="$application" /> <livewire:project.application.previews :application="$application" />
@@ -133,7 +133,7 @@
<livewire:project.shared.metrics :resource="$application" /> <livewire:project.shared.metrics :resource="$application" />
</div> </div>
<div x-cloak x-show="activeTab === 'tags'"> <div x-cloak x-show="activeTab === 'tags'">
<livewire:project.shared.tags :resource="$application" /> <livewire:project.shared.tags :resource="$application" lazy />
</div> </div>
<div x-cloak x-show="activeTab === 'danger'"> <div x-cloak x-show="activeTab === 'danger'">
<livewire:project.shared.danger :resource="$application" /> <livewire:project.shared.danger :resource="$application" />

View File

@@ -18,7 +18,12 @@
@endif @endif
SHA: {{ data_get($image, 'tag') }} SHA: {{ data_get($image, 'tag') }}
</div> </div>
<div class="text-xs">{{ data_get($image, 'created_at') }}</div> @php
$date = data_get($image, 'created_at');
$interval = \Illuminate\Support\Carbon::parse($date);
@endphp
<div class="text-xs">{{ $interval->diffForHumans() }}</div>
<div class="text-xs">{{ $date }}</div>
</div> </div>
<div class="flex justify-end p-2"> <div class="flex justify-end p-2">
@if (data_get($image, 'is_current')) @if (data_get($image, 'is_current'))

View File

@@ -99,7 +99,7 @@
<livewire:project.shared.metrics :resource="$database" /> <livewire:project.shared.metrics :resource="$database" />
</div> </div>
<div x-cloak x-show="activeTab === 'tags'"> <div x-cloak x-show="activeTab === 'tags'">
<livewire:project.shared.tags :resource="$database" /> <livewire:project.shared.tags :resource="$database" lazy />
</div> </div>
<div x-cloak x-show="activeTab === 'danger'"> <div x-cloak x-show="activeTab === 'danger'">
<livewire:project.shared.danger :resource="$database" /> <livewire:project.shared.danger :resource="$database" />

View File

@@ -1,5 +1,5 @@
<x-forms.select wire:model.live="selectedEnvironment"> <x-forms.select wire:model.live="selectedEnvironment">
<option value="edit">Create/Edit Environments</option> <option value="edit">Create / Edit</option>
<option disabled>-----</option> <option disabled>-----</option>
@foreach ($environments as $environment) @foreach ($environments as $environment)
<option value="{{ $environment->name }}">{{ $environment->name }} <option value="{{ $environment->name }}">{{ $environment->name }}

View File

@@ -16,7 +16,7 @@
name, example: <span class='text-helper'>-pr-1</span>" /> name, example: <span class='text-helper'>-pr-1</span>" />
@if ($resource?->build_pack !== 'dockercompose') @if ($resource?->build_pack !== 'dockercompose')
<x-modal-input :closeOutside="false" buttonTitle="+ Add" title="New Persistent Storage"> <x-modal-input :closeOutside="false" buttonTitle="+ Add" title="New Persistent Storage">
<livewire:project.shared.storages.add :resource="$resource"/> <livewire:project.shared.storages.add :resource="$resource" />
</x-modal-input> </x-modal-input>
@endif @endif
</div> </div>
@@ -24,10 +24,12 @@
@if ($resource?->build_pack === 'dockercompose') @if ($resource?->build_pack === 'dockercompose')
<span class="dark:text-warning text-coollabs">Please modify storage layout in your Docker Compose <span class="dark:text-warning text-coollabs">Please modify storage layout in your Docker Compose
file or reload the compose file to reread the storage layout.</span> file or reload the compose file to reread the storage layout.</span>
@else
@if ($resource->persistentStorages()->get()->count() === 0 && $resource->fileStorages()->get()->count() == 0)
<div class="pt-4">No storage found.</div>
@endif
@endif @endif
@if ($resource->persistentStorages()->get()->count() === 0 && $resource->fileStorages()->get()->count() == 0)
<div class="pt-4">No storage found.</div>
@endif
@if ($resource->persistentStorages()->get()->count() > 0) @if ($resource->persistentStorages()->get()->count() > 0)
<livewire:project.shared.storages.all :resource="$resource" /> <livewire:project.shared.storages.all :resource="$resource" />
@endif @endif

View File

@@ -11,5 +11,6 @@
<h4>Actions</h4> <h4>Actions</h4>
<x-forms.checkbox id="delete_configurations" <x-forms.checkbox id="delete_configurations"
label="Permanently delete configuration files from the server?"></x-forms.checkbox> label="Permanently delete configuration files from the server?"></x-forms.checkbox>
<x-forms.checkbox id="delete_volumes" label="Permanently delete associated volumes?"></x-forms.checkbox>
</x-modal-confirmation> </x-modal-confirmation>
</div> </div>

View File

@@ -13,7 +13,7 @@
it.</div> it.</div>
@else @else
@if (!str($resource->status)->contains('running')) @if (!str($resource->status)->contains('running'))
<div class="alert alert-warning">Metrics are only available when the application is running!</div> <div class="alert alert-warning">Metrics are only available when this resource is running!</div>
@else @else
<x-forms.select label="Interval" wire:change="setInterval" id="interval"> <x-forms.select label="Interval" wire:change="setInterval" id="interval">
<option value="5">5 minutes (live)</option> <option value="5">5 minutes (live)</option>

View File

@@ -1,10 +1,18 @@
<div> <div>
<h2>Tags</h2> <h2>Tags</h2>
<div class="flex flex-wrap gap-2 pt-4"> <form wire:submit='submit' class="flex items-end gap-2">
@if (data_get($this->resource, 'tags')) <div class="w-64">
@forelse (data_get($this->resource,'tags') as $tagId => $tag) <x-forms.input label="Create new or assign existing tags"
<div helper="You add more at once with space separated list: web api something<br><br>If the tag does not exists, it will be created."
class="px-2 py-1 text-center rounded select-none dark:text-white w-fit bg-neutral-200 hover:bg-neutral-300 dark:bg-coolgray-100 dark:hover:bg-coolgray-200"> wire:model="newTags" placeholder="example: prod app1 user" />
</div>
<x-forms.button type="submit">Add</x-forms.button>
</form>
@if (data_get($this->resource, 'tags') && count(data_get($this->resource, 'tags')) > 0)
<h3 class="pt-4">Assigned Tags</h3>
<div class="flex flex-wrap gap-2 pt-4">
@foreach (data_get($this->resource, 'tags') as $tagId => $tag)
<div class="button">
{{ $tag->name }} {{ $tag->name }}
<svg wire:click="deleteTag('{{ $tag->id }}')" xmlns="http://www.w3.org/2000/svg" fill="none" <svg wire:click="deleteTag('{{ $tag->id }}')" xmlns="http://www.w3.org/2000/svg" fill="none"
viewBox="0 0 24 24" viewBox="0 0 24 24"
@@ -13,24 +21,14 @@
</path> </path>
</svg> </svg>
</div> </div>
@empty @endforeach
<div class="py-1">No tags yet</div>
@endforelse
@endif
</div>
<form wire:submit='submit' class="flex items-end gap-2 pt-4">
<div class="w-64">
<x-forms.input label="Create new or assign existing tags"
helper="You add more at once with space separated list: web api something<br><br>If the tag does not exists, it will be created."
wire:model="new_tag" />
</div> </div>
<x-forms.button type="submit">Add</x-forms.button> @endif
</form> @if (count($filteredTags) > 0)
@if (count($tags) > 0)
<h3 class="pt-4">Exisiting Tags</h3> <h3 class="pt-4">Exisiting Tags</h3>
<div>Click to add quickly</div> <div>Click to add quickly</div>
<div class="flex flex-wrap gap-2 pt-4"> <div class="flex flex-wrap gap-2 pt-4">
@foreach ($tags as $tag) @foreach ($filteredTags as $tag)
<x-forms.button wire:click="addTag('{{ $tag->id }}','{{ $tag->name }}')"> <x-forms.button wire:click="addTag('{{ $tag->id }}','{{ $tag->name }}')">
{{ $tag->name }}</x-forms.button> {{ $tag->name }}</x-forms.button>
@endforeach @endforeach

View File

@@ -13,13 +13,13 @@
<div> <div>
<h3>Manual Git Webhooks</h3> <h3>Manual Git Webhooks</h3>
@if ($githubManualWebhook && $gitlabManualWebhook) @if ($githubManualWebhook && $gitlabManualWebhook)
<form wire:submit='saveSecret' class="flex flex-col gap-2"> <form wire:submit='submit' class="flex flex-col gap-2">
<div class="flex items-end gap-2"> <div class="flex items-end gap-2">
<x-forms.input helper="Content Type in GitHub configuration could be json or form-urlencoded." <x-forms.input helper="Content Type in GitHub configuration could be json or form-urlencoded."
readonly label="GitHub" id="githubManualWebhook"></x-forms.input> readonly label="GitHub" id="githubManualWebhook"></x-forms.input>
<x-forms.input type="password" <x-forms.input type="password"
helper="Need to set a secret to be able to use this webhook. It should match with the secret in GitHub." helper="Need to set a secret to be able to use this webhook. It should match with the secret in GitHub."
label="GitHub Webhook Secret" id="resource.manual_webhook_secret_github"></x-forms.input> label="GitHub Webhook Secret" id="githubManualWebhookSecret"></x-forms.input>
</div> </div>
<a target="_blank" class="flex hover:no-underline" href="{{ $resource?->gitWebhook }}"> <a target="_blank" class="flex hover:no-underline" href="{{ $resource?->gitWebhook }}">
@@ -31,21 +31,19 @@
<x-forms.input readonly label="GitLab" id="gitlabManualWebhook"></x-forms.input> <x-forms.input readonly label="GitLab" id="gitlabManualWebhook"></x-forms.input>
<x-forms.input type="password" <x-forms.input type="password"
helper="Need to set a secret to be able to use this webhook. It should match with the secret in GitLab." helper="Need to set a secret to be able to use this webhook. It should match with the secret in GitLab."
label="GitLab Webhook Secret" id="resource.manual_webhook_secret_gitlab"></x-forms.input> label="GitLab Webhook Secret" id="gitlabManualWebhookSecret"></x-forms.input>
</div> </div>
<div class="flex gap-2"> <div class="flex gap-2">
<x-forms.input readonly label="Bitbucket" id="bitbucketManualWebhook"></x-forms.input> <x-forms.input readonly label="Bitbucket" id="bitbucketManualWebhook"></x-forms.input>
<x-forms.input type="password" <x-forms.input type="password"
helper="Need to set a secret to be able to use this webhook. It should match with the secret in Bitbucket." helper="Need to set a secret to be able to use this webhook. It should match with the secret in Bitbucket."
label="Bitbucket Webhook Secret" label="Bitbucket Webhook Secret" id="bitbucketManualWebhookSecret"></x-forms.input>
id="resource.manual_webhook_secret_bitbucket"></x-forms.input>
</div> </div>
<div class="flex gap-2"> <div class="flex gap-2">
<x-forms.input readonly label="Gitea" id="giteaManualWebhook"></x-forms.input> <x-forms.input readonly label="Gitea" id="giteaManualWebhook"></x-forms.input>
<x-forms.input type="password" <x-forms.input type="password"
helper="Need to set a secret to be able to use this webhook. It should match with the secret in Gitea." helper="Need to set a secret to be able to use this webhook. It should match with the secret in Gitea."
label="Gitea Webhook Secret" label="Gitea Webhook Secret" id="giteaManualWebhookSecret"></x-forms.input>
id="resource.manual_webhook_secret_gitea"></x-forms.input>
</div> </div>
<x-forms.button type="submit">Save</x-forms.button> <x-forms.button type="submit">Save</x-forms.button>
</form> </form>

View File

@@ -146,15 +146,13 @@
</div> </div>
<div class="flex items-center gap-2 pt-4 pb-2"> <div class="flex items-center gap-2 pt-4 pb-2">
<h3>Sentinel</h3> <h3>Sentinel</h3>
@if ($server->isSentinelEnabled()) {{-- @if ($server->isSentinelEnabled()) --}}
<x-forms.button wire:click='restartSentinel'>Restart</x-forms.button> {{-- <x-forms.button wire:click='restartSentinel'>Restart</x-forms.button> --}}
@endif {{-- @endif --}}
</div> </div>
<div class="w-64"> <div>Metrics are disabled until a few bugs are fixed.</div>
{{-- <div class="w-64">
<x-forms.checkbox instantSave id="server.settings.is_metrics_enabled" label="Enable Metrics" /> <x-forms.checkbox instantSave id="server.settings.is_metrics_enabled" label="Enable Metrics" />
{{-- <x-forms.checkbox instantSave id="server.settings.is_server_api_enabled" label="Enable Server API"
helper="You need to open port 12172 on your firewall. This API will be used to gather data from your server, which makes Coolify a lot faster than relying on SSH connections." />
<x-forms.button wire:click='checkPortForServerApi'>Check Port for Server API</x-forms.button> --}}
</div> </div>
<div class="pt-4"> <div class="pt-4">
<div class="flex flex-wrap gap-2 sm:flex-nowrap"> <div class="flex flex-wrap gap-2 sm:flex-nowrap">
@@ -166,7 +164,7 @@
<x-forms.input id="server.settings.metrics_history_days" label="Metrics history (days)" required <x-forms.input id="server.settings.metrics_history_days" label="Metrics history (days)" required
helper="How many days should the metrics data should be reserved." /> helper="How many days should the metrics data should be reserved." />
</div> </div>
</div> </div> --}}
@endif @endif
</form> </form>
</div> </div>

View File

@@ -12,13 +12,15 @@ services:
- SERVER_URL=$SERVICE_FQDN_TWENTY - SERVER_URL=$SERVICE_FQDN_TWENTY
- FRONT_BASE_URL=$SERVICE_FQDN_TWENTY - FRONT_BASE_URL=$SERVICE_FQDN_TWENTY
- ENABLE_DB_MIGRATIONS=true - ENABLE_DB_MIGRATIONS=true
- SIGN_IN_PREFILLED=false - CACHE_STORAGE_TYPE=${CACHE_STORAGE_TYPE:-redis}
- REDIS_HOST=redis
- REDIS_PORT=6379
- STORAGE_TYPE=${STORAGE_TYPE:-local} # https://twenty.com/developers/section/self-hosting/self-hosting-var#security
- STORAGE_S3_REGION=$STORAGE_S3_REGION - API_RATE_LIMITING_TTL=${API_RATE_LIMITING_TTL:-100}
- STORAGE_S3_NAME=$STORAGE_S3_NAME - API_RATE_LIMITING_LIMIT=${API_RATE_LIMITING_LIMIT:-100}
- STORAGE_S3_ENDPOINT=$STORAGE_S3_ENDPOINT
# https://twenty.com/developers/section/self-hosting/self-hosting-var#tokens
- ACCESS_TOKEN_SECRET=$SERVICE_BASE64_32_ACCESS - ACCESS_TOKEN_SECRET=$SERVICE_BASE64_32_ACCESS
- LOGIN_TOKEN_SECRET=$SERVICE_BASE64_32_LOGIN - LOGIN_TOKEN_SECRET=$SERVICE_BASE64_32_LOGIN
- REFRESH_TOKEN_SECRET=$SERVICE_BASE64_32_REFRESH - REFRESH_TOKEN_SECRET=$SERVICE_BASE64_32_REFRESH
@@ -26,6 +28,26 @@ services:
- POSTGRES_ADMIN_PASSWORD=$SERVICE_PASSWORD_POSTGRES - POSTGRES_ADMIN_PASSWORD=$SERVICE_PASSWORD_POSTGRES
- PG_DATABASE_URL=postgres://postgres:$SERVICE_PASSWORD_POSTGRES@postgres:5432/default - PG_DATABASE_URL=postgres://postgres:$SERVICE_PASSWORD_POSTGRES@postgres:5432/default
# https://twenty.com/developers/section/self-hosting/self-hosting-var#auth
- IS_SIGN_UP_DISABLED=${IS_SIGN_UP_DISABLED:-false}
- PASSWORD_RESET_TOKEN_EXPIRES_IN=${PASSWORD_RESET_TOKEN_EXPIRES_IN:-5m}
# https://twenty.com/developers/section/self-hosting/self-hosting-var#workspace-cleaning
- WORKSPACE_INACTIVE_DAYS_BEFORE_NOTIFICATION=$WORKSPACE_INACTIVE_DAYS_BEFORE_NOTIFICATION
- WORKSPACE_INACTIVE_DAYS_BEFORE_DELETION=$WORKSPACE_INACTIVE_DAYS_BEFORE_DELETION
# https://twenty.com/developers/section/self-hosting/self-hosting-var#captcha
- STORAGE_TYPE=${STORAGE_TYPE:-local}
- STORAGE_S3_REGION=$STORAGE_S3_REGION
- STORAGE_S3_NAME=$STORAGE_S3_NAME
- STORAGE_S3_ENDPOINT=$STORAGE_S3_ENDPOINT
- STORAGE_S3_ACCESS_KEY_ID=$STORAGE_S3_ACCESS_KEY_ID
- STORAGE_S3_SECRET_ACCESS_KEY=$STORAGE_S3_SECRET_ACCESS_KEY
# https://twenty.com/developers/section/self-hosting/self-hosting-var#message-queue
- MESSAGE_QUEUE_TYPE=$MESSAGE_QUEUE_TYPE
# https://twenty.com/developers/section/self-hosting/self-hosting-var#email
- EMAIL_FROM_ADDRESS=$EMAIL_FROM_ADDRESS - EMAIL_FROM_ADDRESS=$EMAIL_FROM_ADDRESS
- EMAIL_FROM_NAME=$EMAIL_FROM_NAME - EMAIL_FROM_NAME=$EMAIL_FROM_NAME
- EMAIL_SYSTEM_ADDRESS=$EMAIL_SYSTEM_ADDRESS - EMAIL_SYSTEM_ADDRESS=$EMAIL_SYSTEM_ADDRESS
@@ -35,10 +57,12 @@ services:
- EMAIL_SMTP_USER=$EMAIL_SMTP_USER - EMAIL_SMTP_USER=$EMAIL_SMTP_USER
- EMAIL_SMTP_PASSWORD=$EMAIL_SMTP_PASSWORD - EMAIL_SMTP_PASSWORD=$EMAIL_SMTP_PASSWORD
# https://twenty.com/developers/section/self-hosting/self-hosting-var#debug-/-development
- SIGN_IN_PREFILLED=false
- DEBUG_MODE=${DEBUG_MODE:-false}
# https://twenty.com/developers/section/self-hosting/self-hosting-var#telemetry
- TELEMETRY_ENABLED=${TELEMETRY_ENABLED:-false} - TELEMETRY_ENABLED=${TELEMETRY_ENABLED:-false}
- CACHE_STORAGE_TYPE=${CACHE_STORAGE_TYPE:-redis}
- REDIS_HOST=redis
- REDIS_PORT=6379
depends_on: depends_on:
postgres: postgres:
condition: service_healthy condition: service_healthy

File diff suppressed because one or more lines are too long

View File

@@ -1,7 +1,7 @@
{ {
"coolify": { "coolify": {
"v4": { "v4": {
"version": "4.0.0-beta.308" "version": "4.0.0-beta.313"
} }
} }
} }