From 4e9d97bab50bdad2ed586d3c51403eddb1905afb Mon Sep 17 00:00:00 2001 From: Alexis Saettler Date: Thu, 16 May 2019 23:06:37 +0200 Subject: [PATCH] fix: fix setup process --- app.json | 8 ++++++-- app/Console/Commands/Deactivate2FA.php | 4 +++- app/Console/Commands/MigrateDatabaseCollation.php | 3 ++- app/Console/Commands/PingVersionServer.php | 3 ++- app/Console/Commands/SentryRelease.php | 8 ++++---- app/Console/Commands/SetUserAdmin.php | 6 +++--- app/Console/Commands/SetupProduction.php | 15 +++++++++++---- app/Console/Commands/SetupTest.php | 2 +- app/Console/Commands/Update.php | 5 ++++- 9 files changed, 36 insertions(+), 18 deletions(-) diff --git a/app.json b/app.json index cd0892e6754..d2ba302c5e6 100644 --- a/app.json +++ b/app.json @@ -19,13 +19,17 @@ } ], "scripts": { - "postdeploy": "php artisan monica:update --force -vvv" + "postdeploy": "php artisan setup:production --force -vvv" }, "env": { "APP_KEY": { - "description": "Please change this to a 32-character string - For example run `pwgen -s 32 1` and copy/paste the value.", + "description": "Please change this to a 32-character string. For example run `pwgen -s 32 1` and copy/paste the value.", "value": "change-me-to-a-random-string----" }, + "APP_ENV": { + "description": "Use monica in 'production' mode, or set it to 'local' if you want to install Monica as a development version.", + "value": "production" + }, "APP_DISABLE_SIGNUP": { "description": "Disable user signup.", "value": "false" diff --git a/app/Console/Commands/Deactivate2FA.php b/app/Console/Commands/Deactivate2FA.php index 44496daa6c5..fbd34ee5591 100644 --- a/app/Console/Commands/Deactivate2FA.php +++ b/app/Console/Commands/Deactivate2FA.php @@ -12,7 +12,9 @@ class Deactivate2FA extends Command * * @var string */ - protected $signature = '2fa:deactivate {--email= : The email of the user to deactivate 2FA} {--force : run without asking for confirmation}'; + protected $signature = '2fa:deactivate + {--force : Force the operation to run when in production.} + {--email= : The email of the user to deactivate 2FA.}'; /** * The console command description. diff --git a/app/Console/Commands/MigrateDatabaseCollation.php b/app/Console/Commands/MigrateDatabaseCollation.php index 540896f003a..ac45b3b9670 100644 --- a/app/Console/Commands/MigrateDatabaseCollation.php +++ b/app/Console/Commands/MigrateDatabaseCollation.php @@ -15,7 +15,8 @@ class MigrateDatabaseCollation extends Command * * @var string */ - protected $signature = 'migrate:collation {--force : Force the operation to run when in production.}'; + protected $signature = 'migrate:collation + {--force : Force the operation to run when in production.}'; /** * The console command description. diff --git a/app/Console/Commands/PingVersionServer.php b/app/Console/Commands/PingVersionServer.php index 3c314d563d0..47ab000038c 100644 --- a/app/Console/Commands/PingVersionServer.php +++ b/app/Console/Commands/PingVersionServer.php @@ -19,7 +19,8 @@ class PingVersionServer extends Command * * @var string */ - protected $signature = 'monica:ping {--force}'; + protected $signature = 'monica:ping + {--force : Force the operation to run when in production.}'; /** * The console command description. diff --git a/app/Console/Commands/SentryRelease.php b/app/Console/Commands/SentryRelease.php index be2c30e9124..2d80c1059ba 100644 --- a/app/Console/Commands/SentryRelease.php +++ b/app/Console/Commands/SentryRelease.php @@ -20,10 +20,10 @@ class SentryRelease extends Command * @var string */ protected $signature = 'sentry:release - {--release= : release version for sentry} - {--store-release : store release version in .sentry-release file} - {--commit= : commit associated with this release} - {--environment= : sentry environment}'; + {--release= : release version for sentry.} + {--store-release : store release version in .sentry-release file.} + {--commit= : commit associated with this release.} + {--environment= : sentry environment.}'; /** * The console command description. diff --git a/app/Console/Commands/SetUserAdmin.php b/app/Console/Commands/SetUserAdmin.php index 42ca07816e1..b2dd5c096c9 100644 --- a/app/Console/Commands/SetUserAdmin.php +++ b/app/Console/Commands/SetUserAdmin.php @@ -12,9 +12,9 @@ class SetUserAdmin extends Command * * @var string */ - protected $signature = 'monica:admin'. - ' {--email= : The email of the user whose admin status you want to change}'. - ' {--force : Run without asking for confirmation}'; + protected $signature = 'monica:admin + {--force : Force the operation to run when in production.} + {--email= : The email of the user whose admin status you want to change}'; /** * The console command description. diff --git a/app/Console/Commands/SetupProduction.php b/app/Console/Commands/SetupProduction.php index 72445eb15c9..e2a975b004f 100644 --- a/app/Console/Commands/SetupProduction.php +++ b/app/Console/Commands/SetupProduction.php @@ -13,9 +13,11 @@ class SetupProduction extends Command * * @var string */ - protected $signature = 'setup:production {--force} - {--email= : Login email for the first account} - {--password= : Password to set for the first account}'; + protected $signature = 'setup:production + {--force : Force the operation to run when in production.} + {--email= : Login email for the first account.} + {--password= : Password to set for the first account.} + {--skipSeed : Skip the populate database process.}'; /** * The console command description. @@ -43,7 +45,12 @@ public function handle() touch(__DIR__.'/../../../.env'); } - $this->callSilent('monica:update', ['--force' => true]); + $this->call('monica:update', ['--force' => true]); + + if (! $this->option('skipSeed')) { + $this->line('✓ Filling database'); + $this->call('db:seed', ['--force' => true]); + } $this->line(''); $this->line('-----------------------------'); diff --git a/app/Console/Commands/SetupTest.php b/app/Console/Commands/SetupTest.php index b03d2416209..cae28e8311c 100644 --- a/app/Console/Commands/SetupTest.php +++ b/app/Console/Commands/SetupTest.php @@ -13,7 +13,7 @@ class SetupTest extends Command * @var string */ protected $signature = 'setup:test - {--skipSeed : Whether we should populate the database with fake data}'; + {--skipSeed : Skip the populate database with fake data.}'; /** * The console command description. diff --git a/app/Console/Commands/Update.php b/app/Console/Commands/Update.php index 65143a44e44..4fcecea4725 100644 --- a/app/Console/Commands/Update.php +++ b/app/Console/Commands/Update.php @@ -18,7 +18,10 @@ class Update extends Command * * @var string */ - protected $signature = 'monica:update {--force} {--composer-install} {--dev}'; + protected $signature = 'monica:update + {--force : Force the operation to run when in production.} + {--composer-install : Updating composer dependencies.} + {--dev : Install dev dependencies too.}'; /** * The console command description.