Some fixes for registering hosts, enable jobs to go to postgres, initial setup fixes

This commit is contained in:
Deon George 2022-03-11 23:49:15 +11:00
parent cf3b1947a4
commit 4ff29e7e43
7 changed files with 38 additions and 5 deletions

View File

@ -18,6 +18,12 @@ DB_SSLROOTCERT=/var/www/html/config/ssl/ca.crt
DB_SSLCERT=/var/www/html/config/ssl/client.crt DB_SSLCERT=/var/www/html/config/ssl/client.crt
DB_SSLKEY=/var/www/html/config/ssl/client.key DB_SSLKEY=/var/www/html/config/ssl/client.key
DB_JOBS_CONNECTION=jobs
DB_JOBS_HOST=jobs
DB_JOBS_DATABASE=
DB_JOBS_USERNAME=
DB_JOBS_PASSWORD=
DB_MONGO_HOST=mongo DB_MONGO_HOST=mongo
DB_MONGO_USERNAME=mongo DB_MONGO_USERNAME=mongo
DB_MONGO_PASSWORD=password DB_MONGO_PASSWORD=password

View File

@ -46,7 +46,7 @@ class SystemRegister extends FormRequest
], ],
($this->so->exists || ($request->action != 'create')) ? [ ($this->so->exists || ($request->action != 'create')) ? [
'location' => 'required|min:3', 'location' => 'required|min:3',
'hold' => 'required|boolean',
'sysop' => 'required|min:3', 'sysop' => 'required|min:3',
'phone' => 'nullable|regex:/^([0-9-]+)$/', 'phone' => 'nullable|regex:/^([0-9-]+)$/',
'address' => 'nullable|regex:/^(?!:\/\/)(?=.{1,255}$)((.{1,63}\.){1,127}(?![0-9]*$)[a-z0-9-]+\.?)$/i', 'address' => 'nullable|regex:/^(?!:\/\/)(?=.{1,255}$)((.{1,63}\.){1,127}(?![0-9]*$)[a-z0-9-]+\.?)$/i',
@ -57,7 +57,10 @@ class SystemRegister extends FormRequest
'mailer_port' => 'nullable|digits_between:2,5', 'mailer_port' => 'nullable|digits_between:2,5',
'zt_id' => 'nullable|size:10|regex:/^([A-Fa-f0-9]){10}$/|unique:systems,zt_id,'.($this->so->exists ? $this->so->id : 0), 'zt_id' => 'nullable|size:10|regex:/^([A-Fa-f0-9]){10}$/|unique:systems,zt_id,'.($this->so->exists ? $this->so->id : 0),
] : [], ] : [],
$this->so->exists ? ['active' => 'required|boolean'] : [], $this->so->exists ? [
'active' => 'required|boolean',
'hold' => 'required|boolean',
] : [],
)); ));
} }
} }

View File

@ -118,6 +118,23 @@ return [
'database' => env('DB_AUTHENTICATION_DATABASE', 'admin'), // required with Mongo 3+ 'database' => env('DB_AUTHENTICATION_DATABASE', 'admin'), // required with Mongo 3+
], ],
], ],
'jobs' => [
'driver' => 'pgsql',
'host' => env('DB_JOBS_HOST', '127.0.0.1'),
'port' => env('DB_JOBS_PORT', '5432'),
'database' => env('DB_JOBS_DATABASE', 'forge'),
'username' => env('DB_JOBS_USERNAME', 'forge'),
'password' => env('DB_JOBS_PASSWORD', ''),
'charset' => 'utf8',
'prefix' => '',
'prefix_indexes' => true,
'schema' => 'public',
'sslmode' => 'disable', //depends on your security level https://www.postgresql.org/docs/current/libpq-ssl.html#LIBPQ-SSL-SSLMODE-STATEMENTS
'sslrootcert' => env('DB_JOBS_SSLROOTCERT', 'config/ssl/ca.crt'),
'sslcert' => env('DB_JOBS_SSLCERT', 'config/ssl/client.crt'),
'sslkey' => env('DB_JOBS_SSLKEY', 'config/ssl/client.key'),
],
], ],
/* /*

View File

@ -35,6 +35,7 @@ return [
], ],
'database' => [ 'database' => [
'connection' => 'jobs',
'driver' => 'database', 'driver' => 'database',
'table' => 'jobs', 'table' => 'jobs',
'queue' => 'default', 'queue' => 'default',
@ -79,7 +80,8 @@ return [
*/ */
'failed' => [ 'failed' => [
'database' => env('DB_CONNECTION', 'mysql'), 'driver' => env('QUEUE_FAILED_DRIVER', 'database-uuids'),
'database' => env('DB_JOBS_CONNECTION', 'jobs'),
'table' => 'failed_jobs', 'table' => 'failed_jobs',
], ],

