-
Notifications
You must be signed in to change notification settings - Fork 3
/
backup.php
179 lines (150 loc) · 5.63 KB
/
backup.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
<?php
return [
'backup' => [
/*
* The name of this application. You can use this name to monitor
* the backups.
*/
'name' => config('app.name'),
'source' => [
'files' => [
/*
* The list of directories and files that will be included in the backup.
*/
'include' => [
storage_path('app'),
],
/*
* These directories and files will be excluded from the backup.
*
* Directories used by the backup process will automatically be excluded.
*/
'exclude' => [
storage_path('app/backup-temp'),
storage_path('app/' . config('app.name')),
storage_path('app/.gitignore'),
],
/*
* 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.
*/
'databases' => [
'mysql',
],
],
/*
* The database dump can be gzipped to decrease diskspace usage.
*/
'gzip_database_dump' => true,
'destination' => [
/*
* The filename prefix used for the backup zip file.
*/
'filename_prefix' => 'backup_',
/*
* The disk names on which the backups will be stored.
*/
'disks' => [
'local',
'google'
],
],
],
/*
* 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', 'slack'],
\Spatie\Backup\Notifications\Notifications\UnhealthyBackupWasFound::class => ['mail', 'slack'],
\Spatie\Backup\Notifications\Notifications\CleanupHasFailed::class => ['mail', 'slack'],
\Spatie\Backup\Notifications\Notifications\BackupWasSuccessful::class => ['slack'],
\Spatie\Backup\Notifications\Notifications\HealthyBackupWasFound::class => ['slack'],
\Spatie\Backup\Notifications\Notifications\CleanupWasSuccessful::class => ['slack'],
],
/*
* 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('ADMIN_EMAIL'),
],
'slack' => [
'webhook_url' => env('SLACK_MSG_URL'),
/*
* If this is set to null the default channel of the webhook will be used.
*/
'channel' => env('SLACK_MSG_CHANNEL'),
],
],
/*
* 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' => config('app.name'),
'disks' => ['local', 'google'],
'newestBackupsShouldNotBeOlderThanDays' => 1,
'storageUsedMayNotBeHigherThanMegabytes' => 5000,
],
/*
[
'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' => 5000,
],
],
];