Merge remote-tracking branch 'origin/master' into oasis

# Conflicts:
#	app/Console/Kernel.php
#	composer.json
#	composer.lock
#	public/chunks/admin-account.js
#	public/chunks/admin.js
#	public/chunks/app-appearance.js
#	public/chunks/app-appearance~chunks/app-billings~chunks/app-email~chunks/app-index~chunks/app-others~chunks~8cc7d96f.js
#	public/chunks/app-billings.js
#	public/chunks/app-email.js
#	public/chunks/app-index.js
#	public/chunks/app-language.js
#	public/chunks/app-others.js
#	public/chunks/app-payments.js
#	public/chunks/app-settings.js
#	public/chunks/app-setup.js
#	public/chunks/billings-detail.js
#	public/chunks/contact-us.js
#	public/chunks/create-new-password.js
#	public/chunks/dashboard.js
#	public/chunks/database.js
#	public/chunks/dynamic-page.js
#	public/chunks/environment-setup.js
#	public/chunks/files.js
#	public/chunks/files~chunks/shared-files~chunks/shared/file-browser.js
#	public/chunks/files~chunks/shared-files~chunks/shared/file-browser~chunks/shared/single-file.js
#	public/chunks/forgotten-password.js
#	public/chunks/homepage.js
#	public/chunks/installation-disclaimer.js
#	public/chunks/invoices.js
#	public/chunks/page-edit.js
#	public/chunks/pages.js
#	public/chunks/plan-create.js
#	public/chunks/plan-delete.js
#	public/chunks/plan-settings.js
#	public/chunks/plan-subscribers.js
#	public/chunks/plan.js
#	public/chunks/plans.js
#	public/chunks/platform.js
#	public/chunks/platform~chunks/shared.js
#	public/chunks/profile.js
#	public/chunks/profile~chunks/settings-password.js
#	public/chunks/purchase-code.js
#	public/chunks/settings-create-payment-methods.js
#	public/chunks/settings-invoices.js
#	public/chunks/settings-password.js
#	public/chunks/settings-payment-methods.js
#	public/chunks/settings-storage.js
#	public/chunks/settings-subscription.js
#	public/chunks/settings.js
#	public/chunks/setup-wizard.js
#	public/chunks/shared-files.js
#	public/chunks/shared.js
#	public/chunks/shared/authenticate.js
#	public/chunks/shared/file-browser.js
#	public/chunks/shared/single-file.js
#	public/chunks/sign-in.js
#	public/chunks/sign-up.js
#	public/chunks/stripe-credentials.js
#	public/chunks/subscription-plans.js
#	public/chunks/subscription-service.js
#	public/chunks/upgrade-billing.js
#	public/chunks/upgrade-plan.js
#	public/chunks/user-create.js
#	public/chunks/user-delete.js
#	public/chunks/user-detail.js
#	public/chunks/user-invoices.js
#	public/chunks/user-password.js
#	public/chunks/user-storage.js
#	public/chunks/user-subscription.js
#	public/chunks/user.js
#	public/chunks/users.js
#	public/js/main.js
#	public/mix-manifest.json
This commit is contained in:
Peter Papp
2021-04-12 06:57:47 +02:00
41 changed files with 2084 additions and 1199 deletions

View File

