diff --git a/app/Models/Backup.php b/app/Models/Backup.php new file mode 100644 index 000000000..663015831 --- /dev/null +++ b/app/Models/Backup.php @@ -0,0 +1,59 @@ + 'int', + 'bytes' => 'int', + ]; + + /** + * @var array + */ + protected $dates = [ + 'completed_at', + ]; + + /** + * Returns dates from this model as immutable Carbon instances. + * + * @param mixed $value + * @return \Carbon\CarbonImmutable + */ + protected function asDateTime($value) + { + return $this->asImmutableDateTime($value); + } +} diff --git a/config/backups.php b/config/backups.php new file mode 100644 index 000000000..57edfee30 --- /dev/null +++ b/config/backups.php @@ -0,0 +1,29 @@ + env('APP_BACKUP_DRIVER', 'local'), + + 'disks' => [ + // There is no configuration for the local disk for Wings. That configuration + // is determined by the Daemon configuration, and not the Panel. + 'local' => [], + + // Configuration for storing backups in Amazon S3. + 's3' => [ + 'region' => '', + 'access_key' => '', + 'access_secret_key' => '', + + // The S3 bucket to use for backups. + 'bucket' => '', + + // The location within the S3 bucket where backups will be stored. Backups + // are stored within a folder using the server's UUID as the name. Each + // backup for that server lives within that folder. + 'location' => '', + ], + ], +]; diff --git a/database/migrations/2020_04_03_230614_create_backups_table.php b/database/migrations/2020_04_03_230614_create_backups_table.php new file mode 100644 index 000000000..963ea9dd7 --- /dev/null +++ b/database/migrations/2020_04_03_230614_create_backups_table.php @@ -0,0 +1,39 @@ +bigIncrements('id'); + $table->char('uuid', 36); + $table->string('name'); + $table->text('contents'); + $table->string('disk'); + $table->string('sha256_hash')->nullable(); + $table->integer('bytes')->default(0); + $table->timestamp('completed_at')->nullable(); + $table->timestamps(); + $table->softDeletes(); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::dropIfExists('backups'); + } +}