From 1f606a591d36f9004f7ca5945be3dd5990539b5e Mon Sep 17 00:00:00 2001 From: shimon Date: Mon, 24 Feb 2025 14:13:18 +0200 Subject: [PATCH] debug cert --- src/Appwrite/Certificates/LetsEncrypt.php | 12 +++++++++++- src/Appwrite/Platform/Workers/Certificates.php | 9 +++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/src/Appwrite/Certificates/LetsEncrypt.php b/src/Appwrite/Certificates/LetsEncrypt.php index 3896eab022..5192b2a3f9 100644 --- a/src/Appwrite/Certificates/LetsEncrypt.php +++ b/src/Appwrite/Certificates/LetsEncrypt.php @@ -34,7 +34,11 @@ class LetsEncrypt implements Adapter $stdout, $stderr ); - + var_dump([ + 'location' => 'issueCertificate.1', + 'certificate' => "certbot certonly -v --webroot --noninteractive --agree-tos$staging --email {$this->email} --cert-name $certName -w ".APP_STORAGE_CERTIFICATES." -d $domain", + 'result' => $exit, + ]); // Unexpected error, usually 5XX, API limits, ... if ($exit !== 0) { throw new Exception('Failed to issue a certificate with message: ' . $stderr); @@ -71,7 +75,13 @@ class LetsEncrypt implements Adapter " - certFile: /storage/certificates/{$domain}/fullchain.pem", " keyFile: /storage/certificates/{$domain}/privkey.pem" ]); + var_dump([ + 'location' => 'issueCertificate.2', + 'config' => $config, + 'path' => APP_STORAGE_CONFIG . '/' . $domain . '.yml', + 'file_put_contents' => file_put_contents(APP_STORAGE_CONFIG . '/' . $domain . '.yml', $config), + ]); // Save configuration into Traefik using our new cert files if (!\file_put_contents(APP_STORAGE_CONFIG . '/' . $domain . '.yml', $config)) { throw new Exception('Failed to save Traefik configuration.'); diff --git a/src/Appwrite/Platform/Workers/Certificates.php b/src/Appwrite/Platform/Workers/Certificates.php index 7e220b2734..c92113dda0 100644 --- a/src/Appwrite/Platform/Workers/Certificates.php +++ b/src/Appwrite/Platform/Workers/Certificates.php @@ -136,6 +136,11 @@ class Certificates extends Action $certificate->setAttribute('domain', $domain->get()); } + var_dump([ + 'location' => 'execute.1', + 'certificate' => $certificate + ]); + $success = false; try { @@ -184,6 +189,10 @@ class Certificates extends Action } finally { // All actions result in new updatedAt date $certificate->setAttribute('updated', DateTime::now()); + var_dump([ + 'location' => 'execute.2', + 'certificate' => $certificate + ]); // Save all changes we made to certificate document into database $this->saveCertificateDocument($domain->get(), $certificate, $success, $dbForPlatform, $queueForEvents, $queueForFunctions);