@@ -32,27 +32,18 @@ class SetupDevEnvironment extends Command
protected $description = 'Set up development environment with demo data';
private $setup;
private $helper;
/**
* Create a new command instance.
*
* @return void
*/
public function __construct()
{
parent::__construct();
$this->faker = Faker\Factory::create();
$this->setup = resolve(SetupService::class);
$this->helper = resolve(HelperService::class);
}
/**
* Execute the console command.
*
* @return int
*/
public function handle()
public function handle(): void
{
$this->info('Setting up development environment');
@@ -878,7 +869,6 @@ class SetupDevEnvironment extends Command
->each(function ($file) {
Storage::putFileAs("system", storage_path("demo/app/$file"), $file, "private");
});
}
/**

View File

@@ -0,0 +1,224 @@
<?php
namespace App\Console\Commands;
use App\Models\Setting;
use App\Models\User;
use App\Services\SetupService;
use Illuminate\Console\Command;
class SetupProdEnvironment extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'setup:prod';
protected $license = 'Extended';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Set up production environment';
private $setup;
public function __construct()
{
parent::__construct();
$this->setup = resolve(SetupService::class);
}
/**
* Execute the console command.
*
* @return int
*/
public function handle()
{
$this->info('Setting up production environment');
$this->info('Creating system directories...');
$this->setup->create_directories();
$this->info('Migrating Databases...');
$this->migrate_and_generate();
$this->info('Storing default settings and content...');
$this->store_default_settings();
$this->setup->seed_default_pages();
$this->setup->seed_default_settings($this->license);
$this->setup->seed_default_language();
$this->info('Creating default admin...');
$this->create_admin();
$this->info('Clearing application cache...');
$this->clear_cache();
$this->info('Everything is done, congratulations! 🥳🥳🥳');
}
/**
* Store main app settings into database
*/
private function store_default_settings(): void
{
// Get options
collect([
[
'name' => 'setup_wizard_database',
'value' => 1,
],
[
'name' => 'app_title',
'value' => 'VueFileManager',
],
[
'name' => 'app_description',
'value' => 'Your self-hosted storage cloud software powered by Laravel and Vue',
],
[
'name' => 'app_logo',
'value' => null,
],
[
'name' => 'app_logo_horizontal',
'value' => null,
],
[
'name' => 'app_favicon',
'value' => null,
],
[
'name' => 'app_og_image',
'value' => null,
],
[
'name' => 'app_touch_icon',
'value' => null,
],
[
'name' => 'google_analytics',
'value' => null,
],
[
'name' => 'contact_email',
'value' => null,
],
[
'name' => 'registration',
'value' => 0,
],
[
'name' => 'storage_limitation',
'value' => 1,
],
[
'name' => 'storage_default',
'value' => 5,
],
[
'name' => 'setup_wizard_success',
'value' => 1,
],
[
'name' => 'license',
'value' => $this->license,
],
[
'name' => 'purchase_code',
'value' => '26b889eb-3602-4bf2-beb3-3sc378fcf484',
],
[
'name' => 'billing_address',
'value' => null,
],
[
'name' => 'billing_city',
'value' => null,
],
[
'name' => 'billing_country',
'value' => null,
],
[
'name' => 'billing_name',
'value' => null,
],
[
'name' => 'billing_phone_number',
'value' => null,
],
[
'name' => 'billing_postal_code',
'value' => null,
],
[
'name' => 'billing_state',
'value' => null,
],
[
'name' => 'billing_vat_number',
'value' => null,
]
])->each(function ($col) {
Setting::forceCreate([
'name' => $col['name'],
'value' => $col['value']
]);
});
}
/**
* Create default admin account
*/
private function create_admin(): void
{
$user = User::forceCreate([
'role' => 'admin',
'email' => 'admin@vuefilemanager.com',
'password' => bcrypt('vuefilemanager'),
]);
$user
->settings()
->create([
'storage_capacity' => 5,
'name' => 'Admin',
]);
// Show user credentials
$this->info('Default admin account created. Email: admin@vuefilemanager.com and Password: vuefilemanager');
}
/**
* Migrate database and generate application keys
*/
private function migrate_and_generate(): void
{
// Migrate database
$this->call('migrate:fresh', [
'--force' => true
]);
// Generate app key
$this->call('key:generate', [
'--force' => true
]);
}
/**
* Clear app cache
*/
private function clear_cache(): void
{
$this->call('cache:clear');
$this->call('config:clear');
$this->call('view:clear');
}
}

View File

@@ -4,6 +4,7 @@ namespace App\Console;
use App\Console\Commands\SetupDevEnvironment;
use App\Services\Oasis\OasisService;
use App\Console\Commands\SetupProdEnvironment;
use App\Services\SchedulerService;
use Illuminate\Console\Scheduling\Schedule;
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
@@ -17,6 +18,7 @@ class Kernel extends ConsoleKernel
*/
protected $commands = [
SetupDevEnvironment::class,
SetupProdEnvironment::class,
];
/**
@@ -50,6 +52,14 @@ class Kernel extends ConsoleKernel
$schedule->command('queue:work --stop-when-empty')
->everyMinute()
->withoutOverlapping();
// Backup app database daily
$schedule->command('backup:clean')
->daily()
->at('01:00');
$schedule->command('backup:run --only-db')
->daily()
->at('01:30');
}
/**