I moved to a new server with Hetzner and set up all with Ploi and set up cron schedule, Horizon daemon and what not. But 4-5 hrs ago several jobs should have run to backup projects and application but nothing got sent to Digital Ocean Spaces . Using Spatie Backup "spatie/laravel-backup": "^8.1",.
I checked the schedule / crontab and things do run:
php artisan schedule:list |grep backup
0 1 * * * php artisan backup:clean ........ Next Due: 19 hours from now
0 2 * * * php artisan backup:run .......... Next Due: 20 hours from now
0 2 * * * php artisan backup:projects ..... Next Due: 20 hours from now
0 0 * * 7 php artisan backup-client:projects Next Due: 18 hours from now
0 1 * * * php artisan clean:backup ........ Next Due: 19 hours from now
date
Sat Apr 8 05:04:43 CEST 2023
I checked cat ~/staging.site.com/current/storage/logs/laravel.log but no errors related to backups.
Data in .env as as before migration for storing at DO Spaces:
DO_KEY=key
DO_SECRET=secret_key
DO_REGION=ams3
DO_BUCKET=smt-client-projects
DO_ENDPOINT=https://ams3.digitaloceanspaces.com
DO_URL=https://some-thing-nice.ams3.cdn.digitaloceanspaces.com
DO_BACKUP_BUCKET=smtapp
I did not get notification though still set in backup.php
'notifications' => [
'notifications' => [
\Spatie\Backup\Notifications\Notifications\BackupHasFailedNotification::class => ['mail'],
\Spatie\Backup\Notifications\Notifications\UnhealthyBackupWasFoundNotification::class => ['mail'],
\Spatie\Backup\Notifications\Notifications\CleanupHasFailedNotification::class => ['mail'],
\Spatie\Backup\Notifications\Notifications\BackupWasSuccessfulNotification::class => ['mail'],
\Spatie\Backup\Notifications\Notifications\HealthyBackupWasFoundNotification::class => ['mail'],
\Spatie\Backup\Notifications\Notifications\CleanupWasSuccessfulNotification::class => ['mail'],
],
but emails on initial project are sent with these same settings and port:
MAIL_DRIVER=smtp
MAIL_HOST=smtp.sendgrid.net
MAIL_PORT=587
and Hetzner only blocks on other ports
Outgoing traffic to ports 25 and 465 are blocked by default on all Cloud Servers
PAGE_CONTENT.LIMITS.REQUEST_FORBIDDEN.WARNING
so it seems that email via Sendgrid works just fine. Even checked Sendgrid logs and welcome emails are being sent without issues.
Tried to run a notification via Tinker but got stuck on values needed to test a failure and I am also not sure if this would work via Tinker..
php artisan tinker
Psy Shell v0.11.12 (PHP 8.1.17 — cli) by Justin Hileman
> use Spatie\Backup\Notifications\Notifications\BackupHasFailedNotification;
> $user = App\Models\Auth\User::find(1);
= App\Models\Auth\User {#5070
id: 1,
role_id: 3,
company_id: 1,
user_group_id: null,
...
email: "[email protected]",
avatar: null,
....
deleted_at: null,
is_sent_welcome: 1,
lang: null,
first_name: null,
last_name: null,
}
> $exception = new \Exception('Backup has failed due to an error.');
= Exception {#5064
#message: "Backup has failed due to an error.",
#file: "/home/ploi/staging.site.com/releases/11/vendor/psy/psysh/src/ExecutionLoopClosure.php(53) : eval()'d code",
#line: 1,
}
> $user->notify(new BackupHasFailedNotification($exception));
TypeError Spatie\Backup\Notifications\Notifications\BackupHasFailedNotification::__construct(): Argument #1 ($event) must be of type Spatie\Backup\Events\BackupHasFailed, Exception given, called in /home/ploi/staging.sitecomeval()'d code on line 1.
So why do I not get backups at Digital Ocean Spaces and why no emails on failure nor success?