Default to OOM killer being disabled, add back configuration option per-server

This commit is contained in:
Dane Everitt 2019-08-03 13:41:24 -07:00
parent 2198269a65
commit 81409947cf
No known key found for this signature in database
GPG key ID: EEA66103B3D71F53
9 changed files with 38 additions and 3 deletions

View file

@ -28,6 +28,16 @@ class Server extends Model implements CleansAttributes, ValidableContract
*/
protected $table = 'servers';
/**
* Default values when creating the model. We want to switch to disabling OOM killer
* on server instances unless the user specifies otherwise in the request.
*
* @var array
*/
protected $attributes = [
'oom_disabled' => true,
];
/**
* The attributes that should be mutated to dates.
*
@ -53,6 +63,7 @@ class Server extends Model implements CleansAttributes, ValidableContract
'swap' => 'required',
'io' => 'required',
'cpu' => 'required',
'oom_disabled' => 'sometimes',
'disk' => 'required',
'nest_id' => 'required',
'egg_id' => 'required',
@ -79,6 +90,7 @@ class Server extends Model implements CleansAttributes, ValidableContract
'swap' => 'numeric|min:-1',
'io' => 'numeric|between:10,1000',
'cpu' => 'numeric|min:0',
'oom_disabled' => 'boolean',
'disk' => 'numeric|min:0',
'allocation_id' => 'bail|unique:servers|exists:allocations,id',
'nest_id' => 'exists:nests,id',
@ -107,7 +119,7 @@ class Server extends Model implements CleansAttributes, ValidableContract
'disk' => 'integer',
'io' => 'integer',
'cpu' => 'integer',
'oom_disabled' => 'integer',
'oom_disabled' => 'boolean',
'allocation_id' => 'integer',
'nest_id' => 'integer',
'egg_id' => 'integer',