From 719d7c2bd5239b73c8cfc9748fe7ac33f7a60a72 Mon Sep 17 00:00:00 2001 From: Nabeel Shahzad Date: Thu, 14 Dec 2017 21:34:11 -0600 Subject: [PATCH] Some fixes to the installer --- .env.bak | 14 +++++++ .gitignore | 1 + Makefile | 7 ++++ Procfile | 1 + modules/Installer/Config/config.php | 3 +- modules/Installer/Http/Routes/install.php | 1 + .../Resources/views/stubs/env.blade.php | 42 +++++++++---------- .../Installer/Services/DatabaseService.php | 2 +- .../Installer/Services/EnvironmentService.php | 6 +-- phpvms.iml | 15 ------- 10 files changed, 51 insertions(+), 41 deletions(-) create mode 100644 .env.bak diff --git a/.env.bak b/.env.bak new file mode 100644 index 00000000..403ac056 --- /dev/null +++ b/.env.bak @@ -0,0 +1,14 @@ +APP_ENV=dev +APP_KEY=base64:ve66Z5Kt/zTN3p++0zOPu854PHfZkwJE5VuoFAlzHtI= +APP_DEBUG=true +APP_LOCALE=en +APP_URL=http://localhost + +APP_LOG=daily +APP_LOG_LEVEL=debug +APP_LOG_MAX_FILES=7 + +DB_CONNECTION=sqlite + +CACHE_DRIVER=array +CACHE_PREFIX= diff --git a/.gitignore b/.gitignore index 92a99c9b..2af41f35 100644 --- a/.gitignore +++ b/.gitignore @@ -18,6 +18,7 @@ storage/*.sqlite .env.php .env .env.php +.env.* .env.generated .vagrant #Homestead.yaml diff --git a/Makefile b/Makefile index 9ee67220..4476128b 100644 --- a/Makefile +++ b/Makefile @@ -70,6 +70,13 @@ schema: deploy-package: ./.travis/deploy_script.sh +.PHONY: reset-installer +reset-installer: + @cp .env.dev.example .env + @make clean + mysql -uroot -e "DROP DATABASE IF EXISTS phpvms" + mysql -uroot -e "CREATE DATABASE phpvms" + .PHONY: docker docker: @mkdir -p $(CURR_PATH)/tmp/mysql diff --git a/Procfile b/Procfile index 0d0979be..9023b9fe 100644 --- a/Procfile +++ b/Procfile @@ -1,3 +1,4 @@ dnsmasq: /usr/local/sbin/dnsmasq --keep-in-foreground php-fpm: /usr/local/sbin/php-fpm --nodaemonize nginx: /usr/local/bin/nginx +mysql: /usr/local/bin/mysqld diff --git a/modules/Installer/Config/config.php b/modules/Installer/Config/config.php index 10b87cba..44efaa95 100644 --- a/modules/Installer/Config/config.php +++ b/modules/Installer/Config/config.php @@ -8,7 +8,8 @@ return [ ], # TODO: Remove eventually - 'env_postfix' => '.generated', +// 'env_postfix' => '.generated', + 'env_postfix' => '', 'extensions' => [ 'openssl', diff --git a/modules/Installer/Http/Routes/install.php b/modules/Installer/Http/Routes/install.php index fce93602..4ce0fd77 100644 --- a/modules/Installer/Http/Routes/install.php +++ b/modules/Installer/Http/Routes/install.php @@ -2,6 +2,7 @@ Route::get('/', 'InstallerController@index')->name('index'); Route::get('/step1', 'InstallerController@step1')->name('step1'); +Route::post('/step1', 'InstallerController@step1')->name('step1'); Route::get('/step2', 'InstallerController@step2')->name('step2'); Route::get('/step3', 'InstallerController@step3')->name('step3'); diff --git a/modules/Installer/Resources/views/stubs/env.blade.php b/modules/Installer/Resources/views/stubs/env.blade.php index 265b0291..d7f21f2f 100644 --- a/modules/Installer/Resources/views/stubs/env.blade.php +++ b/modules/Installer/Resources/views/stubs/env.blade.php @@ -3,11 +3,11 @@ # and APP_DEBUG to false # -APP_ENV=dev -APP_URL=http://localhost +APP_ENV={!! $APP_ENV !!} +APP_URL="http://localhost" APP_SKIN=default -VACENTRAL_API_KEY= -APP_KEY=base64:{!! $APP_KEY !!} +VACENTRAL_API_KEY="" +APP_KEY="base64:{!! $APP_KEY !!}" APP_DEBUG=true APP_LOCALE=en @@ -15,28 +15,28 @@ APP_LOG=daily APP_LOG_LEVEL=debug APP_LOG_MAX_FILES=3 -DB_CONNECTION={!! $DB_CONN !!} -DB_HOST={!! $DB_HOST !!} -DB_PORT={!! $DB_PORT !!} -DB_DATABASE={!! $DB_NAME !!} -DB_USERNAME={!! $DB_USER !!} -DB_PASSWORD={!! $DB_PASS !!} -DB_PREFIX= +DB_CONNECTION="{!! $DB_CONN !!}" +DB_HOST="{!! $DB_HOST !!}" +DB_PORT="{!! $DB_PORT !!}" +DB_DATABASE="{!! $DB_NAME !!}" +DB_USERNAME="{!! $DB_USER !!}" +DB_PASSWORD="{!! $DB_PASS !!}" +DB_PREFIX="" MAIL_DRIVER=smtp -MAIL_FROM_ADDRESS=no-reply@phpvms.net -MAIL_FROM_NAME=phpVMS Admin -MAIL_HOST=smtp.mailgun.org +MAIL_FROM_ADDRESS="no-reply@phpvms.net" +MAIL_FROM_NAME="phpVMS Admin" +MAIL_HOST="smtp.mailgun.org" MAIL_PORT=587 -MAIL_ENCRYPTION=tls -MAIL_USERNAME= -MAIL_PASSWORD= +MAIL_ENCRYPTION="tls" +MAIL_USERNAME="" +MAIL_PASSWORD="" -CACHE_DRIVER={!! $CACHE_DRIVER !!} -CACHE_PREFIX=phpvms +CACHE_DRIVER="{!! $CACHE_DRIVER !!}" +CACHE_PREFIX="phpvms" -REDIS_HOST=localhost -REDIS_PASSWORD= +REDIS_HOST="localhost" +REDIS_PASSWORD="" REDIS_PORT=6379 REDIS_DATABASE=1 diff --git a/modules/Installer/Services/DatabaseService.php b/modules/Installer/Services/DatabaseService.php index 4c4c0df6..56d93e64 100644 --- a/modules/Installer/Services/DatabaseService.php +++ b/modules/Installer/Services/DatabaseService.php @@ -17,7 +17,7 @@ class DatabaseService { Log::info('Testing Connection: '.$type.'::'.$user.':'.$pass.'@'.$host.':'.$port.';'.$name); if($type === 'mysql') { - $dsn = "mysql:host=$host;port=$port;dbname=$name"; + $dsn = "mysql:host=$host;port=$port;"; Log::info('Connection string: '. $dsn); try { $conn = new PDO($dsn, $user, $pass); diff --git a/modules/Installer/Services/EnvironmentService.php b/modules/Installer/Services/EnvironmentService.php index 0385f375..7d905798 100644 --- a/modules/Installer/Services/EnvironmentService.php +++ b/modules/Installer/Services/EnvironmentService.php @@ -14,6 +14,7 @@ class EnvironmentService public function createEnvFile($type, $host, $port, $name, $user, $pass) { $opts = [ + 'APP_ENV' => 'dev', 'APP_KEY' => $this->createAppKey(), 'DB_CONN' => $type, 'DB_HOST' => $host, @@ -50,7 +51,7 @@ class EnvironmentService if(\extension_loaded('apc')) { $opts['CACHE_DRIVER'] = 'apc'; } else { - $opts['CACHE_DRIVER'] = 'filesystem'; + $opts['CACHE_DRIVER'] = 'file'; } return $opts; @@ -81,8 +82,7 @@ class EnvironmentService */ protected function writeEnvFile($opts) { - $app = app(); - $env_file = $app->environmentFilePath(); + $env_file = \App::environmentFilePath(); $env_file .= config('installer.env_postfix'); # render it within Blade and log the contents diff --git a/phpvms.iml b/phpvms.iml index bb62365c..5669b473 100644 --- a/phpvms.iml +++ b/phpvms.iml @@ -304,21 +304,6 @@ - - - - - - - - - - - - - - -