backup.php 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210
  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. * The content of the database dump may be customized for each connection
  36. * by adding a 'dump' key to the connection settings in config/database.php.
  37. * E.g.
  38. * 'mysql' => [
  39. * ...
  40. * 'dump' => [
  41. * 'excludeTables' => [
  42. * 'table_to_exclude_from_backup',
  43. * 'another_table_to_exclude'
  44. * ]
  45. * ]
  46. * ],
  47. *
  48. * For a complete list of available customization options, see https://github.com/spatie/db-dumper
  49. */
  50. 'databases' => [
  51. 'mysql',
  52. ],
  53. ],
  54. /*
  55. * The database dump can be compressed to decrease diskspace usage.
  56. *
  57. * Out of the box Laravel-backup supplies
  58. * Spatie\DbDumper\Compressors\GzipCompressor::class.
  59. *
  60. * You can also create custom compressor. More info on that here:
  61. * https://github.com/spatie/db-dumper#using-compression
  62. *
  63. * If you do not want any compressor at all, set it to null.
  64. */
  65. 'database_dump_compressor' => null,
  66. 'destination' => [
  67. /*
  68. * The filename prefix used for the backup zip file.
  69. */
  70. 'filename_prefix' => '',
  71. /*
  72. * The disk names on which the backups will be stored.
  73. */
  74. 'disks' => [
  75. 'local',
  76. ],
  77. ],
  78. /*
  79. * The directory where the temporary files will be stored.
  80. */
  81. 'temporary_directory' => storage_path('app/backup-temp'),
  82. ],
  83. /*
  84. * You can get notified when specific events occur. Out of the box you can use 'mail' and 'slack'.
  85. * For Slack you need to install guzzlehttp/guzzle.
  86. *
  87. * You can also use your own notification classes, just make sure the class is named after one of
  88. * the `Spatie\Backup\Events` classes.
  89. */
  90. 'notifications' => [
  91. 'notifications' => [
  92. \Spatie\Backup\Notifications\Notifications\BackupHasFailed::class => ['mail'],
  93. \Spatie\Backup\Notifications\Notifications\UnhealthyBackupWasFound::class => ['mail'],
  94. \Spatie\Backup\Notifications\Notifications\CleanupHasFailed::class => ['mail'],
  95. \Spatie\Backup\Notifications\Notifications\BackupWasSuccessful::class => ['mail'],
  96. \Spatie\Backup\Notifications\Notifications\HealthyBackupWasFound::class => ['mail'],
  97. \Spatie\Backup\Notifications\Notifications\CleanupWasSuccessful::class => ['mail'],
  98. ],
  99. /*
  100. * Here you can specify the notifiable to which the notifications should be sent. The default
  101. * notifiable will use the variables specified in this config file.
  102. */
  103. 'notifiable' => \Spatie\Backup\Notifications\Notifiable::class,
  104. 'mail' => [
  105. 'to' => 'your@example.com',
  106. ],
  107. 'slack' => [
  108. 'webhook_url' => '',
  109. /*
  110. * If this is set to null the default channel of the webhook will be used.
  111. */
  112. 'channel' => null,
  113. 'username' => null,
  114. 'icon' => null,
  115. ],
  116. ],
  117. /*
  118. * Here you can specify which backups should be monitored.
  119. * If a backup does not meet the specified requirements the
  120. * UnHealthyBackupWasFound event will be fired.
  121. */
  122. 'monitorBackups' => [
  123. [
  124. 'name' => config('app.name'),
  125. 'disks' => ['local'],
  126. 'newestBackupsShouldNotBeOlderThanDays' => 1,
  127. 'storageUsedMayNotBeHigherThanMegabytes' => 5000,
  128. ],
  129. /*
  130. [
  131. 'name' => 'name of the second app',
  132. 'disks' => ['local', 's3'],
  133. 'newestBackupsShouldNotBeOlderThanDays' => 1,
  134. 'storageUsedMayNotBeHigherThanMegabytes' => 5000,
  135. ],
  136. */
  137. ],
  138. 'cleanup' => [
  139. /*
  140. * The strategy that will be used to cleanup old backups. The default strategy
  141. * will keep all backups for a certain amount of days. After that period only
  142. * a daily backup will be kept. After that period only weekly backups will
  143. * be kept and so on.
  144. *
  145. * No matter how you configure it the default strategy will never
  146. * delete the newest backup.
  147. */
  148. 'strategy' => \Spatie\Backup\Tasks\Cleanup\Strategies\DefaultStrategy::class,
  149. 'defaultStrategy' => [
  150. /*
  151. * The number of days for which backups must be kept.
  152. */
  153. 'keepAllBackupsForDays' => 7,
  154. /*
  155. * The number of days for which daily backups must be kept.
  156. */
  157. 'keepDailyBackupsForDays' => 16,
  158. /*
  159. * The number of weeks for which one weekly backup must be kept.
  160. */
  161. 'keepWeeklyBackupsForWeeks' => 8,
  162. /*
  163. * The number of months for which one monthly backup must be kept.
  164. */
  165. 'keepMonthlyBackupsForMonths' => 4,
  166. /*
  167. * The number of years for which one yearly backup must be kept.
  168. */
  169. 'keepYearlyBackupsForYears' => 2,
  170. /*
  171. * After cleaning up the backups remove the oldest backup until
  172. * this amount of megabytes has been reached.
  173. */
  174. 'deleteOldestBackupsWhenUsingMoreMegabytesThan' => 5000,
  175. ],
  176. ],
  177. ];