backup.php 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182
  1. <?php
  2. return [
  3. 'backup' => [
  4. /*
  5. * The name of this application. You can use this name to monitor
  6. * the backups.
  7. */
  8. 'name' => config('app.name'),
  9. 'source' => [
  10. 'files' => [
  11. /*
  12. * The list of directories and files that will be included in the backup.
  13. */
  14. 'include' => [
  15. base_path(),
  16. ],
  17. /*
  18. * These directories and files will be excluded from the backup.
  19. *
  20. * Directories used by the backup process will automatically be excluded.
  21. */
  22. 'exclude' => [
  23. base_path('vendor'),
  24. base_path('node_modules'),
  25. ],
  26. /*
  27. * Determines if symlinks should be followed.
  28. */
  29. 'followLinks' => false,
  30. ],
  31. /*
  32. * The names of the connections to the databases that should be backed up
  33. * MySQL, PostgreSQL, SQLite and Mongo databases are supported.
  34. */
  35. 'databases' => [
  36. 'mysql',
  37. ],
  38. ],
  39. /*
  40. * The database dump can be gzipped to decrease diskspace usage.
  41. */
  42. 'gzip_database_dump' => false,
  43. 'destination' => [
  44. /*
  45. * The filename prefix used for the backup zip file.
  46. */
  47. 'filename_prefix' => '',
  48. /*
  49. * The disk names on which the backups will be stored.
  50. */
  51. 'disks' => [
  52. 'local',
  53. ],
  54. ],
  55. ],
  56. /*
  57. * You can get notified when specific events occur. Out of the box you can use 'mail' and 'slack'.
  58. * For Slack you need to install guzzlehttp/guzzle.
  59. *
  60. * You can also use your own notification classes, just make sure the class is named after one of
  61. * the `Spatie\Backup\Events` classes.
  62. */
  63. 'notifications' => [
  64. 'notifications' => [
  65. \Spatie\Backup\Notifications\Notifications\BackupHasFailed::class => ['mail'],
  66. \Spatie\Backup\Notifications\Notifications\UnhealthyBackupWasFound::class => ['mail'],
  67. \Spatie\Backup\Notifications\Notifications\CleanupHasFailed::class => ['mail'],
  68. \Spatie\Backup\Notifications\Notifications\BackupWasSuccessful::class => ['mail'],
  69. \Spatie\Backup\Notifications\Notifications\HealthyBackupWasFound::class => ['mail'],
  70. \Spatie\Backup\Notifications\Notifications\CleanupWasSuccessful::class => ['mail'],
  71. ],
  72. /*
  73. * Here you can specify the notifiable to which the notifications should be sent. The default
  74. * notifiable will use the variables specified in this config file.
  75. */
  76. 'notifiable' => \Spatie\Backup\Notifications\Notifiable::class,
  77. 'mail' => [
  78. 'to' => '',
  79. ],
  80. 'slack' => [
  81. 'webhook_url' => '',
  82. /*
  83. * If this is set to null the default channel of the webhook will be used.
  84. */
  85. 'channel' => null,
  86. 'username' => null,
  87. 'icon' => null,
  88. ],
  89. ],
  90. /*
  91. * Here you can specify which backups should be monitored.
  92. * If a backup does not meet the specified requirements the
  93. * UnHealthyBackupWasFound event will be fired.
  94. */
  95. 'monitorBackups' => [
  96. [
  97. 'name' => config('app.name'),
  98. 'disks' => ['local'],
  99. 'newestBackupsShouldNotBeOlderThanDays' => 1,
  100. 'storageUsedMayNotBeHigherThanMegabytes' => 5000,
  101. ],
  102. /*
  103. [
  104. 'name' => 'name of the second app',
  105. 'disks' => ['local', 's3'],
  106. 'newestBackupsShouldNotBeOlderThanDays' => 1,
  107. 'storageUsedMayNotBeHigherThanMegabytes' => 5000,
  108. ],
  109. */
  110. ],
  111. 'cleanup' => [
  112. /*
  113. * The strategy that will be used to cleanup old backups. The default strategy
  114. * will keep all backups for a certain amount of days. After that period only
  115. * a daily backup will be kept. After that period only weekly backups will
  116. * be kept and so on.
  117. *
  118. * No matter how you configure it the default strategy will never
  119. * delete the newest backup.
  120. */
  121. 'strategy' => \Spatie\Backup\Tasks\Cleanup\Strategies\DefaultStrategy::class,
  122. 'defaultStrategy' => [
  123. /*
  124. * The number of days for which backups must be kept.
  125. */
  126. 'keepAllBackupsForDays' => 7,
  127. /*
  128. * The number of days for which daily backups must be kept.
  129. */
  130. 'keepDailyBackupsForDays' => 16,
  131. /*
  132. * The number of weeks for which one weekly backup must be kept.
  133. */
  134. 'keepWeeklyBackupsForWeeks' => 8,
  135. /*
  136. * The number of months for which one monthly backup must be kept.
  137. */
  138. 'keepMonthlyBackupsForMonths' => 4,
  139. /*
  140. * The number of years for which one yearly backup must be kept.
  141. */
  142. 'keepYearlyBackupsForYears' => 2,
  143. /*
  144. * After cleaning up the backups remove the oldest backup until
  145. * this amount of megabytes has been reached.
  146. */
  147. 'deleteOldestBackupsWhenUsingMoreMegabytesThan' => 5000,
  148. ],
  149. ],
  150. ];