backup.php 5.7 KB

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