|
| 1 | +<?php |
| 2 | + |
| 3 | +return [ |
| 4 | + |
| 5 | + 'backup' => [ |
| 6 | + |
| 7 | + /* |
| 8 | + * The name of this application. You can use this name to monitor |
| 9 | + * the backups. |
| 10 | + */ |
| 11 | + 'name' => env('APP_NAME', 'laravel-backup'), |
| 12 | + |
| 13 | + 'source' => [ |
| 14 | + |
| 15 | + 'files' => [ |
| 16 | + |
| 17 | + /* |
| 18 | + * The list of directories and files that will be included in the backup. |
| 19 | + */ |
| 20 | + 'include' => [ |
| 21 | + //base_path(), |
| 22 | + ], |
| 23 | + |
| 24 | + /* |
| 25 | + * These directories and files will be excluded from the backup. |
| 26 | + * |
| 27 | + * Directories used by the backup process will automatically be excluded. |
| 28 | + */ |
| 29 | + 'exclude' => [ |
| 30 | + base_path('vendor'), |
| 31 | + base_path('node_modules'), |
| 32 | + ], |
| 33 | + |
| 34 | + /* |
| 35 | + * Determines if symlinks should be followed. |
| 36 | + */ |
| 37 | + 'follow_links' => false, |
| 38 | + |
| 39 | + /* |
| 40 | + * Determines if it should avoid unreadable folders. |
| 41 | + */ |
| 42 | + 'ignore_unreadable_directories' => false, |
| 43 | + |
| 44 | + /* |
| 45 | + * This path is used to make directories in resulting zip-file relative |
| 46 | + * Set to `null` to include complete absolute path |
| 47 | + * Example: base_path() |
| 48 | + */ |
| 49 | + 'relative_path' => null, |
| 50 | + ], |
| 51 | + |
| 52 | + /* |
| 53 | + * The names of the connections to the databases that should be backed up |
| 54 | + * MySQL, PostgreSQL, SQLite and Mongo databases are supported. |
| 55 | + * |
| 56 | + * The content of the database dump may be customized for each connection |
| 57 | + * by adding a 'dump' key to the connection settings in config/database.php. |
| 58 | + * E.g. |
| 59 | + * 'mysql' => [ |
| 60 | + * ... |
| 61 | + * 'dump' => [ |
| 62 | + * 'excludeTables' => [ |
| 63 | + * 'table_to_exclude_from_backup', |
| 64 | + * 'another_table_to_exclude' |
| 65 | + * ] |
| 66 | + * ], |
| 67 | + * ], |
| 68 | + * |
| 69 | + * If you are using only InnoDB tables on a MySQL server, you can |
| 70 | + * also supply the useSingleTransaction option to avoid table locking. |
| 71 | + * |
| 72 | + * E.g. |
| 73 | + * 'mysql' => [ |
| 74 | + * ... |
| 75 | + * 'dump' => [ |
| 76 | + * 'useSingleTransaction' => true, |
| 77 | + * ], |
| 78 | + * ], |
| 79 | + * |
| 80 | + * For a complete list of available customization options, see https://github.com/spatie/db-dumper |
| 81 | + */ |
| 82 | + 'databases' => [ |
| 83 | + 'sqlite', |
| 84 | + ], |
| 85 | + ], |
| 86 | + |
| 87 | + /* |
| 88 | + * The database dump can be compressed to decrease disk space usage. |
| 89 | + * |
| 90 | + * Out of the box Laravel-backup supplies |
| 91 | + * Spatie\DbDumper\Compressors\GzipCompressor::class. |
| 92 | + * |
| 93 | + * You can also create custom compressor. More info on that here: |
| 94 | + * https://github.com/spatie/db-dumper#using-compression |
| 95 | + * |
| 96 | + * If you do not want any compressor at all, set it to null. |
| 97 | + */ |
| 98 | + 'database_dump_compressor' => null, |
| 99 | + |
| 100 | + /* |
| 101 | + * If specified, the database dumped file name will contain a timestamp (e.g.: 'Y-m-d-H-i-s'). |
| 102 | + */ |
| 103 | + 'database_dump_file_timestamp_format' => null, |
| 104 | + |
| 105 | + /* |
| 106 | + * The file extension used for the database dump files. |
| 107 | + * |
| 108 | + * If not specified, the file extension will be .archive for MongoDB and .sql for all other databases |
| 109 | + * The file extension should be specified without a leading . |
| 110 | + */ |
| 111 | + 'database_dump_file_extension' => '', |
| 112 | + |
| 113 | + 'destination' => [ |
| 114 | + /* |
| 115 | + * The compression algorithm to be used for creating the zip archive. |
| 116 | + * |
| 117 | + * If backing up only database, you may choose gzip compression for db dump and no compression at zip. |
| 118 | + * |
| 119 | + * Some common algorithms are listed below: |
| 120 | + * ZipArchive::CM_STORE (no compression at all; set 0 as compression level) |
| 121 | + * ZipArchive::CM_DEFAULT |
| 122 | + * ZipArchive::CM_DEFLATE |
| 123 | + * ZipArchive::CM_BZIP2 |
| 124 | + * ZipArchive::CM_XZ |
| 125 | + * |
| 126 | + * For more check https://www.php.net/manual/zip.constants.php and confirm it's supported by your system. |
| 127 | + */ |
| 128 | + 'compression_method' => ZipArchive::CM_DEFAULT, |
| 129 | + |
| 130 | + /* |
| 131 | + * The compression level corresponding to the used algorithm; an integer between 0 and 9. |
| 132 | + * |
| 133 | + * Check supported levels for the chosen algorithm, usually 1 means the fastest and weakest compression, |
| 134 | + * while 9 the slowest and strongest one. |
| 135 | + * |
| 136 | + * Setting of 0 for some algorithms may switch to the strongest compression. |
| 137 | + */ |
| 138 | + 'compression_level' => 9, |
| 139 | + |
| 140 | + /* |
| 141 | + * The filename prefix used for the backup zip file. |
| 142 | + */ |
| 143 | + 'filename_prefix' => '', |
| 144 | + |
| 145 | + /* |
| 146 | + * The disk names on which the backups will be stored. |
| 147 | + */ |
| 148 | + 'disks' => [ |
| 149 | + 'local', |
| 150 | + ], |
| 151 | + ], |
| 152 | + |
| 153 | + /* |
| 154 | + * The directory where the temporary files will be stored. |
| 155 | + */ |
| 156 | + 'temporary_directory' => storage_path('app/backup-temp'), |
| 157 | + |
| 158 | + /* |
| 159 | + * The password to be used for archive encryption. |
| 160 | + * Set to `null` to disable encryption. |
| 161 | + */ |
| 162 | + 'password' => env('BACKUP_ARCHIVE_PASSWORD'), |
| 163 | + |
| 164 | + /* |
| 165 | + * The encryption algorithm to be used for archive encryption. |
| 166 | + * You can set it to `null` or `false` to disable encryption. |
| 167 | + * |
| 168 | + * When set to 'default', we'll use ZipArchive::EM_AES_256 if it is |
| 169 | + * available on your system. |
| 170 | + */ |
| 171 | + 'encryption' => 'default', |
| 172 | + |
| 173 | + /** |
| 174 | + * The number of attempts, in case the backup command encounters an exception |
| 175 | + */ |
| 176 | + 'tries' => 1, |
| 177 | + |
| 178 | + /** |
| 179 | + * The number of seconds to wait before attempting a new backup if the previous try failed |
| 180 | + * Set to `0` for none |
| 181 | + */ |
| 182 | + 'retry_delay' => 0, |
| 183 | + ], |
| 184 | + |
| 185 | + /* |
| 186 | + * You can get notified when specific events occur. Out of the box you can use 'mail' and 'slack'. |
| 187 | + * For Slack you need to install laravel/slack-notification-channel. |
| 188 | + * |
| 189 | + * You can also use your own notification classes, just make sure the class is named after one of |
| 190 | + * the `Spatie\Backup\Notifications\Notifications` classes. |
| 191 | + */ |
| 192 | + 'notifications' => [ |
| 193 | + |
| 194 | + 'notifications' => [ |
| 195 | + // \Spatie\Backup\Notifications\Notifications\BackupHasFailedNotification::class => ['mail'], |
| 196 | + // \Spatie\Backup\Notifications\Notifications\UnhealthyBackupWasFoundNotification::class => ['mail'], |
| 197 | + // \Spatie\Backup\Notifications\Notifications\CleanupHasFailedNotification::class => ['mail'], |
| 198 | + //\Spatie\Backup\Notifications\Notifications\BackupWasSuccessfulNotification::class => ['mail'], |
| 199 | + //\Spatie\Backup\Notifications\Notifications\HealthyBackupWasFoundNotification::class => ['mail'], |
| 200 | + //\Spatie\Backup\Notifications\Notifications\CleanupWasSuccessfulNotification::class => ['mail'], |
| 201 | + ], |
| 202 | + |
| 203 | + /* |
| 204 | + * Here you can specify the notifiable to which the notifications should be sent. The default |
| 205 | + * notifiable will use the variables specified in this config file. |
| 206 | + */ |
| 207 | + 'notifiable' => \Spatie\Backup\Notifications\Notifiable::class, |
| 208 | + |
| 209 | + 'mail' => [ |
| 210 | + |
| 211 | + |
| 212 | + 'from' => [ |
| 213 | + 'address' => env( 'MAIL_FROM_ADDRESS', '[email protected]'), |
| 214 | + 'name' => env('MAIL_FROM_NAME', 'Example'), |
| 215 | + ], |
| 216 | + ], |
| 217 | + |
| 218 | + 'slack' => [ |
| 219 | + 'webhook_url' => '', |
| 220 | + |
| 221 | + /* |
| 222 | + * If this is set to null the default channel of the webhook will be used. |
| 223 | + */ |
| 224 | + 'channel' => null, |
| 225 | + |
| 226 | + 'username' => null, |
| 227 | + |
| 228 | + 'icon' => null, |
| 229 | + |
| 230 | + ], |
| 231 | + |
| 232 | + 'discord' => [ |
| 233 | + 'webhook_url' => '', |
| 234 | + |
| 235 | + /* |
| 236 | + * If this is an empty string, the name field on the webhook will be used. |
| 237 | + */ |
| 238 | + 'username' => '', |
| 239 | + |
| 240 | + /* |
| 241 | + * If this is an empty string, the avatar on the webhook will be used. |
| 242 | + */ |
| 243 | + 'avatar_url' => '', |
| 244 | + ], |
| 245 | + ], |
| 246 | + |
| 247 | + /* |
| 248 | + * Here you can specify which backups should be monitored. |
| 249 | + * If a backup does not meet the specified requirements the |
| 250 | + * UnHealthyBackupWasFound event will be fired. |
| 251 | + */ |
| 252 | + 'monitor_backups' => [ |
| 253 | + [ |
| 254 | + 'name' => env('APP_NAME', 'laravel-backup'), |
| 255 | + 'disks' => ['local'], |
| 256 | + 'health_checks' => [ |
| 257 | + \Spatie\Backup\Tasks\Monitor\HealthChecks\MaximumAgeInDays::class => 1, |
| 258 | + \Spatie\Backup\Tasks\Monitor\HealthChecks\MaximumStorageInMegabytes::class => 5000, |
| 259 | + ], |
| 260 | + ], |
| 261 | + |
| 262 | + /* |
| 263 | + [ |
| 264 | + 'name' => 'name of the second app', |
| 265 | + 'disks' => ['local', 's3'], |
| 266 | + 'health_checks' => [ |
| 267 | + \Spatie\Backup\Tasks\Monitor\HealthChecks\MaximumAgeInDays::class => 1, |
| 268 | + \Spatie\Backup\Tasks\Monitor\HealthChecks\MaximumStorageInMegabytes::class => 5000, |
| 269 | + ], |
| 270 | + ], |
| 271 | + */ |
| 272 | + ], |
| 273 | + |
| 274 | + 'cleanup' => [ |
| 275 | + /* |
| 276 | + * The strategy that will be used to cleanup old backups. The default strategy |
| 277 | + * will keep all backups for a certain amount of days. After that period only |
| 278 | + * a daily backup will be kept. After that period only weekly backups will |
| 279 | + * be kept and so on. |
| 280 | + * |
| 281 | + * No matter how you configure it the default strategy will never |
| 282 | + * delete the newest backup. |
| 283 | + */ |
| 284 | + 'strategy' => \Spatie\Backup\Tasks\Cleanup\Strategies\DefaultStrategy::class, |
| 285 | + |
| 286 | + 'default_strategy' => [ |
| 287 | + |
| 288 | + /* |
| 289 | + * The number of days for which backups must be kept. |
| 290 | + */ |
| 291 | + 'keep_all_backups_for_days' => 7, |
| 292 | + |
| 293 | + /* |
| 294 | + * After the "keep_all_backups_for_days" period is over, the most recent backup |
| 295 | + * of that day will be kept. Older backups within the same day will be removed. |
| 296 | + * If you create backups only once a day, no backups will be removed yet. |
| 297 | + */ |
| 298 | + 'keep_daily_backups_for_days' => 16, |
| 299 | + |
| 300 | + /* |
| 301 | + * After the "keep_daily_backups_for_days" period is over, the most recent backup |
| 302 | + * of that week will be kept. Older backups within the same week will be removed. |
| 303 | + * If you create backups only once a week, no backups will be removed yet. |
| 304 | + */ |
| 305 | + 'keep_weekly_backups_for_weeks' => 8, |
| 306 | + |
| 307 | + /* |
| 308 | + * After the "keep_weekly_backups_for_weeks" period is over, the most recent backup |
| 309 | + * of that month will be kept. Older backups within the same month will be removed. |
| 310 | + */ |
| 311 | + 'keep_monthly_backups_for_months' => 4, |
| 312 | + |
| 313 | + /* |
| 314 | + * After the "keep_monthly_backups_for_months" period is over, the most recent backup |
| 315 | + * of that year will be kept. Older backups within the same year will be removed. |
| 316 | + */ |
| 317 | + 'keep_yearly_backups_for_years' => 2, |
| 318 | + |
| 319 | + /* |
| 320 | + * After cleaning up the backups remove the oldest backup until |
| 321 | + * this amount of megabytes has been reached. |
| 322 | + */ |
| 323 | + 'delete_oldest_backups_when_using_more_megabytes_than' => 5000, |
| 324 | + ], |
| 325 | + |
| 326 | + /** |
| 327 | + * The number of attempts, in case the cleanup command encounters an exception |
| 328 | + */ |
| 329 | + 'tries' => 1, |
| 330 | + |
| 331 | + /** |
| 332 | + * The number of seconds to wait before attempting a new cleanup if the previous try failed |
| 333 | + * Set to `0` for none |
| 334 | + */ |
| 335 | + 'retry_delay' => 0, |
| 336 | + ], |
| 337 | + |
| 338 | +]; |
0 commit comments