backup.php 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255
  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' => env('APP_NAME', 'pixelfed-backup'),
  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('.git'),
  24. base_path('storage/app/public/cache'),
  25. base_path('vendor'),
  26. base_path('node_modules'),
  27. ],
  28. /*
  29. * Determines if symlinks should be followed.
  30. */
  31. 'follow_links' => false,
  32. /*
  33. * Determines if it should avoid unreadable folders.
  34. */
  35. 'ignore_unreadable_directories' => false,
  36. /*
  37. * This path is used to make directories in resulting zip-file relative
  38. * Set to `null` to include complete absolute path
  39. * Example: base_path()
  40. */
  41. 'relative_path' => null,
  42. ],
  43. /*
  44. * The names of the connections to the databases that should be backed up
  45. * MySQL, PostgreSQL, SQLite and Mongo databases are supported.
  46. *
  47. * For a complete list of available customization options, see https://github.com/spatie/db-dumper
  48. */
  49. 'mysql' => [
  50. 'dump' => [
  51. 'useSingleTransaction' => true,
  52. 'useQuick' => true
  53. ],
  54. ],
  55. 'databases' => [
  56. 'mysql',
  57. ],
  58. ],
  59. /*
  60. * The database dump can be compressed to decrease diskspace usage.
  61. *
  62. * Out of the box Laravel-backup supplies
  63. * Spatie\DbDumper\Compressors\GzipCompressor::class.
  64. *
  65. * You can also create custom compressor. More info on that here:
  66. * https://github.com/spatie/db-dumper#using-compression
  67. *
  68. * If you do not want any compressor at all, set it to null.
  69. */
  70. 'database_dump_compressor' => Spatie\DbDumper\Compressors\Bzip2Compressor::class,
  71. /*
  72. * The file extension used for the database dump files.
  73. *
  74. * If not specified, the file extension will be .archive for MongoDB and .sql for all other databases
  75. * The file extension should be specified without a leading .
  76. */
  77. 'database_dump_file_extension' => '',
  78. 'destination' => [
  79. /*
  80. * The filename prefix used for the backup zip file.
  81. */
  82. 'filename_prefix' => '',
  83. /*
  84. * The disk names on which the backups will be stored.
  85. */
  86. 'disks' => [
  87. 'local',
  88. ],
  89. ],
  90. /*
  91. * The directory where the temporary files will be stored.
  92. */
  93. 'temporary_directory' => storage_path('app/backup-temp'),
  94. /*
  95. * The password to be used for archive encryption.
  96. * Set to `null` to disable encryption.
  97. */
  98. 'password' => env('BACKUP_ARCHIVE_PASSWORD'),
  99. /*
  100. * The encryption algorithm to be used for archive encryption.
  101. * You can set it to `null` or `false` to disable encryption.
  102. *
  103. * When set to 'default', we'll use ZipArchive::EM_AES_256 if it is
  104. * available on your system.
  105. */
  106. 'encryption' => 'default',
  107. ],
  108. /*
  109. * You can get notified when specific events occur. Out of the box you can use 'mail' and 'slack'.
  110. * For Slack you need to install laravel/slack-notification-channel.
  111. *
  112. * You can also use your own notification classes, just make sure the class is named after one of
  113. * the `Spatie\Backup\Notifications\Notifications` classes.
  114. */
  115. 'notifications' => [
  116. 'notifications' => [
  117. \Spatie\Backup\Notifications\Notifications\BackupHasFailedNotification::class => ['mail'],
  118. \Spatie\Backup\Notifications\Notifications\UnhealthyBackupWasFoundNotification::class => ['mail'],
  119. \Spatie\Backup\Notifications\Notifications\CleanupHasFailedNotification::class => ['mail'],
  120. \Spatie\Backup\Notifications\Notifications\BackupWasSuccessfulNotification::class => ['mail'],
  121. \Spatie\Backup\Notifications\Notifications\HealthyBackupWasFoundNotification::class => ['mail'],
  122. \Spatie\Backup\Notifications\Notifications\CleanupWasSuccessfulNotification::class => ['mail'],
  123. ],
  124. /*
  125. * Here you can specify the notifiable to which the notifications should be sent. The default
  126. * notifiable will use the variables specified in this config file.
  127. */
  128. 'notifiable' => \Spatie\Backup\Notifications\Notifiable::class,
  129. 'mail' => [
  130. 'to' => env('BACKUP_EMAIL_ADDRESS', ''),
  131. 'from' => [
  132. 'address' => env('MAIL_FROM_ADDRESS', 'hello@example.com'),
  133. 'name' => env('MAIL_FROM_NAME', 'Example'),
  134. ],
  135. ],
  136. 'slack' => [
  137. 'webhook_url' => '',
  138. /*
  139. * If this is set to null the default channel of the webhook will be used.
  140. */
  141. 'channel' => null,
  142. 'username' => null,
  143. 'icon' => null,
  144. ],
  145. 'discord' => [
  146. 'webhook_url' => '',
  147. /*
  148. * If this is an empty string, the name field on the webhook will be used.
  149. */
  150. 'username' => '',
  151. /*
  152. * If this is an empty string, the avatar on the webhook will be used.
  153. */
  154. 'avatar_url' => '',
  155. ],
  156. ],
  157. /*
  158. * Here you can specify which backups should be monitored.
  159. * If a backup does not meet the specified requirements the
  160. * UnHealthyBackupWasFound event will be fired.
  161. */
  162. 'monitor_backups' => [
  163. [
  164. 'name' => env('APP_NAME', 'pixelfed-backup'),
  165. 'disks' => ['local'],
  166. 'health_checks' => [
  167. \Spatie\Backup\Tasks\Monitor\HealthChecks\MaximumAgeInDays::class => 1,
  168. \Spatie\Backup\Tasks\Monitor\HealthChecks\MaximumStorageInMegabytes::class => 5000,
  169. ],
  170. ],
  171. ],
  172. 'cleanup' => [
  173. /*
  174. * The strategy that will be used to cleanup old backups. The default strategy
  175. * will keep all backups for a certain amount of days. After that period only
  176. * a daily backup will be kept. After that period only weekly backups will
  177. * be kept and so on.
  178. *
  179. * No matter how you configure it the default strategy will never
  180. * delete the newest backup.
  181. */
  182. 'strategy' => \Spatie\Backup\Tasks\Cleanup\Strategies\DefaultStrategy::class,
  183. 'default_strategy' => [
  184. /*
  185. * The number of days for which backups must be kept.
  186. */
  187. 'keep_all_backups_for_days' => 7,
  188. /*
  189. * The number of days for which daily backups must be kept.
  190. */
  191. 'keep_daily_backups_for_days' => 16,
  192. /*
  193. * The number of weeks for which one weekly backup must be kept.
  194. */
  195. 'keep_weekly_backups_for_weeks' => 8,
  196. /*
  197. * The number of months for which one monthly backup must be kept.
  198. */
  199. 'keep_monthly_backups_for_months' => 4,
  200. /*
  201. * The number of years for which one yearly backup must be kept.
  202. */
  203. 'keep_yearly_backups_for_years' => 2,
  204. /*
  205. * After cleaning up the backups remove the oldest backup until
  206. * this amount of megabytes has been reached.
  207. */
  208. 'delete_oldest_backups_when_using_more_megabytes_than' => 5000,
  209. ],
  210. ],
  211. ];