Giter Site home page Giter Site logo

zymawy / backupmanager Goto Github PK

View Code? Open in Web Editor NEW

This project forked from laravel-backpack/backupmanager

0.0 2.0 0.0 130 KB

Admin interface for managing DB backups and file backups in Laravel 5.2-5.6

Home Page: http://backpackforlaravel.com

License: Other

PHP 85.10% HTML 14.90%

backupmanager's Introduction

Backpack\BackupManager

Latest Version on Packagist Software License Build Status Coverage Status Quality Score Style CI Total Downloads

An admin interface for spatie/laravel-backup. Allows the admin to easily manage backups (download and delete). Used in the Backpack package, on Laravel 5.2+

Security updates and breaking changes

Please subscribe to the Backpack Newsletter so you can find out about any security updates, breaking changes or major features. We send an email every 1-2 months. Backpack\BackupManager screenshot

Install

  1. In your terminal
# Install the package
composer require backpack/backupmanager

# Publish the config file and lang files:
php artisan vendor:publish --provider="Backpack\BackupManager\BackupManagerServiceProvider"  --tag=config

# [optional] Add a sidebar_content item for it
php artisan backpack:base:add-sidebar-content "<li><a href='{{ url(config('backpack.base.route_prefix', 'admin').'/backup') }}'><i class='fa fa-hdd-o'></i> <span>Backups</span></a></li>"
  1. Add a new "disk" to config/filesystems.php:
        // used for Backpack/BackupManager
        'backups' => [
            'driver' => 'local',
            'root'   => storage_path('backups'), // that's where your backups are stored by default: storage/backups
        ],

This is where you choose a different driver if you want your backups to be stored somewhere else (S3, Dropbox, Google Drive, Box, etc).

  1. [optional] Modify your backup options in config/backup.php, then run php artisan backup:run to make sure it's still working.

  2. [optional] Instruct Laravel to run the backups automatically in your console kernel:

// app/Console/Kernel.php

protected function schedule(Schedule $schedule)
{
   $schedule->command('backup:clean')->daily()->at('04:00');
   $schedule->command('backup:run')->daily()->at('05:00');
}
  1. Check that it works

If the "unknown error" yellow bubble is thrown and you see the "Backup failed because The dump process failed with exitcode 127 : Command not found." error in the log file, either mysqldump / pg_dump is not installed or you need to specify its location.

You can do that in your config/database.php file, where you define your database credentials, by adding the dump variables. Example for Mac OS X's MAMP:

'mysql' => [
            'driver'            => 'mysql',
            'host'              => env('DB_HOST', 'localhost'),
            'database'          => env('DB_DATABASE', 'forge'),
            'username'          => env('DB_USERNAME', 'forge'),
            'password'          => env('DB_PASSWORD', ''),
            'charset'           => 'utf8',
            'collation'         => 'utf8_unicode_ci',
            'prefix'            => '',
            'strict'            => false,
            'engine'            => null,
            'dump' => [
               'dump_binary_path' => '/Applications/MAMP/Library/bin/', // only the path, so without `mysqldump` or `pg_dump`; this is a working example from MAMP on Mac OS
               'use_single_transaction',
               'timeout' => 60 * 5, // 5 minute timeout
               // 'exclude_tables' => ['table1', 'table2'],
               // 'add_extra_option' => '--optionname=optionvalue',
            ]
        ],

Usage

Point and click, baby. Point and click.

Try at your-project-domain/admin/backup

Upgrading from 1.2.x to 1.3.x

  1. change your required version to "backpack/backupmanager": "^1.3", and run composer update;
  2. delete the old config file (too many changes, including namechange): rm config/laravel-backup.php
  3. republish the config files: php artisan vendor:publish --provider="Backpack\BackupManager\BackupManagerServiceProvider"
  4. change your db configuration in config/database.php to use the new dump configuration (all options in one array; the example below is for MAMP on MacOS):
            'dump' => [
               'dump_binary_path' => '/Applications/MAMP/Library/bin/', // only the path, so without `mysqldump` or `pg_dump`
               'use_single_transaction',
               'timeout' => 60 * 5, // 5 minute timeout
               // 'exclude_tables' => ['table1', 'table2'],
               // 'add_extra_option' => '--optionname=optionvalue',
            ]
  1. Create a backup in the interface to test it works. If it doesn't try php artisan backup:run to see what the problem is.

Upgrading from 1.1.x to 1.2.x

  1. change your required version to "backpack/backupmanager": "^1.2",;
  2. the only breaking change is that the config/database.php dump variables are now inside an array. Please see the step 8 above, copy-paste the dump array from there and customize;

Change log

Please see CHANGELOG for more information what has changed recently.

Testing

$ composer test

Contributing

Please see CONTRIBUTING for details.

Overwriting Functionality

If you need to modify how this works in a project:

  • create a routes/backpack/backupmanager.php file; the package will see that, and load your routes file, instead of the one in the package;
  • create controllers/models that extend the ones in the package, and use those in your new routes file;
  • modify anything you'd like in the new controllers/models;

Security

If you discover any security related issues, please email [email protected] instead of using the issue tracker.

Please subscribe to the Backpack Newsletter so you can find out about any security updates, breaking changes or major features. We send an email every 1-2 months.

Credits

License

Backpack is free for non-commercial use and 39 EUR/project for commercial use. Please see License File and backpackforlaravel.com for more information.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.