Advertisement
Guest User

Untitled

a guest
Jun 23rd, 2018
173
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.26 KB | None | 0 0
  1. composer require spatie/laravel-backup
  2.  
  3. php artisan vendor:publish --provider="SpatieBackupBackupServiceProvider"
  4.  
  5. <?php
  6.  
  7. 'backup' => [
  8.  
  9. /*
  10. * The name of this application. You can use this name to monitor
  11. * the backups.
  12. */
  13. 'name' => config('app.name'),
  14.  
  15. 'source' => [
  16.  
  17. 'files' => [
  18.  
  19. /*
  20. * The list of directories and files that will be included in the backup.
  21. */
  22. 'include' => [
  23. base_path(),
  24. ],
  25.  
  26. /*
  27. * These directories and files will be excluded from the backup.
  28. *
  29. * Directories used by the backup process will automatically be excluded.
  30. */
  31. 'exclude' => [
  32. base_path('vendor'),
  33. base_path('node_modules'),
  34. ],
  35.  
  36. /*
  37. * Determines if symlinks should be followed.
  38. */
  39. 'followLinks' => false,
  40. ],
  41.  
  42. /*
  43. * The names of the connections to the databases that should be backed up
  44. * MySQL, PostgreSQL, SQLite and Mongo databases are supported.
  45. */
  46. 'databases' => [
  47. 'mysql',
  48. ],
  49. ],
  50.  
  51. /*
  52. * The database dump can be gzipped to decrease diskspace usage.
  53. */
  54. 'gzip_database_dump' => false,
  55.  
  56. 'destination' => [
  57.  
  58. /*
  59. * The filename prefix used for the backup zip file.
  60. */
  61. 'filename_prefix' => '',
  62.  
  63. /*
  64. * The disk names on which the backups will be stored.
  65. */
  66. 'disks' => [
  67. 'local',
  68. ],
  69. ],
  70.  
  71. /*
  72. * The directory where the temporary files will be stored.
  73. */
  74. 'temporary_directory' => storage_path('app/backup-temp'),
  75. ],
  76.  
  77. /*
  78. * You can get notified when specific events occur. Out of the box you can use 'mail' and 'slack'.
  79. * For Slack you need to install guzzlehttp/guzzle.
  80. *
  81. * You can also use your own notification classes, just make sure the class is named after one of
  82. * the `SpatieBackupEvents` classes.
  83. */
  84. 'notifications' => [
  85.  
  86. 'notifications' => [
  87. SpatieBackupNotificationsNotificationsBackupHasFailed::class => ['mail'],
  88. SpatieBackupNotificationsNotificationsUnhealthyBackupWasFound::class => ['mail'],
  89. SpatieBackupNotificationsNotificationsCleanupHasFailed::class => ['mail'],
  90. SpatieBackupNotificationsNotificationsBackupWasSuccessful::class => ['mail'],
  91. SpatieBackupNotificationsNotificationsHealthyBackupWasFound::class => ['mail'],
  92. SpatieBackupNotificationsNotificationsCleanupWasSuccessful::class => ['mail'],
  93. ],
  94.  
  95. /*
  96. * Here you can specify the notifiable to which the notifications should be sent. The default
  97. * notifiable will use the variables specified in this config file.
  98. */
  99. 'notifiable' => SpatieBackupNotificationsNotifiable::class,
  100.  
  101. 'mail' => [
  102. 'to' => 'your@example.com',
  103. ],
  104.  
  105. 'slack' => [
  106. 'webhook_url' => '',
  107.  
  108. /*
  109. * If this is set to null the default channel of the webhook will be used.
  110. */
  111. 'channel' => null,
  112.  
  113. 'username' => null,
  114.  
  115. 'icon' => null,
  116.  
  117. ],
  118. ],
  119.  
  120. /*
  121. * Here you can specify which backups should be monitored.
  122. * If a backup does not meet the specified requirements the
  123. * UnHealthyBackupWasFound event will be fired.
  124. */
  125. 'monitorBackups' => [
  126. [
  127. 'name' => config('app.name'),
  128. 'disks' => ['local'],
  129. 'newestBackupsShouldNotBeOlderThanDays' => 1,
  130. 'storageUsedMayNotBeHigherThanMegabytes' => 5000,
  131. ],
  132.  
  133. /*
  134. [
  135. 'name' => 'name of the second app',
  136. 'disks' => ['local', 's3'],
  137. 'newestBackupsShouldNotBeOlderThanDays' => 1,
  138. 'storageUsedMayNotBeHigherThanMegabytes' => 5000,
  139. ],
  140. */
  141. ],
  142.  
  143. 'cleanup' => [
  144. /*
  145. * The strategy that will be used to cleanup old backups. The default strategy
  146. * will keep all backups for a certain amount of days. After that period only
  147. * a daily backup will be kept. After that period only weekly backups will
  148. * be kept and so on.
  149. *
  150. * No matter how you configure it the default strategy will never
  151. * delete the newest backup.
  152. */
  153. 'strategy' => SpatieBackupTasksCleanupStrategiesDefaultStrategy::class,
  154.  
  155. 'defaultStrategy' => [
  156.  
  157. /*
  158. * The number of days for which backups must be kept.
  159. */
  160. 'keepAllBackupsForDays' => 7,
  161.  
  162. /*
  163. * The number of days for which daily backups must be kept.
  164. */
  165. 'keepDailyBackupsForDays' => 16,
  166.  
  167. /*
  168. * The number of weeks for which one weekly backup must be kept.
  169. */
  170. 'keepWeeklyBackupsForWeeks' => 8,
  171.  
  172. /*
  173. * The number of months for which one monthly backup must be kept.
  174. */
  175. 'keepMonthlyBackupsForMonths' => 4,
  176.  
  177. /*
  178. * The number of years for which one yearly backup must be kept.
  179. */
  180. 'keepYearlyBackupsForYears' => 2,
  181.  
  182. /*
  183. * After cleaning up the backups remove the oldest backup until
  184. * this amount of megabytes has been reached.
  185. */
  186. 'deleteOldestBackupsWhenUsingMoreMegabytesThan' => 5000,
  187. ],
  188. ],
  189.  
  190. php artisan backup:run
  191.  
  192. Starting backup...
  193. In BackupDestination.php line 138:
  194. Parse error: syntax error, unexpected '?'
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement