Merge branch 'next' into feat/disable-default-redirect
This commit is contained in:
@@ -221,7 +221,6 @@ class Application extends BaseModel
|
||||
{
|
||||
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) {
|
||||
@@ -937,7 +936,7 @@ class Application extends BaseModel
|
||||
$source_html_url_host = $url['host'];
|
||||
$source_html_url_scheme = $url['scheme'];
|
||||
|
||||
if ($this->source->getMorphClass() == 'App\Models\GithubApp') {
|
||||
if ($this->source->getMorphClass() == \App\Models\GithubApp::class) {
|
||||
if ($this->source->is_public) {
|
||||
$fullRepoUrl = "{$this->source->html_url}/{$customRepository}";
|
||||
$git_clone_command = "{$git_clone_command} {$this->source->html_url}/{$customRepository} {$baseDir}";
|
||||
@@ -1246,13 +1245,11 @@ class Application extends BaseModel
|
||||
return;
|
||||
}
|
||||
if (base64_encode(base64_decode($customLabels, true)) !== $customLabels) {
|
||||
ray('custom_labels is not base64 encoded');
|
||||
$this->custom_labels = str($customLabels)->replace(',', "\n");
|
||||
$this->custom_labels = base64_encode($customLabels);
|
||||
}
|
||||
$customLabels = base64_decode($this->custom_labels);
|
||||
if (mb_detect_encoding($customLabels, 'ASCII', true) === false) {
|
||||
ray('custom_labels contains non-ascii characters');
|
||||
$customLabels = str(implode('|coolify|', generateLabelsApplication($this, $preview)))->replace('|coolify|', "\n");
|
||||
}
|
||||
$this->custom_labels = base64_encode($customLabels);
|
||||
@@ -1481,8 +1478,6 @@ class Application extends BaseModel
|
||||
|
||||
public function setConfig($config)
|
||||
{
|
||||
|
||||
$config = $config;
|
||||
$validator = Validator::make(['config' => $config], [
|
||||
'config' => 'required|json',
|
||||
]);
|
||||
|
||||
@@ -27,7 +27,6 @@ class Environment extends Model
|
||||
static::deleting(function ($environment) {
|
||||
$shared_variables = $environment->environment_variables();
|
||||
foreach ($shared_variables as $shared_variable) {
|
||||
ray('Deleting environment shared variable: '.$shared_variable->name);
|
||||
$shared_variable->delete();
|
||||
}
|
||||
|
||||
|
||||
@@ -65,7 +65,7 @@ class GithubApp extends BaseModel
|
||||
{
|
||||
return Attribute::make(
|
||||
get: function () {
|
||||
if ($this->getMorphClass() === 'App\Models\GithubApp') {
|
||||
if ($this->getMorphClass() === \App\Models\GithubApp::class) {
|
||||
return 'github';
|
||||
}
|
||||
},
|
||||
|
||||
@@ -47,7 +47,6 @@ class Project extends BaseModel
|
||||
$project->settings()->delete();
|
||||
$shared_variables = $project->environment_variables();
|
||||
foreach ($shared_variables as $shared_variable) {
|
||||
ray('Deleting project shared variable: '.$shared_variable->name);
|
||||
$shared_variable->delete();
|
||||
}
|
||||
});
|
||||
|
||||
@@ -5,6 +5,7 @@ namespace App\Models;
|
||||
use App\Actions\Server\InstallDocker;
|
||||
use App\Actions\Server\StartSentinel;
|
||||
use App\Enums\ProxyTypes;
|
||||
use App\Helpers\SshMultiplexingHelper;
|
||||
use App\Jobs\CheckAndStartSentinelJob;
|
||||
use App\Notifications\Server\Reachable;
|
||||
use App\Notifications\Server\Unreachable;
|
||||
@@ -63,7 +64,11 @@ class Server extends BaseModel
|
||||
$payload['ip'] = str($server->ip)->trim();
|
||||
}
|
||||
$server->forceFill($payload);
|
||||
|
||||
});
|
||||
static::saved(function ($server) {
|
||||
if ($server->privateKey->isDirty()) {
|
||||
refresh_server_connection($server->privateKey);
|
||||
}
|
||||
});
|
||||
static::created(function ($server) {
|
||||
ServerSetting::create([
|
||||
@@ -1022,7 +1027,6 @@ $schema://$host {
|
||||
$this->refresh();
|
||||
$unreachableNotificationSent = (bool) $this->unreachable_notification_sent;
|
||||
$isReachable = (bool) $this->settings->is_reachable;
|
||||
loggy('Server setting is_reachable changed to '.$isReachable.' for server '.$this->id.'. Unreachable notification sent: '.$unreachableNotificationSent);
|
||||
// If the server is reachable, send the reachable notification if it was sent before
|
||||
if ($isReachable === true) {
|
||||
if ($unreachableNotificationSent === true) {
|
||||
@@ -1052,10 +1056,12 @@ $schema://$host {
|
||||
$this->team->notify(new Unreachable($this));
|
||||
}
|
||||
|
||||
public function validateConnection($isManualCheck = true)
|
||||
public function validateConnection(bool $isManualCheck = true, bool $justCheckingNewKey = false)
|
||||
{
|
||||
config()->set('constants.ssh.mux_enabled', ! $isManualCheck);
|
||||
|
||||
SshMultiplexingHelper::removeMuxFile($this);
|
||||
|
||||
if ($this->skipServer()) {
|
||||
return ['uptime' => false, 'error' => 'Server skipped.'];
|
||||
}
|
||||
@@ -1072,6 +1078,9 @@ $schema://$host {
|
||||
|
||||
return ['uptime' => true, 'error' => null];
|
||||
} catch (\Throwable $e) {
|
||||
if ($justCheckingNewKey) {
|
||||
return ['uptime' => false, 'error' => 'This key is not valid for this server.'];
|
||||
}
|
||||
if ($this->settings->is_reachable === true) {
|
||||
$this->settings->is_reachable = false;
|
||||
$this->settings->save();
|
||||
@@ -1248,4 +1257,9 @@ $schema://$host {
|
||||
{
|
||||
return base_url().'/server/'.$this->uuid;
|
||||
}
|
||||
|
||||
public function restartContainer(string $containerName)
|
||||
{
|
||||
return instant_remote_process(['docker restart '.$containerName], $this, false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -117,7 +117,6 @@ class ServerSetting extends Model
|
||||
$domain = 'http://'.$settings->public_ipv6.':8000';
|
||||
}
|
||||
$this->sentinel_custom_url = $domain;
|
||||
loggy('Sentinel URL: '.$domain);
|
||||
if ($save) {
|
||||
$this->save();
|
||||
}
|
||||
|
||||
@@ -366,7 +366,6 @@ class Service extends BaseModel
|
||||
]);
|
||||
}
|
||||
$password = $this->environment_variables()->where('key', 'SERVICE_PASSWORD_LANGFUSE')->first();
|
||||
ray('password', $password);
|
||||
if ($password) {
|
||||
$data = $data->merge([
|
||||
'Admin Password' => [
|
||||
@@ -1108,7 +1107,6 @@ class Service extends BaseModel
|
||||
foreach ($fields as $field) {
|
||||
$key = data_get($field, 'key');
|
||||
$value = data_get($field, 'value');
|
||||
ray($key, $value);
|
||||
$found = $this->environment_variables()->where('key', $key)->first();
|
||||
if ($found) {
|
||||
$found->value = $value;
|
||||
|
||||
@@ -71,7 +71,6 @@ class StandalonePostgresql extends BaseModel
|
||||
}
|
||||
$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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -93,27 +93,22 @@ class Team extends Model implements SendsDiscord, SendsEmail
|
||||
static::deleting(function ($team) {
|
||||
$keys = $team->privateKeys;
|
||||
foreach ($keys as $key) {
|
||||
ray('Deleting key: '.$key->name);
|
||||
$key->delete();
|
||||
}
|
||||
$sources = $team->sources();
|
||||
foreach ($sources as $source) {
|
||||
ray('Deleting source: '.$source->name);
|
||||
$source->delete();
|
||||
}
|
||||
$tags = Tag::whereTeamId($team->id)->get();
|
||||
foreach ($tags as $tag) {
|
||||
ray('Deleting tag: '.$tag->name);
|
||||
$tag->delete();
|
||||
}
|
||||
$shared_variables = $team->environment_variables();
|
||||
foreach ($shared_variables as $shared_variable) {
|
||||
ray('Deleting team shared variable: '.$shared_variable->name);
|
||||
$shared_variable->delete();
|
||||
}
|
||||
$s3s = $team->s3s;
|
||||
foreach ($s3s as $s3) {
|
||||
ray('Deleting s3: '.$s3->name);
|
||||
$s3->delete();
|
||||
}
|
||||
});
|
||||
@@ -167,8 +162,12 @@ class Team extends Model implements SendsDiscord, SendsEmail
|
||||
if (currentTeam()->id === 0 && isDev()) {
|
||||
return 9999999;
|
||||
}
|
||||
$team = Team::find(currentTeam()->id);
|
||||
if (! $team) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return Team::find(currentTeam()->id)->limits['serverLimit'];
|
||||
return data_get($team, 'limits.serverLimit', 0);
|
||||
}
|
||||
|
||||
public function limits(): Attribute
|
||||
|
||||
Reference in New Issue
Block a user