mirror of
https://github.com/Kovah/LinkAce.git
synced 2025-01-17 21:28:30 +01:00
Correct the setup of backup notifications (#155)
Also optimize the Docker Compose files to include the path for local backups.
This commit is contained in:
parent
f9d569f24a
commit
e9bdf442ae
@ -31,7 +31,7 @@ BACKUP_DISK=cloud
|
||||
BACKUP_NOTIFICATIONS=true
|
||||
# The notification email may be used to get backup notifications
|
||||
BACKUP_NOTIFICATION_EMAIL=your@email.com
|
||||
# Maximum size of the backups in megabytes
|
||||
# Maximum size of all backups in megabytes
|
||||
BACKUP_MAX_SIZE=512
|
||||
|
||||
|
||||
|
@ -31,7 +31,7 @@ BACKUP_DISK=cloud
|
||||
BACKUP_NOTIFICATIONS=true
|
||||
# The notification email may be used to get backup notifications
|
||||
BACKUP_NOTIFICATION_EMAIL=your@email.com
|
||||
# Maximum size of the backups in megabytes
|
||||
# Maximum size of all backups in megabytes
|
||||
BACKUP_MAX_SIZE=512
|
||||
|
||||
|
||||
|
@ -15,7 +15,7 @@
|
||||
"league/csv": "^9.6",
|
||||
"predis/predis": "^1.1",
|
||||
"shaarli/netscape-bookmark-parser": "^2.1",
|
||||
"spatie/laravel-backup": "6.11.1",
|
||||
"spatie/laravel-backup": "^6.11",
|
||||
"venturecraft/revisionable": "^1.34"
|
||||
},
|
||||
"require-dev": {
|
||||
|
33
composer.lock
generated
33
composer.lock
generated
@ -4,7 +4,7 @@
|
||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||
"This file is @generated automatically"
|
||||
],
|
||||
"content-hash": "a709d5af83f68feb6d56834394a3142f",
|
||||
"content-hash": "931ce41ac7fae7b010cf2bd6c6e39f63",
|
||||
"packages": [
|
||||
{
|
||||
"name": "brick/math",
|
||||
@ -2556,36 +2556,37 @@
|
||||
},
|
||||
{
|
||||
"name": "spatie/laravel-backup",
|
||||
"version": "6.11.1",
|
||||
"version": "6.11.4",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/spatie/laravel-backup.git",
|
||||
"reference": "3ede36961b79b6ea4a6b5f708f2cc60fee74ad6c"
|
||||
"reference": "3aea94ae9a326871b702ccc358e91683d7782666"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/spatie/laravel-backup/zipball/3ede36961b79b6ea4a6b5f708f2cc60fee74ad6c",
|
||||
"reference": "3ede36961b79b6ea4a6b5f708f2cc60fee74ad6c",
|
||||
"url": "https://api.github.com/repos/spatie/laravel-backup/zipball/3aea94ae9a326871b702ccc358e91683d7782666",
|
||||
"reference": "3aea94ae9a326871b702ccc358e91683d7782666",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"illuminate/console": "^5.8.15|^6.0|^7.0",
|
||||
"illuminate/contracts": "^5.8.15|^6.0|^7.0",
|
||||
"illuminate/events": "^5.8.15|^6.0|^7.0",
|
||||
"illuminate/filesystem": "^5.8.15|^6.0|^7.0",
|
||||
"illuminate/notifications": "^5.8.15|^6.0|^7.0",
|
||||
"illuminate/support": "^5.8.15|^6.0|^7.0",
|
||||
"illuminate/console": "^5.8.15|^6.0|^7.0|^8.0",
|
||||
"illuminate/contracts": "^5.8.15|^6.0|^7.0|^8.0",
|
||||
"illuminate/events": "^5.8.15|^6.0|^7.0|^8.0",
|
||||
"illuminate/filesystem": "^5.8.15|^6.0|^7.0|^8.0",
|
||||
"illuminate/notifications": "^5.8.15|^6.0|^7.0|^8.0",
|
||||
"illuminate/support": "^5.8.15|^6.0|^7.0|^8.0",
|
||||
"league/flysystem": "^1.0.49",
|
||||
"php": "^7.2",
|
||||
"php": "^7.3",
|
||||
"spatie/db-dumper": "^2.12",
|
||||
"spatie/temporary-directory": "^1.1",
|
||||
"symfony/finder": "^4.2|^5.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"friendsofphp/php-cs-fixer": "^2.16",
|
||||
"laravel/slack-notification-channel": "^1.0",
|
||||
"league/flysystem-aws-s3-v3": "^1.0",
|
||||
"mockery/mockery": "^1.3",
|
||||
"orchestra/testbench": "3.8.*|4.*|5.*",
|
||||
"orchestra/testbench": "3.8.*|4.*|5.*|6.*",
|
||||
"phpunit/phpunit": "^8.4|^9.0"
|
||||
},
|
||||
"suggest": {
|
||||
@ -2637,7 +2638,7 @@
|
||||
"type": "github"
|
||||
}
|
||||
],
|
||||
"time": "2020-06-18T09:59:06+00:00"
|
||||
"time": "2020-09-30T06:58:20+00:00"
|
||||
},
|
||||
{
|
||||
"name": "spatie/temporary-directory",
|
||||
@ -3207,7 +3208,7 @@
|
||||
},
|
||||
{
|
||||
"name": "symfony/finder",
|
||||
"version": "v5.1.6",
|
||||
"version": "v5.1.7",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/finder.git",
|
||||
@ -4391,7 +4392,7 @@
|
||||
},
|
||||
{
|
||||
"name": "symfony/process",
|
||||
"version": "v5.1.6",
|
||||
"version": "v5.1.7",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/process.git",
|
||||
|
@ -1,213 +0,0 @@
|
||||
<?php
|
||||
|
||||
use App\Models\User;
|
||||
|
||||
return [
|
||||
|
||||
'backup' => [
|
||||
|
||||
/*
|
||||
* The name of this application. You can use this name to monitor
|
||||
* the backups.
|
||||
*/
|
||||
'name' => 'backups',
|
||||
|
||||
'source' => [
|
||||
|
||||
'files' => [
|
||||
|
||||
/*
|
||||
* The list of directories and files that will be included in the backup.
|
||||
*/
|
||||
'include' => [
|
||||
base_path(),
|
||||
],
|
||||
|
||||
/*
|
||||
* These directories and files will be excluded from the backup.
|
||||
*
|
||||
* Directories used by the backup process will automatically be excluded.
|
||||
*/
|
||||
'exclude' => [
|
||||
base_path('vendor'),
|
||||
base_path('node_modules'),
|
||||
storage_path('app/backups'),
|
||||
],
|
||||
|
||||
/*
|
||||
* Determines if symlinks should be followed.
|
||||
*/
|
||||
'followLinks' => false,
|
||||
],
|
||||
|
||||
/*
|
||||
* The names of the connections to the databases that should be backed up
|
||||
* MySQL, PostgreSQL, SQLite and Mongo databases are supported.
|
||||
*
|
||||
* The content of the database dump may be customized for each connection
|
||||
* by adding a 'dump' key to the connection settings in config/database.php.
|
||||
* E.g.
|
||||
* 'mysql' => [
|
||||
* ...
|
||||
* 'dump' => [
|
||||
* 'excludeTables' => [
|
||||
* 'table_to_exclude_from_backup',
|
||||
* 'another_table_to_exclude'
|
||||
* ]
|
||||
* ]
|
||||
* ],
|
||||
*
|
||||
* For a complete list of available customization options, see https://github.com/spatie/db-dumper
|
||||
*/
|
||||
'databases' => [
|
||||
'mysql',
|
||||
],
|
||||
],
|
||||
|
||||
/*
|
||||
* The database dump can be compressed to decrease diskspace usage.
|
||||
*
|
||||
* Out of the box Laravel-backup supplies
|
||||
* Spatie\DbDumper\Compressors\GzipCompressor::class.
|
||||
*
|
||||
* You can also create custom compressor. More info on that here:
|
||||
* https://github.com/spatie/db-dumper#using-compression
|
||||
*
|
||||
* If you do not want any compressor at all, set it to null.
|
||||
*/
|
||||
'database_dump_compressor' => Spatie\DbDumper\Compressors\GzipCompressor::class,
|
||||
|
||||
'destination' => [
|
||||
|
||||
/*
|
||||
* The filename prefix used for the backup zip file.
|
||||
*/
|
||||
'filename_prefix' => '',
|
||||
|
||||
/*
|
||||
* The disk names on which the backups will be stored.
|
||||
*/
|
||||
'disks' => [
|
||||
env('BACKUP_DISK', 'local_backups'),
|
||||
],
|
||||
],
|
||||
|
||||
/*
|
||||
* The directory where the temporary files will be stored.
|
||||
*/
|
||||
'temporary_directory' => storage_path('app/backup-temp'),
|
||||
],
|
||||
|
||||
/*
|
||||
* You can get notified when specific events occur. Out of the box you can use 'mail' and 'slack'.
|
||||
* For Slack you need to install guzzlehttp/guzzle.
|
||||
*
|
||||
* You can also use your own notification classes, just make sure the class is named after one of
|
||||
* the `Spatie\Backup\Events` classes.
|
||||
*/
|
||||
'notifications' => [
|
||||
|
||||
'notifications' => [
|
||||
\Spatie\Backup\Notifications\Notifications\BackupHasFailed::class => ['mail'],
|
||||
\Spatie\Backup\Notifications\Notifications\UnhealthyBackupWasFound::class => ['mail'],
|
||||
\Spatie\Backup\Notifications\Notifications\CleanupHasFailed::class => ['mail'],
|
||||
\Spatie\Backup\Notifications\Notifications\BackupWasSuccessful::class => ['mail'],
|
||||
\Spatie\Backup\Notifications\Notifications\HealthyBackupWasFound::class => ['mail'],
|
||||
\Spatie\Backup\Notifications\Notifications\CleanupWasSuccessful::class => ['mail'],
|
||||
],
|
||||
|
||||
/*
|
||||
* Here you can specify the notifiable to which the notifications should be sent. The default
|
||||
* notifiable will use the variables specified in this config file.
|
||||
*/
|
||||
'notifiable' => \Spatie\Backup\Notifications\Notifiable::class,
|
||||
|
||||
'mail' => [
|
||||
'to' => env('BACKUP_NOTIFICATION_EMAIL') ?: User::find(1)->mail ?? null,
|
||||
],
|
||||
|
||||
'slack' => [
|
||||
'webhook_url' => '',
|
||||
|
||||
/*
|
||||
* If this is set to null the default channel of the webhook will be used.
|
||||
*/
|
||||
'channel' => null,
|
||||
|
||||
'username' => null,
|
||||
|
||||
'icon' => null,
|
||||
|
||||
],
|
||||
],
|
||||
|
||||
/*
|
||||
* Here you can specify which backups should be monitored.
|
||||
* If a backup does not meet the specified requirements the
|
||||
* UnHealthyBackupWasFound event will be fired.
|
||||
*/
|
||||
'monitorBackups' => [
|
||||
[
|
||||
'name' => 'backups',
|
||||
'disks' => [env('BACKUP_DISK', 'local_backups')],
|
||||
'newestBackupsShouldNotBeOlderThanDays' => 1,
|
||||
'storageUsedMayNotBeHigherThanMegabytes' => env('BACKUP_MAX_SIZE', 512),
|
||||
],
|
||||
|
||||
/*
|
||||
[
|
||||
'name' => 'name of the second app',
|
||||
'disks' => ['local', 's3'],
|
||||
'newestBackupsShouldNotBeOlderThanDays' => 1,
|
||||
'storageUsedMayNotBeHigherThanMegabytes' => 5000,
|
||||
],
|
||||
*/
|
||||
],
|
||||
|
||||
'cleanup' => [
|
||||
/*
|
||||
* The strategy that will be used to cleanup old backups. The default strategy
|
||||
* will keep all backups for a certain amount of days. After that period only
|
||||
* a daily backup will be kept. After that period only weekly backups will
|
||||
* be kept and so on.
|
||||
*
|
||||
* No matter how you configure it the default strategy will never
|
||||
* delete the newest backup.
|
||||
*/
|
||||
'strategy' => \Spatie\Backup\Tasks\Cleanup\Strategies\DefaultStrategy::class,
|
||||
|
||||
'defaultStrategy' => [
|
||||
|
||||
/*
|
||||
* The number of days for which backups must be kept.
|
||||
*/
|
||||
'keepAllBackupsForDays' => 7,
|
||||
|
||||
/*
|
||||
* The number of days for which daily backups must be kept.
|
||||
*/
|
||||
'keepDailyBackupsForDays' => 16,
|
||||
|
||||
/*
|
||||
* The number of weeks for which one weekly backup must be kept.
|
||||
*/
|
||||
'keepWeeklyBackupsForWeeks' => 8,
|
||||
|
||||
/*
|
||||
* The number of months for which one monthly backup must be kept.
|
||||
*/
|
||||
'keepMonthlyBackupsForMonths' => 4,
|
||||
|
||||
/*
|
||||
* The number of years for which one yearly backup must be kept.
|
||||
*/
|
||||
'keepYearlyBackupsForYears' => 2,
|
||||
|
||||
/*
|
||||
* After cleaning up the backups remove the oldest backup until
|
||||
* this amount of megabytes has been reached.
|
||||
*/
|
||||
'deleteOldestBackupsWhenUsingMoreMegabytesThan' => env('BACKUP_MAX_SIZE', 512),
|
||||
],
|
||||
],
|
||||
];
|
@ -2,6 +2,8 @@
|
||||
|
||||
use App\Models\User;
|
||||
|
||||
$backupNotificationChannel = env('BACKUP_NOTIFICATIONS', true) ? [env('BACKUP_CHANNEL', true)] : [];
|
||||
|
||||
return [
|
||||
|
||||
'backup' => [
|
||||
@ -99,7 +101,7 @@ return [
|
||||
* The disk names on which the backups will be stored.
|
||||
*/
|
||||
'disks' => [
|
||||
env('BACKUP_DISK', 'local_backups'),
|
||||
env('BACKUP_DISK', 'local'),
|
||||
],
|
||||
],
|
||||
|
||||
@ -119,12 +121,12 @@ return [
|
||||
'notifications' => [
|
||||
|
||||
'notifications' => [
|
||||
\Spatie\Backup\Notifications\Notifications\BackupHasFailed::class => ['mail'],
|
||||
\Spatie\Backup\Notifications\Notifications\UnhealthyBackupWasFound::class => ['mail'],
|
||||
\Spatie\Backup\Notifications\Notifications\CleanupHasFailed::class => ['mail'],
|
||||
\Spatie\Backup\Notifications\Notifications\BackupWasSuccessful::class => ['mail'],
|
||||
\Spatie\Backup\Notifications\Notifications\HealthyBackupWasFound::class => ['mail'],
|
||||
\Spatie\Backup\Notifications\Notifications\CleanupWasSuccessful::class => ['mail'],
|
||||
\Spatie\Backup\Notifications\Notifications\BackupHasFailed::class => $backupNotificationChannel,
|
||||
\Spatie\Backup\Notifications\Notifications\UnhealthyBackupWasFound::class => $backupNotificationChannel,
|
||||
\Spatie\Backup\Notifications\Notifications\CleanupHasFailed::class => $backupNotificationChannel,
|
||||
\Spatie\Backup\Notifications\Notifications\BackupWasSuccessful::class => $backupNotificationChannel,
|
||||
\Spatie\Backup\Notifications\Notifications\HealthyBackupWasFound::class => $backupNotificationChannel,
|
||||
\Spatie\Backup\Notifications\Notifications\CleanupWasSuccessful::class => $backupNotificationChannel,
|
||||
],
|
||||
|
||||
/*
|
||||
@ -138,16 +140,16 @@ return [
|
||||
],
|
||||
|
||||
'slack' => [
|
||||
'webhook_url' => '',
|
||||
'webhook_url' => env('BACKUP_NOTIFICATION_SLACK_WEBHOOK', ''),
|
||||
|
||||
/*
|
||||
* If this is set to null the default channel of the webhook will be used.
|
||||
*/
|
||||
'channel' => null,
|
||||
'channel' => env('BACKUP_NOTIFICATION_SLACK_CHANNEL', null),
|
||||
|
||||
'username' => null,
|
||||
'username' => env('BACKUP_NOTIFICATION_SLACK_USERNAME', null),
|
||||
|
||||
'icon' => null,
|
||||
'icon' => env('BACKUP_NOTIFICATION_SLACK_ICON', null),
|
||||
|
||||
],
|
||||
],
|
||||
@ -166,17 +168,6 @@ return [
|
||||
\Spatie\Backup\Tasks\Monitor\HealthChecks\MaximumStorageInMegabytes::class => env('BACKUP_MAX_SIZE', 512),
|
||||
],
|
||||
],
|
||||
|
||||
/*
|
||||
[
|
||||
'name' => 'name of the second app',
|
||||
'disks' => ['local', 's3'],
|
||||
'health_checks' => [
|
||||
\Spatie\Backup\Tasks\Monitor\HealthChecks\MaximumAgeInDays::class => 1,
|
||||
\Spatie\Backup\Tasks\Monitor\HealthChecks\MaximumStorageInMegabytes::class => 5000,
|
||||
],
|
||||
],
|
||||
*/
|
||||
],
|
||||
|
||||
'cleanup' => [
|
||||
|
@ -24,9 +24,12 @@ services:
|
||||
- "0.0.0.0:80:8080"
|
||||
#- "0.0.0.0:443:8443"
|
||||
volumes:
|
||||
- ./logs:/app/storage/logs
|
||||
- ./.env:/app/.env
|
||||
- ./nginx-simple.conf:/opt/docker/etc/nginx/conf.d/linkace.conf:ro
|
||||
- ./logs:/app/storage/logs
|
||||
# Remove the hash of the following line if you want to use local backups
|
||||
#- ./backups:/app/storage/app/backups
|
||||
# Remove the hash of the following line if you are using HTTPS
|
||||
#- /path/to/your/ssl/certificates:/opt/docker/etc/nginx/ssl
|
||||
|
||||
volumes:
|
||||
|
@ -22,8 +22,10 @@ services:
|
||||
- db
|
||||
volumes:
|
||||
- linkace_app:/app
|
||||
- ./logs:/app/storage/logs
|
||||
- ./.env:/app/.env
|
||||
- ./logs:/app/storage/logs
|
||||
# Remove the hash of the following line if you want to use local backups
|
||||
#- ./backups:/app/storage/app/backups
|
||||
|
||||
# --- nginx
|
||||
nginx:
|
||||
|
@ -7,9 +7,9 @@ expose_php = Off
|
||||
; resource limits
|
||||
; ---------------
|
||||
|
||||
max_execution_time = 30
|
||||
max_input_time = 60
|
||||
memory_limit = 128M
|
||||
max_execution_time = 90
|
||||
max_input_time = 90
|
||||
memory_limit = -1
|
||||
upload_max_filesize = 20M
|
||||
post_max_size = 20M
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user