View File

@ -45,7 +45,6 @@ class InitialSetupSeeder extends Seeder
$do = new Domain; $do = new Domain;
$do->forceFill([ $do->forceFill([
'name'=>'private', 'name'=>'private',
'default'=>TRUE,
'active'=>TRUE, 'active'=>TRUE,
'public'=>TRUE, 'public'=>TRUE,
'notes'=>'PrivateNet: Internal Testing Network' 'notes'=>'PrivateNet: Internal Testing Network'
@ -55,6 +54,7 @@ class InitialSetupSeeder extends Seeder
$zo = new Zone; $zo = new Zone;
$zo->forceFill([ $zo->forceFill([
'zone_id'=>'10', 'zone_id'=>'10',
'default'=>TRUE,
'active'=>TRUE, 'active'=>TRUE,
'system_id'=>$so->id, 'system_id'=>$so->id,
]); ]);
@ -83,6 +83,7 @@ class InitialSetupSeeder extends Seeder
'name'=>'-BAD_AREA', 'name'=>'-BAD_AREA',
'description'=>'Inbound invalid echomail', 'description'=>'Inbound invalid echomail',
'active'=>TRUE, 'active'=>TRUE,
'public'=>TRUE,
'domain_id'=>$do->id, 'domain_id'=>$do->id,
]); ]);
@ -90,6 +91,7 @@ class InitialSetupSeeder extends Seeder
'name'=>'-BAD_AREA', 'name'=>'-BAD_AREA',
'description'=>'Inbound invalid files', 'description'=>'Inbound invalid files',
'active'=>TRUE, 'active'=>TRUE,
'public'=>TRUE,
'domain_id'=>$do->id, 'domain_id'=>$do->id,
]); ]);
} }

View File

@ -9,6 +9,8 @@
<div class="input-group has-validation"> <div class="input-group has-validation">
<span class="input-group-text"><i class="bi bi-pc"></i></span> <span class="input-group-text"><i class="bi bi-pc"></i></span>
<input type="text" class="form-control @error('name') is-invalid @enderror" id="name" placeholder="Name" name="name" value="{{ old('name',$o->name) }}" required @cannot('update',$o)readonly @endcannot autofocus> <input type="text" class="form-control @error('name') is-invalid @enderror" id="name" placeholder="Name" name="name" value="{{ old('name',$o->name) }}" required @cannot('update',$o)readonly @endcannot autofocus>
<span id="search-icon" style="width: 0;"><i style="border-radius: 50%;" class="spinner-border spinner-border-sm text-dark d-none"></i></span>
<div id="system_search_results"></div>
<span class="invalid-feedback" role="alert"> <span class="invalid-feedback" role="alert">
@error('name') @error('name')
{{ $message }} {{ $message }}

View File

@ -15,11 +15,12 @@
<div id="create"> <div id="create">
<div class="row"> <div class="row">
<!-- Name -->
<div class="col-4"> <div class="col-4">
<label for="system" class="form-label">BBS Name</label> <label for="system" class="form-label">BBS Name</label>
<div class="input-group has-validation"> <div class="input-group has-validation">
<span class="input-group-text"><i class="bi bi-pc"></i></span> <span class="input-group-text"><i class="bi bi-pc"></i></span>
<input type="text" style="z-index: 0" class="form-control col-11 @error('name') is-invalid @enderror" id="name" placeholder="BBS Name" name="name" value="{{ old('name') }}" required autofocus> <input type="text" style="z-index: 0" class="form-control @error('name') is-invalid @enderror" id="name" placeholder="BBS Name" name="name" value="{{ old('name') }}" required autofocus>
<span id="search-icon" style="width: 0;"><i style="border-radius: 50%;" class="spinner-border spinner-border-sm text-dark d-none"></i></span> <span id="search-icon" style="width: 0;"><i style="border-radius: 50%;" class="spinner-border spinner-border-sm text-dark d-none"></i></span>
<div id="system_search_results"></div> <div id="system_search_results"></div>
<span class="invalid-feedback" role="alert"> <span class="invalid-feedback" role="alert">