spatie / laravel-backup

A package to backup your Laravel app
https://spatie.be/docs/laravel-backup
MIT License
5.63k stars 763 forks source link

SOLVED: Backup failed because: Db connection `google` uses an unsupported driver ``. Only `mysql` and `pgsql` are supported. #571

Closed rizwansaleem70 closed 6 years ago

rizwansaleem70 commented 6 years ago

First of all I would like to thank you for this amazing package. I'm using Laravel 5.4. I have installed Laravel-backup v3.

Files and database backup is perfectly done on local disk but I want to upload it to Google Drive as well. For this purpose I've included a package "nao-pon/flysystem-google-drive". I've tested it in a controller and its working fine. Files are uploading on my drive.

But when I gave destination 'disks' -> 'google'. I'm getting this error while taking backup.

"Backup failed because: Db connectiongoogleuses an unsupported driver ``. Onlymysqlandpgsqlare supported."

That's my laravel-backup.php `<?php

return [

'backup' => [

    /*
     * The name of this application. You can use this name to monitor
     * the backups.
     */
    'name' => env('APP_URL'),

    'source' => [

        'files' => [

            /*
             * The list of directories that should be part of the backup. You can
             * specify individual files as well.
             */
            'include' => [
                base_path(),
            ],

            /*
             * These directories will be excluded from the backup.
             * You can specify individual files as well.
             */
            'exclude' => [
                base_path('vendor'),
                // base_path('node_modules'),
                // storage_path(),
            ],

            /*
             * Determines if symlinks should be followed.
             */
            'followLinks' => false,
        ],

        /*
         * The names of the connections to the databases that should be part of the backup.
         * Currently only MySQL and PostgreSQL databases are supported.
         */
        'databases' => [
            'google',
        ],
    ],

    'destination' => [

        /*
         * The disk names on which the backups will be stored.
         */
        'disks' => [
            'local', 'google'
        ],
    ],
],

'cleanup' => [
    /*
     * The strategy that will be used to cleanup old backups.
     * The youngest backup will never be deleted.
     */
    'strategy' => \Spatie\Backup\Tasks\Cleanup\Strategies\DefaultStrategy::class,

    'defaultStrategy' => [

        /*
         * The number of days for which all backups must be kept.
         */
        'keepAllBackupsForDays' => 7,

        /*
         * The number of days for which all daily backups must be kept.
         */
        'keepDailyBackupsForDays' => 16,

        /*
         * The number of weeks for which all one weekly backup must be kept.
         */
        'keepWeeklyBackupsForWeeks' => 8,

        /*
         * The number of months for which one monthly backup must be kept.
         */
        'keepMonthlyBackupsForMonths' => 4,

        /*
         * The number of years for which one yearly backup must be kept.
         */
        'keepYearlyBackupsForYears' => 2,

        /*
         * After cleaning up backups, remove the oldest backup until
         * this number of megabytes has been reached.
         */
        'deleteOldestBackupsWhenUsingMoreMegabytesThan' => 5000,
    ],
],

/*
 *  In this array you can specify which backups should be monitored.
 *  If a backup does not meet the specified requirements, the
 *  UnHealthyBackupWasFound event will be fired.
 */
'monitorBackups' => [
    [
        'name' => env('APP_URL'),
        'disks' => ['local'],
        'newestBackupsShouldNotBeOlderThanDays' => 1,
        'storageUsedMayNotBeHigherThanMegabytes' => 5000,
    ],

    /*
    [
        'name' => 'name of the second app',
        'disks' => ['local', 's3'],
        'newestBackupsShouldNotBeOlderThanDays' => 1,
        'storageUsedMayNotBeHigherThanMegabytes' => 5000,
    ],
    */
],

'notifications' => [

    /*
     * This class will be used to send all notifications.
     */
    'handler' => Spatie\Backup\Notifications\Notifier::class,

    /*
     * Here you can specify the ways you want to be notified when certain
     * events take place. Possible values are "log", "mail", "slack",
     * "pushover", and "telegram".
     *
     * Slack requires the installation of the maknz/slack package.
     * Telegram requires the installation of the irazasyed/telegram-bot-sdk package.
     */
    'events' => [
        'whenBackupWasSuccessful'     => ['log'],
        'whenCleanupWasSuccessful'    => ['log'],
        'whenHealthyBackupWasFound'   => ['log'],
        'whenBackupHasFailed'         => ['log'],
        'whenCleanupHasFailed'        => ['log'],
        'whenUnhealthyBackupWasFound' => ['log'],
    ],

    /*
     * Here you can specify how emails should be sent.
     */
    'mail' => [
        'from' => 'admin@xeffectstudio.com',
        'to' => 'rizwansaleem70@gmail.com',
    ],

    /*
     * Here you can specify how messages should be sent to Slack.
     */
    'slack' => [
        'channel' => '#backups',
        'username' => 'Backup bot',
        'icon' => ':robot:',
    ],

    /*
     * Here you can specify how messages should be sent to Pushover.
     */
    'pushover' => [
        'token' => env('PUSHOVER_APP_TOKEN'),
        'user' => env('PUSHOVER_USER_KEY'),
        'sounds' => [
            'success' => env('PUSHOVER_SOUND_SUCCESS', 'pushover'),
            'error' => env('PUSHOVER_SOUND_ERROR', 'siren'),
        ],
    ],

    /*
     * Here you can specify how messages should be sent to Telegram Bot API.
     */
    'telegram' => [
        'bot_token' => env('TELEGRAM_BOT_TOKEN'),
        'chat_id' => env('TELEGRAM_CHAT_ID'),
        'async_requests' => env('TELEGRAM_ASYNC_REQUESTS', false),
        'disable_web_page_preview' => env('TELEGRAM_DISABLE_WEB_PAGE_PREVIEW', true),
    ],
],

]; `

That's filesystems.php `<?php

return [

/*
|--------------------------------------------------------------------------
| Default Filesystem Disk
|--------------------------------------------------------------------------
|
| Here you may specify the default filesystem disk that should be used
| by the framework. The "local" disk, as well as a variety of cloud
| based disks are available to your application. Just store away!
|
*/

'default' => 'local',

/*
|--------------------------------------------------------------------------
| Default Cloud Filesystem Disk
|--------------------------------------------------------------------------
|
| Many applications store files both locally and in the cloud. For this
| reason, you may specify a default "cloud" driver here. This driver
| will be bound as the Cloud disk implementation in the container.
|
*/

'cloud' => 's3',

/*
|--------------------------------------------------------------------------
| Filesystem Disks
|--------------------------------------------------------------------------
|
| Here you may configure as many filesystem "disks" as you wish, and you
| may even configure multiple disks of the same driver. Defaults have
| been setup for each driver as an example of the required options.
|
| Supported Drivers: "local", "ftp", "s3", "rackspace"
|
*/

'disks' => [

    'local' => [
        'driver' => 'local',
        'root' => storage_path('app'),
    ],

    'public' => [
        'driver' => 'local',
        'root' => storage_path('app/public'),
        'url' => env('APP_URL').'/storage',
        'visibility' => 'public',
    ],

    's3' => [
        'driver' => 's3',
        'key' => env('AWS_KEY'),
        'secret' => env('AWS_SECRET'),
        'region' => env('AWS_REGION'),
        'bucket' => env('AWS_BUCKET'),
    ],
    'google' => [
        'driver' => 'google',
        'clientId' => env('GOOGLE_DRIVE_CLIENT_ID'),
        'clientSecret' => env('GOOGLE_DRIVE_CLIENT_SECRET'),
        'refreshToken' => env('GOOGLE_DRIVE_REFRESH_TOKEN'),
        'folderId' => env('GOOGLE_DRIVE_FOLDER_ID'),
    ],
],

];`

can you please tell me what's the issue here and how can I upload backup files directly in Google Drive?

Thanks, Rizwan Saleem

rizwansaleem70 commented 6 years ago

I had mistakenly added google as Db connection. Now solved