Add extra redirect before DB to stop race condition
This commit is contained in:
parent
ab94b76d00
commit
24e5dec271
@ -2,14 +2,14 @@
|
|||||||
|
|
||||||
return [
|
return [
|
||||||
'fetch' => PDO::FETCH_ASSOC,
|
'fetch' => PDO::FETCH_ASSOC,
|
||||||
'default' => env('DB_CONNECTION', 'sqlite'),
|
'default' => env('DB_CONNECTION', 'mysql'),
|
||||||
'connections' => [
|
'connections' => [
|
||||||
'mysql' => [
|
'mysql' => [
|
||||||
'driver' => 'mysql',
|
'driver' => 'mysql',
|
||||||
'host' => env('DB_HOST', '127.0.0.1'),
|
'host' => env('DB_HOST', '127.0.0.1'),
|
||||||
'port' => env('DB_PORT', '3306'),
|
'port' => env('DB_PORT', '3306'),
|
||||||
'database' => env('DB_DATABASE', 'forge'),
|
'database' => env('DB_DATABASE', ''),
|
||||||
'username' => env('DB_USERNAME', 'forge'),
|
'username' => env('DB_USERNAME', ''),
|
||||||
'password' => env('DB_PASSWORD', ''),
|
'password' => env('DB_PASSWORD', ''),
|
||||||
//'unix_socket' => env('DB_SOCKET', ''),
|
//'unix_socket' => env('DB_SOCKET', ''),
|
||||||
'prefix' => env('DB_PREFIX', ''),
|
'prefix' => env('DB_PREFIX', ''),
|
||||||
|
@ -98,15 +98,12 @@ class InstallerController extends AppBaseController
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Step 2a. Do the config and setup
|
* Step 2a. Create the .env
|
||||||
*/
|
*/
|
||||||
public function dbsetup(Request $request)
|
public function envsetup(Request $request)
|
||||||
{
|
{
|
||||||
$log = [];
|
Log::info('ENV setup', $request->toArray());
|
||||||
|
|
||||||
Log::info('DB Setup', $request->toArray());
|
|
||||||
|
|
||||||
$log[] = 'Creating environment file';
|
|
||||||
$this->envService->createEnvFile(
|
$this->envService->createEnvFile(
|
||||||
$request->input('db_conn'),
|
$request->input('db_conn'),
|
||||||
$request->input('db_host'),
|
$request->input('db_host'),
|
||||||
@ -116,6 +113,18 @@ class InstallerController extends AppBaseController
|
|||||||
$request->input('db_pass')
|
$request->input('db_pass')
|
||||||
);
|
);
|
||||||
|
|
||||||
|
# Needs to redirect so it can load the new .env
|
||||||
|
Log::info('Redirecting to database setup');
|
||||||
|
return redirect(route('installer.dbsetup'));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Step 2b. Setup the database
|
||||||
|
*/
|
||||||
|
public function dbsetup(Request $request)
|
||||||
|
{
|
||||||
|
$log = [];
|
||||||
|
|
||||||
$log[] = 'Creating database';
|
$log[] = 'Creating database';
|
||||||
$console_out = $this->dbService->setupDB($request->input('db_conn'));
|
$console_out = $this->dbService->setupDB($request->input('db_conn'));
|
||||||
|
|
||||||
|
@ -1,12 +1,15 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
Route::get('/', 'InstallerController@index')->name('index');
|
Route::get('/', 'InstallerController@index')->name('index');
|
||||||
|
Route::post('/dbtest', 'InstallerController@dbtest')->name('dbtest');
|
||||||
|
|
||||||
Route::get('/step1', 'InstallerController@step1')->name('step1');
|
Route::get('/step1', 'InstallerController@step1')->name('step1');
|
||||||
Route::post('/step1', 'InstallerController@step1')->name('step1');
|
Route::post('/step1', 'InstallerController@step1')->name('step1');
|
||||||
|
|
||||||
Route::get('/step2', 'InstallerController@step2')->name('step2');
|
Route::get('/step2', 'InstallerController@step2')->name('step2');
|
||||||
|
Route::post('/envsetup', 'InstallerController@envsetup')->name('envsetup');
|
||||||
|
Route::get('/dbsetup', 'InstallerController@dbsetup')->name('dbsetup');
|
||||||
|
|
||||||
Route::get('/step3', 'InstallerController@step3')->name('step3');
|
Route::get('/step3', 'InstallerController@step3')->name('step3');
|
||||||
|
|
||||||
Route::post('/dbtest', 'InstallerController@dbtest')->name('dbtest');
|
|
||||||
Route::post('/dbsetup', 'InstallerController@dbsetup')->name('dbsetup');
|
|
||||||
|
|
||||||
Route::get('/complete', 'InstallerController@complete')->name('complete');
|
Route::get('/complete', 'InstallerController@complete')->name('complete');
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
@section('title', 'Database Setup')
|
@section('title', 'Database Setup')
|
||||||
@section('content')
|
@section('content')
|
||||||
<div style="align-content: center;">
|
<div style="align-content: center;">
|
||||||
{!! Form::open(['route' => 'installer.dbsetup', 'method' => 'POST']) !!}
|
{!! Form::open(['route' => 'installer.envsetup', 'method' => 'POST']) !!}
|
||||||
<table class="table" width="25%">
|
<table class="table" width="25%">
|
||||||
<tr>
|
<tr>
|
||||||
<td>Select Database Type</td>
|
<td>Select Database Type</td>
|
||||||
@ -18,7 +18,7 @@
|
|||||||
<td>Database Host</td>
|
<td>Database Host</td>
|
||||||
<td style="text-align:center;">
|
<td style="text-align:center;">
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
{!! Form::input('text', 'db_host', null, ['class' => 'form-control']) !!}
|
{!! Form::input('text', 'db_host', 'localhost', ['class' => 'form-control']) !!}
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
@ -4,10 +4,10 @@
|
|||||||
#
|
#
|
||||||
|
|
||||||
APP_ENV={!! $APP_ENV !!}
|
APP_ENV={!! $APP_ENV !!}
|
||||||
APP_URL="http://localhost"
|
APP_URL=http://localhost
|
||||||
APP_SKIN=default
|
APP_SKIN=default
|
||||||
VACENTRAL_API_KEY=""
|
VACENTRAL_API_KEY=
|
||||||
APP_KEY="base64:{!! $APP_KEY !!}"
|
APP_KEY=base64:{!! $APP_KEY !!}
|
||||||
APP_DEBUG=true
|
APP_DEBUG=true
|
||||||
APP_LOCALE=en
|
APP_LOCALE=en
|
||||||
|
|
||||||
@ -15,30 +15,25 @@ APP_LOG=daily
|
|||||||
APP_LOG_LEVEL=debug
|
APP_LOG_LEVEL=debug
|
||||||
APP_LOG_MAX_FILES=3
|
APP_LOG_MAX_FILES=3
|
||||||
|
|
||||||
DB_CONNECTION="{!! $DB_CONN !!}"
|
DB_CONNECTION={!! $DB_CONN !!}
|
||||||
DB_HOST="{!! $DB_HOST !!}"
|
DB_HOST={!! $DB_HOST !!}
|
||||||
DB_PORT="{!! $DB_PORT !!}"
|
DB_PORT={!! $DB_PORT !!}
|
||||||
DB_DATABASE="{!! $DB_NAME !!}"
|
DB_DATABASE={!! $DB_NAME !!}
|
||||||
DB_USERNAME="{!! $DB_USER !!}"
|
DB_USERNAME={!! $DB_USER !!}
|
||||||
DB_PASSWORD="{!! $DB_PASS !!}"
|
DB_PASSWORD={!! $DB_PASS !!}
|
||||||
DB_PREFIX=""
|
DB_PREFIX=""
|
||||||
|
|
||||||
MAIL_DRIVER=smtp
|
MAIL_DRIVER=smtp
|
||||||
MAIL_FROM_ADDRESS="no-reply@phpvms.net"
|
MAIL_FROM_ADDRESS="no-reply@phpvms.net"
|
||||||
MAIL_FROM_NAME="phpVMS Admin"
|
MAIL_FROM_NAME="phpVMS Admin"
|
||||||
MAIL_HOST="smtp.mailgun.org"
|
MAIL_HOST=smtp.mailgun.org
|
||||||
MAIL_PORT=587
|
MAIL_PORT=587
|
||||||
MAIL_ENCRYPTION="tls"
|
MAIL_ENCRYPTION=tls
|
||||||
MAIL_USERNAME=""
|
MAIL_USERNAME=""
|
||||||
MAIL_PASSWORD=""
|
MAIL_PASSWORD=""
|
||||||
|
|
||||||
CACHE_DRIVER="{!! $CACHE_DRIVER !!}"
|
CACHE_DRIVER={!! $CACHE_DRIVER !!}
|
||||||
CACHE_PREFIX="phpvms"
|
CACHE_PREFIX=phpvms
|
||||||
|
|
||||||
REDIS_HOST="localhost"
|
|
||||||
REDIS_PASSWORD=""
|
|
||||||
REDIS_PORT=6379
|
|
||||||
REDIS_DATABASE=1
|
|
||||||
|
|
||||||
SESSION_DRIVER=array
|
SESSION_DRIVER=array
|
||||||
QUEUE_DRIVER={!! $QUEUE_DRIVER !!}
|
QUEUE_DRIVER={!! $QUEUE_DRIVER !!}
|
||||||
|
@ -51,7 +51,7 @@ class EnvironmentService
|
|||||||
if(\extension_loaded('apc')) {
|
if(\extension_loaded('apc')) {
|
||||||
$opts['CACHE_DRIVER'] = 'apc';
|
$opts['CACHE_DRIVER'] = 'apc';
|
||||||
} else {
|
} else {
|
||||||
$opts['CACHE_DRIVER'] = 'file';
|
$opts['CACHE_DRIVER'] = 'array';
|
||||||
}
|
}
|
||||||
|
|
||||||
return $opts;
|
return $opts;
|
||||||
|
Loading…
Reference in New Issue
Block a user