diff --git a/.env.example b/.env.example index a7467ae..a091afa 100644 --- a/.env.example +++ b/.env.example @@ -34,5 +34,10 @@ PUSHER_APP_SECRET= GOOGLE_MAPS_KEY= -DOCKER_WORK_DIR=/var/www DOCKER_RESTART=unless-stopped + +# dropbox backup db +DROPBOX_APP_KEY= +DROPBOX_APP_SECRET= +DROPBOX_ACCESS_TOKEN= +DROPBOX_MAIL_NOTIFICATION= \ No newline at end of file diff --git a/app/Console/Kernel.php b/app/Console/Kernel.php index 62a285d..cd3ef25 100644 --- a/app/Console/Kernel.php +++ b/app/Console/Kernel.php @@ -1,4 +1,4 @@ -command('inspire') - // ->hourly(); + $schedule->command('backup:run --only-db')->daily(); } /** @@ -25,7 +24,7 @@ protected function schedule(Schedule $schedule) */ protected function commands() { - $this->load(__DIR__.'/Commands'); + $this->load(__DIR__ . '/Commands'); require base_path('routes/console.php'); } diff --git a/app/Providers/DropboxServiceProvider.php b/app/Providers/DropboxServiceProvider.php new file mode 100644 index 0000000..b435443 --- /dev/null +++ b/app/Providers/DropboxServiceProvider.php @@ -0,0 +1,35 @@ + false]); + + return new FilesystemAdapter($filesystem, $dropboxAdapter); + }); + } +} diff --git a/composer.json b/composer.json index eb0b1b8..72153bb 100644 --- a/composer.json +++ b/composer.json @@ -17,12 +17,15 @@ "php": "^8.3", "ext-intl": "*", "ext-pdo": "*", + "ext-zip": "*", "cviebrock/eloquent-sluggable": "^10.0", "guzzlehttp/guzzle": "^7.2", "laravel/framework": "^v10.35", "laravel/tinker": "~2.1", "laravel/ui": "^4.0", - "smajti1/laravel-wizard": "^1.5" + "smajti1/laravel-wizard": "^1.5", + "spatie/flysystem-dropbox": "^3.0", + "spatie/laravel-backup": "^8.4" }, "require-dev": { "barryvdh/laravel-debugbar": "~3.2", diff --git a/composer.lock b/composer.lock index 18cce59..cb95601 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "d802f65eab52bb44a17fb5636581aa90", + "content-hash": "0e9f595ba2d0d5baf655eaca4f7eb6d8", "packages": [ { "name": "brick/math", @@ -718,6 +718,71 @@ ], "time": "2023-10-12T05:21:21+00:00" }, + { + "name": "graham-campbell/guzzle-factory", + "version": "v7.0.1", + "source": { + "type": "git", + "url": "https://github.com/GrahamCampbell/Guzzle-Factory.git", + "reference": "134f6ca38ad0c948ed7c22552a286bb56b5a5b35" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/GrahamCampbell/Guzzle-Factory/zipball/134f6ca38ad0c948ed7c22552a286bb56b5a5b35", + "reference": "134f6ca38ad0c948ed7c22552a286bb56b5a5b35", + "shasum": "" + }, + "require": { + "guzzlehttp/guzzle": "^7.8.1", + "guzzlehttp/psr7": "^2.6.2", + "php": "^7.4.15 || ^8.0.2" + }, + "require-dev": { + "graham-campbell/analyzer": "^4.1", + "phpunit/phpunit": "^9.6.14 || ^10.5.1" + }, + "type": "library", + "autoload": { + "psr-4": { + "GrahamCampbell\\GuzzleFactory\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Graham Campbell", + "email": "hello@gjcampbell.co.uk", + "homepage": "https://github.com/GrahamCampbell" + } + ], + "description": "Provides A Simple Guzzle Factory With Good Defaults", + "keywords": [ + "Graham Campbell", + "GrahamCampbell", + "Guzzle", + "Guzzle Factory", + "Guzzle-Factory", + "http" + ], + "support": { + "issues": "https://github.com/GrahamCampbell/Guzzle-Factory/issues", + "source": "https://github.com/GrahamCampbell/Guzzle-Factory/tree/v7.0.1" + }, + "funding": [ + { + "url": "https://github.com/GrahamCampbell", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/graham-campbell/guzzle-factory", + "type": "tidelift" + } + ], + "time": "2023-12-03T20:50:24+00:00" + }, { "name": "graham-campbell/result-type", "version": "v1.1.2", @@ -2138,16 +2203,16 @@ }, { "name": "nesbot/carbon", - "version": "2.72.0", + "version": "2.72.1", "source": { "type": "git", "url": "https://github.com/briannesbitt/Carbon.git", - "reference": "a6885fcbad2ec4360b0e200ee0da7d9b7c90786b" + "reference": "2b3b3db0a2d0556a177392ff1a3bf5608fa09f78" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/briannesbitt/Carbon/zipball/a6885fcbad2ec4360b0e200ee0da7d9b7c90786b", - "reference": "a6885fcbad2ec4360b0e200ee0da7d9b7c90786b", + "url": "https://api.github.com/repos/briannesbitt/Carbon/zipball/2b3b3db0a2d0556a177392ff1a3bf5608fa09f78", + "reference": "2b3b3db0a2d0556a177392ff1a3bf5608fa09f78", "shasum": "" }, "require": { @@ -2241,7 +2306,7 @@ "type": "tidelift" } ], - "time": "2023-11-28T10:13:25+00:00" + "time": "2023-12-08T23:47:49+00:00" }, { "name": "nette/schema", @@ -2393,16 +2458,16 @@ }, { "name": "nikic/php-parser", - "version": "v4.17.1", + "version": "v4.18.0", "source": { "type": "git", "url": "https://github.com/nikic/PHP-Parser.git", - "reference": "a6303e50c90c355c7eeee2c4a8b27fe8dc8fef1d" + "reference": "1bcbb2179f97633e98bbbc87044ee2611c7d7999" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/a6303e50c90c355c7eeee2c4a8b27fe8dc8fef1d", - "reference": "a6303e50c90c355c7eeee2c4a8b27fe8dc8fef1d", + "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/1bcbb2179f97633e98bbbc87044ee2611c7d7999", + "reference": "1bcbb2179f97633e98bbbc87044ee2611c7d7999", "shasum": "" }, "require": { @@ -2443,9 +2508,9 @@ ], "support": { "issues": "https://github.com/nikic/PHP-Parser/issues", - "source": "https://github.com/nikic/PHP-Parser/tree/v4.17.1" + "source": "https://github.com/nikic/PHP-Parser/tree/v4.18.0" }, - "time": "2023-08-13T19:53:39+00:00" + "time": "2023-12-10T21:03:43+00:00" }, { "name": "nunomaduro/termwind", @@ -3377,6 +3442,505 @@ }, "time": "2023-12-07T20:40:47+00:00" }, + { + "name": "spatie/db-dumper", + "version": "3.4.0", + "source": { + "type": "git", + "url": "https://github.com/spatie/db-dumper.git", + "reference": "bbd5ae0f331d47e6534eb307e256c11a65c8e24a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/spatie/db-dumper/zipball/bbd5ae0f331d47e6534eb307e256c11a65c8e24a", + "reference": "bbd5ae0f331d47e6534eb307e256c11a65c8e24a", + "shasum": "" + }, + "require": { + "php": "^8.0", + "symfony/process": "^5.0|^6.0" + }, + "require-dev": { + "pestphp/pest": "^1.22" + }, + "type": "library", + "autoload": { + "psr-4": { + "Spatie\\DbDumper\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Freek Van der Herten", + "email": "freek@spatie.be", + "homepage": "https://spatie.be", + "role": "Developer" + } + ], + "description": "Dump databases", + "homepage": "https://github.com/spatie/db-dumper", + "keywords": [ + "database", + "db-dumper", + "dump", + "mysqldump", + "spatie" + ], + "support": { + "source": "https://github.com/spatie/db-dumper/tree/3.4.0" + }, + "funding": [ + { + "url": "https://spatie.be/open-source/support-us", + "type": "custom" + }, + { + "url": "https://github.com/spatie", + "type": "github" + } + ], + "time": "2023-06-27T08:34:52+00:00" + }, + { + "name": "spatie/dropbox-api", + "version": "1.22.0", + "source": { + "type": "git", + "url": "https://github.com/spatie/dropbox-api.git", + "reference": "5b012d68568a560d1cd8888c0be2c2805c4b7c65" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/spatie/dropbox-api/zipball/5b012d68568a560d1cd8888c0be2c2805c4b7c65", + "reference": "5b012d68568a560d1cd8888c0be2c2805c4b7c65", + "shasum": "" + }, + "require": { + "ext-json": "*", + "graham-campbell/guzzle-factory": "^4.0.2|^5.0|^6.0|^7.0", + "guzzlehttp/guzzle": "^6.2|^7.0", + "php": "^8.1" + }, + "require-dev": { + "laravel/pint": "^1.10.1", + "phpstan/phpstan": "^1.10.16", + "phpunit/phpunit": "^9.4" + }, + "type": "library", + "autoload": { + "psr-4": { + "Spatie\\Dropbox\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Alex Vanderbist", + "email": "alex.vanderbist@gmail.com", + "homepage": "https://spatie.be", + "role": "Developer" + }, + { + "name": "Freek Van der Herten", + "email": "freek@spatie.be", + "homepage": "https://spatie.be", + "role": "Developer" + } + ], + "description": "A minimal implementation of Dropbox API v2", + "homepage": "https://github.com/spatie/dropbox-api", + "keywords": [ + "Dropbox-API", + "api", + "dropbox", + "spatie", + "v2" + ], + "support": { + "issues": "https://github.com/spatie/dropbox-api/issues", + "source": "https://github.com/spatie/dropbox-api/tree/1.22.0" + }, + "funding": [ + { + "url": "https://spatie.be/open-source/support-us", + "type": "custom" + }, + { + "url": "https://github.com/spatie", + "type": "github" + } + ], + "time": "2023-06-08T07:13:00+00:00" + }, + { + "name": "spatie/flysystem-dropbox", + "version": "3.0.1", + "source": { + "type": "git", + "url": "https://github.com/spatie/flysystem-dropbox.git", + "reference": "766879111204a6e49412b5ff5989a6654e1b8ae0" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/spatie/flysystem-dropbox/zipball/766879111204a6e49412b5ff5989a6654e1b8ae0", + "reference": "766879111204a6e49412b5ff5989a6654e1b8ae0", + "shasum": "" + }, + "require": { + "league/flysystem": "^3.7.0", + "php": "^8.0", + "spatie/dropbox-api": "^1.17.1" + }, + "require-dev": { + "pestphp/pest": "^1.22", + "phpspec/prophecy-phpunit": "^2.0.1", + "phpunit/phpunit": "^9.5.4" + }, + "type": "library", + "autoload": { + "psr-4": { + "Spatie\\FlysystemDropbox\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Alex Vanderbist", + "email": "alex.vanderbist@gmail.com", + "homepage": "https://spatie.be", + "role": "Developer" + } + ], + "description": "Flysystem Adapter for the Dropbox v2 API", + "homepage": "https://github.com/spatie/flysystem-dropbox", + "keywords": [ + "Flysystem", + "api", + "dropbox", + "flysystem-dropbox", + "spatie", + "v2" + ], + "support": { + "issues": "https://github.com/spatie/flysystem-dropbox/issues", + "source": "https://github.com/spatie/flysystem-dropbox/tree/3.0.1" + }, + "funding": [ + { + "url": "https://spatie.be/open-source/support-us", + "type": "custom" + }, + { + "url": "https://github.com/spatie", + "type": "github" + } + ], + "time": "2023-07-17T07:48:52+00:00" + }, + { + "name": "spatie/laravel-backup", + "version": "8.4.1", + "source": { + "type": "git", + "url": "https://github.com/spatie/laravel-backup.git", + "reference": "b79f790cc856e67cce012abf34bf1c9035085dc1" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/spatie/laravel-backup/zipball/b79f790cc856e67cce012abf34bf1c9035085dc1", + "reference": "b79f790cc856e67cce012abf34bf1c9035085dc1", + "shasum": "" + }, + "require": { + "ext-zip": "^1.14.0", + "illuminate/console": "^10.10.0", + "illuminate/contracts": "^10.10.0", + "illuminate/events": "^10.10.0", + "illuminate/filesystem": "^10.10.0", + "illuminate/notifications": "^10.10.0", + "illuminate/support": "^10.10.0", + "league/flysystem": "^3.0", + "php": "^8.1", + "spatie/db-dumper": "^3.0", + "spatie/laravel-package-tools": "^1.6.2", + "spatie/laravel-signal-aware-command": "^1.2", + "spatie/temporary-directory": "^2.0", + "symfony/console": "^6.0", + "symfony/finder": "^6.0" + }, + "require-dev": { + "composer-runtime-api": "^2.0", + "ext-pcntl": "*", + "laravel/slack-notification-channel": "^2.5", + "league/flysystem-aws-s3-v3": "^2.0|^3.0", + "mockery/mockery": "^1.4", + "nunomaduro/larastan": "^2.1", + "orchestra/testbench": "^8.0", + "pestphp/pest": "^1.20", + "phpstan/extension-installer": "^1.1", + "phpstan/phpstan-deprecation-rules": "^1.0", + "phpstan/phpstan-phpunit": "^1.1" + }, + "suggest": { + "laravel/slack-notification-channel": "Required for sending notifications via Slack" + }, + "type": "library", + "extra": { + "laravel": { + "providers": [ + "Spatie\\Backup\\BackupServiceProvider" + ] + } + }, + "autoload": { + "files": [ + "src/Helpers/functions.php" + ], + "psr-4": { + "Spatie\\Backup\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Freek Van der Herten", + "email": "freek@spatie.be", + "homepage": "https://spatie.be", + "role": "Developer" + } + ], + "description": "A Laravel package to backup your application", + "homepage": "https://github.com/spatie/laravel-backup", + "keywords": [ + "backup", + "database", + "laravel-backup", + "spatie" + ], + "support": { + "issues": "https://github.com/spatie/laravel-backup/issues", + "source": "https://github.com/spatie/laravel-backup/tree/8.4.1" + }, + "funding": [ + { + "url": "https://github.com/sponsors/spatie", + "type": "github" + }, + { + "url": "https://spatie.be/open-source/support-us", + "type": "other" + } + ], + "time": "2023-11-20T08:21:45+00:00" + }, + { + "name": "spatie/laravel-package-tools", + "version": "1.16.1", + "source": { + "type": "git", + "url": "https://github.com/spatie/laravel-package-tools.git", + "reference": "cc7c991555a37f9fa6b814aa03af73f88026a83d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/spatie/laravel-package-tools/zipball/cc7c991555a37f9fa6b814aa03af73f88026a83d", + "reference": "cc7c991555a37f9fa6b814aa03af73f88026a83d", + "shasum": "" + }, + "require": { + "illuminate/contracts": "^9.28|^10.0", + "php": "^8.0" + }, + "require-dev": { + "mockery/mockery": "^1.5", + "orchestra/testbench": "^7.7|^8.0", + "pestphp/pest": "^1.22", + "phpunit/phpunit": "^9.5.24", + "spatie/pest-plugin-test-time": "^1.1" + }, + "type": "library", + "autoload": { + "psr-4": { + "Spatie\\LaravelPackageTools\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Freek Van der Herten", + "email": "freek@spatie.be", + "role": "Developer" + } + ], + "description": "Tools for creating Laravel packages", + "homepage": "https://github.com/spatie/laravel-package-tools", + "keywords": [ + "laravel-package-tools", + "spatie" + ], + "support": { + "issues": "https://github.com/spatie/laravel-package-tools/issues", + "source": "https://github.com/spatie/laravel-package-tools/tree/1.16.1" + }, + "funding": [ + { + "url": "https://github.com/spatie", + "type": "github" + } + ], + "time": "2023-08-23T09:04:39+00:00" + }, + { + "name": "spatie/laravel-signal-aware-command", + "version": "1.3.0", + "source": { + "type": "git", + "url": "https://github.com/spatie/laravel-signal-aware-command.git", + "reference": "46cda09a85aef3fd47fb73ddc7081f963e255571" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/spatie/laravel-signal-aware-command/zipball/46cda09a85aef3fd47fb73ddc7081f963e255571", + "reference": "46cda09a85aef3fd47fb73ddc7081f963e255571", + "shasum": "" + }, + "require": { + "illuminate/contracts": "^8.35|^9.0|^10.0", + "php": "^8.0", + "spatie/laravel-package-tools": "^1.4.3" + }, + "require-dev": { + "brianium/paratest": "^6.2", + "ext-pcntl": "*", + "nunomaduro/collision": "^5.3|^6.0", + "orchestra/testbench": "^6.16|^7.0|^8.0", + "pestphp/pest-plugin-laravel": "^1.3", + "phpunit/phpunit": "^9.5", + "spatie/laravel-ray": "^1.17" + }, + "type": "library", + "extra": { + "laravel": { + "providers": [ + "Spatie\\SignalAwareCommand\\SignalAwareCommandServiceProvider" + ], + "aliases": { + "Signal": "Spatie\\SignalAwareCommand\\Facades\\Signal" + } + } + }, + "autoload": { + "psr-4": { + "Spatie\\SignalAwareCommand\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Freek Van der Herten", + "email": "freek@spatie.be", + "role": "Developer" + } + ], + "description": "Handle signals in artisan commands", + "homepage": "https://github.com/spatie/laravel-signal-aware-command", + "keywords": [ + "laravel", + "laravel-signal-aware-command", + "spatie" + ], + "support": { + "issues": "https://github.com/spatie/laravel-signal-aware-command/issues", + "source": "https://github.com/spatie/laravel-signal-aware-command/tree/1.3.0" + }, + "funding": [ + { + "url": "https://github.com/spatie", + "type": "github" + } + ], + "time": "2023-01-14T21:10:59+00:00" + }, + { + "name": "spatie/temporary-directory", + "version": "2.2.0", + "source": { + "type": "git", + "url": "https://github.com/spatie/temporary-directory.git", + "reference": "efc258c9f4da28f0c7661765b8393e4ccee3d19c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/spatie/temporary-directory/zipball/efc258c9f4da28f0c7661765b8393e4ccee3d19c", + "reference": "efc258c9f4da28f0c7661765b8393e4ccee3d19c", + "shasum": "" + }, + "require": { + "php": "^8.0" + }, + "require-dev": { + "phpunit/phpunit": "^9.5" + }, + "type": "library", + "autoload": { + "psr-4": { + "Spatie\\TemporaryDirectory\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Alex Vanderbist", + "email": "alex@spatie.be", + "homepage": "https://spatie.be", + "role": "Developer" + } + ], + "description": "Easily create, use and destroy temporary directories", + "homepage": "https://github.com/spatie/temporary-directory", + "keywords": [ + "php", + "spatie", + "temporary-directory" + ], + "support": { + "issues": "https://github.com/spatie/temporary-directory/issues", + "source": "https://github.com/spatie/temporary-directory/tree/2.2.0" + }, + "funding": [ + { + "url": "https://spatie.be/open-source/support-us", + "type": "custom" + }, + { + "url": "https://github.com/spatie", + "type": "github" + } + ], + "time": "2023-09-25T07:13:36+00:00" + }, { "name": "symfony/console", "version": "v6.4.1", @@ -3473,20 +4037,20 @@ }, { "name": "symfony/css-selector", - "version": "v6.4.0", + "version": "v7.0.0", "source": { "type": "git", "url": "https://github.com/symfony/css-selector.git", - "reference": "d036c6c0d0b09e24a14a35f8292146a658f986e4" + "reference": "bb51d46e53ef8d50d523f0c5faedba056a27943e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/css-selector/zipball/d036c6c0d0b09e24a14a35f8292146a658f986e4", - "reference": "d036c6c0d0b09e24a14a35f8292146a658f986e4", + "url": "https://api.github.com/repos/symfony/css-selector/zipball/bb51d46e53ef8d50d523f0c5faedba056a27943e", + "reference": "bb51d46e53ef8d50d523f0c5faedba056a27943e", "shasum": "" }, "require": { - "php": ">=8.1" + "php": ">=8.2" }, "type": "library", "autoload": { @@ -3518,7 +4082,7 @@ "description": "Converts CSS selectors to XPath expressions", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/css-selector/tree/v6.4.0" + "source": "https://github.com/symfony/css-selector/tree/v7.0.0" }, "funding": [ { @@ -3534,7 +4098,7 @@ "type": "tidelift" } ], - "time": "2023-10-31T08:40:20+00:00" + "time": "2023-10-31T17:59:56+00:00" }, { "name": "symfony/deprecation-contracts", @@ -4980,23 +5544,23 @@ }, { "name": "tijsverkoyen/css-to-inline-styles", - "version": "2.2.6", + "version": "v2.2.7", "source": { "type": "git", "url": "https://github.com/tijsverkoyen/CssToInlineStyles.git", - "reference": "c42125b83a4fa63b187fdf29f9c93cb7733da30c" + "reference": "83ee6f38df0a63106a9e4536e3060458b74ccedb" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/tijsverkoyen/CssToInlineStyles/zipball/c42125b83a4fa63b187fdf29f9c93cb7733da30c", - "reference": "c42125b83a4fa63b187fdf29f9c93cb7733da30c", + "url": "https://api.github.com/repos/tijsverkoyen/CssToInlineStyles/zipball/83ee6f38df0a63106a9e4536e3060458b74ccedb", + "reference": "83ee6f38df0a63106a9e4536e3060458b74ccedb", "shasum": "" }, "require": { "ext-dom": "*", "ext-libxml": "*", "php": "^5.5 || ^7.0 || ^8.0", - "symfony/css-selector": "^2.7 || ^3.0 || ^4.0 || ^5.0 || ^6.0" + "symfony/css-selector": "^2.7 || ^3.0 || ^4.0 || ^5.0 || ^6.0 || ^7.0" }, "require-dev": { "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.0 || ^7.5 || ^8.5.21 || ^9.5.10" @@ -5027,9 +5591,9 @@ "homepage": "https://github.com/tijsverkoyen/CssToInlineStyles", "support": { "issues": "https://github.com/tijsverkoyen/CssToInlineStyles/issues", - "source": "https://github.com/tijsverkoyen/CssToInlineStyles/tree/2.2.6" + "source": "https://github.com/tijsverkoyen/CssToInlineStyles/tree/v2.2.7" }, - "time": "2023-01-03T09:29:04+00:00" + "time": "2023-12-08T13:03:43+00:00" }, { "name": "vlucas/phpdotenv", @@ -6326,16 +6890,16 @@ }, { "name": "mockery/mockery", - "version": "1.6.6", + "version": "1.6.7", "source": { "type": "git", "url": "https://github.com/mockery/mockery.git", - "reference": "b8e0bb7d8c604046539c1115994632c74dcb361e" + "reference": "0cc058854b3195ba21dc6b1f7b1f60f4ef3a9c06" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/mockery/mockery/zipball/b8e0bb7d8c604046539c1115994632c74dcb361e", - "reference": "b8e0bb7d8c604046539c1115994632c74dcb361e", + "url": "https://api.github.com/repos/mockery/mockery/zipball/0cc058854b3195ba21dc6b1f7b1f60f4ef3a9c06", + "reference": "0cc058854b3195ba21dc6b1f7b1f60f4ef3a9c06", "shasum": "" }, "require": { @@ -6348,9 +6912,7 @@ }, "require-dev": { "phpunit/phpunit": "^8.5 || ^9.6.10", - "psalm/plugin-phpunit": "^0.18.4", - "symplify/easy-coding-standard": "^11.5.0", - "vimeo/psalm": "^4.30" + "symplify/easy-coding-standard": "^12.0.8" }, "type": "library", "autoload": { @@ -6407,7 +6969,7 @@ "security": "https://github.com/mockery/mockery/security/advisories", "source": "https://github.com/mockery/mockery" }, - "time": "2023-08-09T00:03:52+00:00" + "time": "2023-12-10T02:24:34+00:00" }, { "name": "myclabs/deep-copy", @@ -6826,16 +7388,16 @@ }, { "name": "phpstan/phpstan", - "version": "1.10.47", + "version": "1.10.48", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "84dbb33b520ea28b6cf5676a3941f4bae1c1ff39" + "reference": "087ed4b5f4a7a6e8f3bbdfbfe98ce5c181380bc6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/84dbb33b520ea28b6cf5676a3941f4bae1c1ff39", - "reference": "84dbb33b520ea28b6cf5676a3941f4bae1c1ff39", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/087ed4b5f4a7a6e8f3bbdfbfe98ce5c181380bc6", + "reference": "087ed4b5f4a7a6e8f3bbdfbfe98ce5c181380bc6", "shasum": "" }, "require": { @@ -6884,20 +7446,20 @@ "type": "tidelift" } ], - "time": "2023-12-01T15:19:17+00:00" + "time": "2023-12-08T14:34:28+00:00" }, { "name": "phpunit/php-code-coverage", - "version": "10.1.9", + "version": "10.1.10", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "a56a9ab2f680246adcf3db43f38ddf1765774735" + "reference": "599109c8ca6bae97b23482d557d2874c25a65e59" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/a56a9ab2f680246adcf3db43f38ddf1765774735", - "reference": "a56a9ab2f680246adcf3db43f38ddf1765774735", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/599109c8ca6bae97b23482d557d2874c25a65e59", + "reference": "599109c8ca6bae97b23482d557d2874c25a65e59", "shasum": "" }, "require": { @@ -6954,7 +7516,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/php-code-coverage/issues", "security": "https://github.com/sebastianbergmann/php-code-coverage/security/policy", - "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/10.1.9" + "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/10.1.10" }, "funding": [ { @@ -6962,7 +7524,7 @@ "type": "github" } ], - "time": "2023-11-23T12:23:20+00:00" + "time": "2023-12-11T06:28:43+00:00" }, { "name": "phpunit/php-file-iterator", @@ -8331,7 +8893,8 @@ "platform": { "php": "^8.3", "ext-intl": "*", - "ext-pdo": "*" + "ext-pdo": "*", + "ext-zip": "*" }, "platform-dev": [], "plugin-api-version": "2.6.0" diff --git a/config/app.php b/config/app.php index 274955e..7951cbd 100644 --- a/config/app.php +++ b/config/app.php @@ -165,6 +165,7 @@ * Added providers */ Cviebrock\EloquentSluggable\ServiceProvider::class, + App\Providers\DropboxServiceProvider::class, ], diff --git a/config/backup.php b/config/backup.php new file mode 100644 index 0000000..5607ae7 --- /dev/null +++ b/config/backup.php @@ -0,0 +1,337 @@ + [ + + /* + * The name of this application. You can use this name to monitor + * the backups. + */ + 'name' => env('APP_NAME', 'laravel-backup'), + + 'source' => [ + + 'files' => [ + + /* + * The list of directories and files that will be included in the backup. + */ + 'include' => [ +// base_path(), + ], + + /* + * These directories and files will be excluded from the backup. + * + * Directories used by the backup process will automatically be excluded. + */ + 'exclude' => [ + base_path('vendor'), + base_path('node_modules'), + ], + + /* + * Determines if symlinks should be followed. + */ + 'follow_links' => false, + + /* + * Determines if it should avoid unreadable folders. + */ + 'ignore_unreadable_directories' => false, + + /* + * This path is used to make directories in resulting zip-file relative + * Set to `null` to include complete absolute path + * Example: base_path() + */ + 'relative_path' => null, + ], + + /* + * The names of the connections to the databases that should be backed up + * MySQL, PostgreSQL, SQLite and Mongo databases are supported. + * + * The content of the database dump may be customized for each connection + * by adding a 'dump' key to the connection settings in config/database.php. + * E.g. + * 'mysql' => [ + * ... + * 'dump' => [ + * 'excludeTables' => [ + * 'table_to_exclude_from_backup', + * 'another_table_to_exclude' + * ] + * ], + * ], + * + * If you are using only InnoDB tables on a MySQL server, you can + * also supply the useSingleTransaction option to avoid table locking. + * + * E.g. + * 'mysql' => [ + * ... + * 'dump' => [ + * 'useSingleTransaction' => true, + * ], + * ], + * + * For a complete list of available customization options, see https://github.com/spatie/db-dumper + */ + 'databases' => [ + 'pgsql', + ], + ], + + /* + * The database dump can be compressed to decrease disk space usage. + * + * Out of the box Laravel-backup supplies + * Spatie\DbDumper\Compressors\GzipCompressor::class. + * + * You can also create custom compressor. More info on that here: + * https://github.com/spatie/db-dumper#using-compression + * + * If you do not want any compressor at all, set it to null. + */ + 'database_dump_compressor' => Spatie\DbDumper\Compressors\GzipCompressor::class, + + /* + * If specified, the database dumped file name will contain a timestamp (e.g.: 'Y-m-d-H-i-s'). + */ + 'database_dump_file_timestamp_format' => null, + + /* + * The file extension used for the database dump files. + * + * If not specified, the file extension will be .archive for MongoDB and .sql for all other databases + * The file extension should be specified without a leading . + */ + 'database_dump_file_extension' => '', + + 'destination' => [ + /* + * The compression algorithm to be used for creating the zip archive. + * + * If backing up only database, you may choose gzip compression for db dump and no compression at zip. + * + * Some common algorithms are listed below: + * ZipArchive::CM_STORE (no compression at all; set 0 as compression level) + * ZipArchive::CM_DEFAULT + * ZipArchive::CM_DEFLATE + * ZipArchive::CM_BZIP2 + * ZipArchive::CM_XZ + * + * For more check https://www.php.net/manual/zip.constants.php and confirm it's supported by your system. + */ + 'compression_method' => ZipArchive::CM_DEFAULT, + + /* + * The compression level corresponding to the used algorithm; an integer between 0 and 9. + * + * Check supported levels for the chosen algorithm, usually 1 means the fastest and weakest compression, + * while 9 the slowest and strongest one. + * + * Setting of 0 for some algorithms may switch to the strongest compression. + */ + 'compression_level' => 9, + + /* + * The filename prefix used for the backup zip file. + */ + 'filename_prefix' => '', + + /* + * The disk names on which the backups will be stored. + */ + 'disks' => [ + 'dropbox', + ], + ], + + /* + * The directory where the temporary files will be stored. + */ + 'temporary_directory' => storage_path('app/backup-temp'), + + /* + * The password to be used for archive encryption. + * Set to `null` to disable encryption. + */ + 'password' => env('BACKUP_ARCHIVE_PASSWORD'), + + /* + * The encryption algorithm to be used for archive encryption. + * You can set it to `null` or `false` to disable encryption. + * + * When set to 'default', we'll use ZipArchive::EM_AES_256 if it is + * available on your system. + */ + 'encryption' => 'default', + + /** + * The number of attempts, in case the backup command encounters an exception + */ + 'tries' => 1, + + /** + * The number of seconds to wait before attempting a new backup if the previous try failed + * Set to `0` for none + */ + 'retry_delay' => 0, + ], + + /* + * You can get notified when specific events occur. Out of the box you can use 'mail' and 'slack'. + * For Slack you need to install laravel/slack-notification-channel. + * + * You can also use your own notification classes, just make sure the class is named after one of + * the `Spatie\Backup\Notifications\Notifications` classes. + */ + 'notifications' => [ + + 'notifications' => [ + \Spatie\Backup\Notifications\Notifications\BackupHasFailedNotification::class => ['mail'], + \Spatie\Backup\Notifications\Notifications\UnhealthyBackupWasFoundNotification::class => ['mail'], + \Spatie\Backup\Notifications\Notifications\CleanupHasFailedNotification::class => ['mail'], + \Spatie\Backup\Notifications\Notifications\BackupWasSuccessfulNotification::class => ['mail'], + \Spatie\Backup\Notifications\Notifications\HealthyBackupWasFoundNotification::class => ['mail'], + \Spatie\Backup\Notifications\Notifications\CleanupWasSuccessfulNotification::class => ['mail'], + ], + + /* + * Here you can specify the notifiable to which the notifications should be sent. The default + * notifiable will use the variables specified in this config file. + */ + 'notifiable' => \Spatie\Backup\Notifications\Notifiable::class, + + 'mail' => [ + 'to' => env('DROPBOX_MAIL_NOTIFICATION'), + + 'from' => [ + 'address' => env('MAIL_FROM_ADDRESS', 'hello@example.com'), + 'name' => env('MAIL_FROM_NAME', 'Example'), + ], + ], + + 'slack' => [ + 'webhook_url' => '', + + /* + * If this is set to null the default channel of the webhook will be used. + */ + 'channel' => null, + + 'username' => null, + + 'icon' => null, + + ], + + 'discord' => [ + 'webhook_url' => '', + + /* + * If this is an empty string, the name field on the webhook will be used. + */ + 'username' => '', + + /* + * If this is an empty string, the avatar on the webhook will be used. + */ + 'avatar_url' => '', + ], + ], + + /* + * Here you can specify which backups should be monitored. + * If a backup does not meet the specified requirements the + * UnHealthyBackupWasFound event will be fired. + */ + 'monitor_backups' => [ + [ + 'name' => env('APP_NAME', 'laravel-backup'), + 'disks' => ['local'], + 'health_checks' => [ + \Spatie\Backup\Tasks\Monitor\HealthChecks\MaximumAgeInDays::class => 1, + \Spatie\Backup\Tasks\Monitor\HealthChecks\MaximumStorageInMegabytes::class => 500, + ], + ], + + /* + [ + 'name' => 'name of the second app', + 'disks' => ['local', 's3'], + 'health_checks' => [ + \Spatie\Backup\Tasks\Monitor\HealthChecks\MaximumAgeInDays::class => 1, + \Spatie\Backup\Tasks\Monitor\HealthChecks\MaximumStorageInMegabytes::class => 5000, + ], + ], + */ + ], + + 'cleanup' => [ + /* + * The strategy that will be used to cleanup old backups. The default strategy + * will keep all backups for a certain amount of days. After that period only + * a daily backup will be kept. After that period only weekly backups will + * be kept and so on. + * + * No matter how you configure it the default strategy will never + * delete the newest backup. + */ + 'strategy' => \Spatie\Backup\Tasks\Cleanup\Strategies\DefaultStrategy::class, + + 'default_strategy' => [ + + /* + * The number of days for which backups must be kept. + */ + 'keep_all_backups_for_days' => 7, + + /* + * After the "keep_all_backups_for_days" period is over, the most recent backup + * of that day will be kept. Older backups within the same day will be removed. + * If you create backups only once a day, no backups will be removed yet. + */ + 'keep_daily_backups_for_days' => 16, + + /* + * After the "keep_daily_backups_for_days" period is over, the most recent backup + * of that week will be kept. Older backups within the same week will be removed. + * If you create backups only once a week, no backups will be removed yet. + */ + 'keep_weekly_backups_for_weeks' => 8, + + /* + * After the "keep_weekly_backups_for_weeks" period is over, the most recent backup + * of that month will be kept. Older backups within the same month will be removed. + */ + 'keep_monthly_backups_for_months' => 4, + + /* + * After the "keep_monthly_backups_for_months" period is over, the most recent backup + * of that year will be kept. Older backups within the same year will be removed. + */ + 'keep_yearly_backups_for_years' => 2, + + /* + * After cleaning up the backups remove the oldest backup until + * this amount of megabytes has been reached. + */ + 'delete_oldest_backups_when_using_more_megabytes_than' => 500, + ], + + /** + * The number of attempts, in case the cleanup command encounters an exception + */ + 'tries' => 1, + + /** + * The number of seconds to wait before attempting a new cleanup if the previous try failed + * Set to `0` for none + */ + 'retry_delay' => 10, + ], + +]; diff --git a/config/filesystems.php b/config/filesystems.php index fe44577..03810d7 100644 --- a/config/filesystems.php +++ b/config/filesystems.php @@ -38,7 +38,7 @@ 'public' => [ 'driver' => 'local', 'root' => storage_path('app/public'), - 'url' => env('APP_URL').'/storage', + 'url' => env('APP_URL') . '/storage', 'visibility' => 'public', ], @@ -58,6 +58,12 @@ 'use_path_style_endpoint' => env('AWS_USE_PATH_STYLE_ENDPOINT', false), ], + 'dropbox' => [ + 'driver' => 'dropbox', + 'key' => env('DROPBOX_APP_KEY'), + 'secret' => env('DROPBOX_APP_SECRET'), + 'authorization_token' => env('DROPBOX_ACCESS_TOKEN'), + ], ], /* diff --git a/docker-compose.yml b/docker-compose.yml index 4faea05..31c833d 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -19,12 +19,10 @@ services: build: context: . dockerfile: docker/web_php/Dockerfile - args: - - DOCKER_WORK_DIR=${DOCKER_WORK_DIR} restart: ${DOCKER_RESTART} - working_dir: ${DOCKER_WORK_DIR} + working_dir: /var/www volumes: - - ./:${DOCKER_WORK_DIR} + - ./:/var/www environment: DB_HOST: db #override env networks: @@ -33,7 +31,7 @@ services: caddy: image: caddy:2.7 restart: ${DOCKER_RESTART} - working_dir: ${DOCKER_WORK_DIR} + working_dir: /var/www volumes: - ./docker/Caddyfile:/etc/caddy/Caddyfile - ./:/var/www diff --git a/docker/web_php/Dockerfile b/docker/web_php/Dockerfile index 398fcc5..04a94f4 100644 --- a/docker/web_php/Dockerfile +++ b/docker/web_php/Dockerfile @@ -1,11 +1,10 @@ FROM php:8.3-fpm -ARG DOCKER_WORK_DIR ARG UID=1000 ENV NODE_MAJOR=20 -RUN usermod -u ${UID} www-data --home="${DOCKER_WORK_DIR}/storage/docker/home/www-data" +RUN usermod -u ${UID} www-data --home="/var/www/storage/docker/home/www-data" RUN apt update -yqq && apt install -y ca-certificates gnupg RUN mkdir -p /etc/apt/keyrings && curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg @@ -21,6 +20,8 @@ RUN apt update -yqq && apt install -y \ libpng-dev \ libxml2-dev \ zip \ + # install postgresql-client only for pg_dump to make automatic database dump + postgresql-client \ # wkhtmltopdf dependencies fontconfig \ libx11-6 \