fix(ssl): server id
This commit is contained in:
parent
bd33f65c0a
commit
a539bfd765
6 changed files with 7 additions and 7 deletions
|
|
@ -59,7 +59,7 @@ public function handle(StandaloneMariadb $database)
|
||||||
$this->commands[] = "mkdir -p $this->configuration_dir/ssl";
|
$this->commands[] = "mkdir -p $this->configuration_dir/ssl";
|
||||||
|
|
||||||
$server = $this->database->destination->server;
|
$server = $this->database->destination->server;
|
||||||
$caCert = SslCertificate::where('server_id', $server->server_id)->where('is_ca_certificate', true)->first();
|
$caCert = SslCertificate::where('server_id', $server->id)->where('is_ca_certificate', true)->first();
|
||||||
|
|
||||||
$this->ssl_certificate = SslCertificate::where('resource_type', $this->database->getMorphClass())->where('resource_id', $this->database->id)->first();
|
$this->ssl_certificate = SslCertificate::where('resource_type', $this->database->getMorphClass())->where('resource_id', $this->database->id)->first();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -59,7 +59,7 @@ public function handle(StandaloneMysql $database)
|
||||||
$this->commands[] = "mkdir -p $this->configuration_dir/ssl";
|
$this->commands[] = "mkdir -p $this->configuration_dir/ssl";
|
||||||
|
|
||||||
$server = $this->database->destination->server;
|
$server = $this->database->destination->server;
|
||||||
$caCert = SslCertificate::where('server_id', $server->server_id)->where('is_ca_certificate', true)->first();
|
$caCert = SslCertificate::where('server_id', $server->id)->where('is_ca_certificate', true)->first();
|
||||||
|
|
||||||
$this->ssl_certificate = SslCertificate::where('resource_type', $this->database->getMorphClass())->where('resource_id', $this->database->id)->first();
|
$this->ssl_certificate = SslCertificate::where('resource_type', $this->database->getMorphClass())->where('resource_id', $this->database->id)->first();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -64,7 +64,7 @@ public function handle(StandalonePostgresql $database)
|
||||||
$this->commands[] = "mkdir -p $this->configuration_dir/ssl";
|
$this->commands[] = "mkdir -p $this->configuration_dir/ssl";
|
||||||
|
|
||||||
$server = $this->database->destination->server;
|
$server = $this->database->destination->server;
|
||||||
$caCert = SslCertificate::where('server_id', $server->server_id)->where('is_ca_certificate', true)->first();
|
$caCert = SslCertificate::where('server_id', $server->id)->where('is_ca_certificate', true)->first();
|
||||||
|
|
||||||
$this->ssl_certificate = SslCertificate::where('resource_type', $this->database->getMorphClass())->where('resource_id', $this->database->id)->first();
|
$this->ssl_certificate = SslCertificate::where('resource_type', $this->database->getMorphClass())->where('resource_id', $this->database->id)->first();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -20,10 +20,10 @@ public function handle(Server $server)
|
||||||
throw new \Exception('Server OS type is not supported for automated installation. Please install Docker manually before continuing: <a target="_blank" class="underline" href="https://coolify.io/docs/installation#manually">documentation</a>.');
|
throw new \Exception('Server OS type is not supported for automated installation. Please install Docker manually before continuing: <a target="_blank" class="underline" href="https://coolify.io/docs/installation#manually">documentation</a>.');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! SslCertificate::where('server_id', $server->server_id)->where('is_ca_certificate', true)->exists()) {
|
if (! SslCertificate::where('server_id', $server->id)->where('is_ca_certificate', true)->exists()) {
|
||||||
$serverCert = SslHelper::generateSslCertificate(
|
$serverCert = SslHelper::generateSslCertificate(
|
||||||
commonName: 'Coolify CA Certificate',
|
commonName: 'Coolify CA Certificate',
|
||||||
serverId: $server->server_id,
|
serverId: $server->id,
|
||||||
isCaCertificate: true,
|
isCaCertificate: true,
|
||||||
validityDays: 15 * 365
|
validityDays: 15 * 365
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -49,7 +49,7 @@ public function mount(string $server_uuid)
|
||||||
|
|
||||||
public function loadCaCertificate()
|
public function loadCaCertificate()
|
||||||
{
|
{
|
||||||
$this->caCertificate = SslCertificate::where('server_id', $this->server->server_id)->where('is_ca_certificate', true)->first();
|
$this->caCertificate = SslCertificate::where('server_id', $this->server->id)->where('is_ca_certificate', true)->first();
|
||||||
|
|
||||||
if ($this->caCertificate) {
|
if ($this->caCertificate) {
|
||||||
$this->certificateContent = $this->caCertificate->ssl_certificate;
|
$this->certificateContent = $this->caCertificate->ssl_certificate;
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@ public function run()
|
||||||
{
|
{
|
||||||
Server::chunk(200, function ($servers) {
|
Server::chunk(200, function ($servers) {
|
||||||
foreach ($servers as $server) {
|
foreach ($servers as $server) {
|
||||||
$existingCaCert = SslCertificate::where('server_id', $server->server_id)->where('is_ca_certificate', true)->first();
|
$existingCaCert = SslCertificate::where('server_id', $server->id)->where('is_ca_certificate', true)->first();
|
||||||
|
|
||||||
if (! $existingCaCert) {
|
if (! $existingCaCert) {
|
||||||
$caCert = SslHelper::generateSslCertificate(
|
$caCert = SslHelper::generateSslCertificate(
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue