Remove build settings from packs.

This commit is contained in:
Dane Everitt 2017-01-27 16:21:25 -05:00
parent 4a6d62fded
commit 9087feec4f
No known key found for this signature in database
GPG Key ID: EEA66103B3D71F53
5 changed files with 1 additions and 167 deletions

View File

@ -183,14 +183,6 @@ class PackController extends Controller
'description' => $pack->dscription,
'selectable' => (bool) $pack->selectable,
'visible' => (bool) $pack->visible,
'build' => [
'memory' => $pack->build_memory,
'swap' => $pack->build_swap,
'cpu' => $pack->build_cpu,
'io' => $pack->build_io,
'container' => $pack->build_container,
'script' => $pack->build_script,
],
];
$filename = tempnam(sys_get_temp_dir(), 'pterodactyl_');

View File

@ -49,12 +49,6 @@ class Pack
'option' => 'required|exists:service_options,id',
'selectable' => 'sometimes|boolean',
'visible' => 'sometimes|boolean',
'build_memory' => 'required|integer|min:0',
'build_swap' => 'required|integer|min:0',
'build_cpu' => 'required|integer|min:0',
'build_io' => 'required|integer|min:10|max:1000',
'build_container' => 'required|string',
'build_script' => 'sometimes|nullable|string',
]);
if ($validator->fails()) {
@ -77,12 +71,6 @@ class Pack
$pack = Models\ServicePack::create([
'option' => $data['option'],
'uuid' => $uuid->generate('servers', 'uuid'),
'build_memory' => $data['build_memory'],
'build_swap' => $data['build_swap'],
'build_cpu' => $data['build_swap'],
'build_io' => $data['build_io'],
'build_script' => (empty($data['build_script'])) ? null : $data['build_script'],
'build_container' => $data['build_container'],
'name' => $data['name'],
'version' => $data['version'],
'description' => (empty($data['description'])) ? null : $data['description'],
@ -142,12 +130,6 @@ class Pack
'option' => $data['option'],
'selectable' => $json->selectable,
'visible' => $json->visible,
'build_memory' => $json->build->memory,
'build_swap' => $json->build->swap,
'build_cpu' => $json->build->cpu,
'build_io' => $json->build->io,
'build_container' => $json->build->container,
'build_script' => $json->build->script,
]);
$pack = Models\ServicePack::findOrFail($id);
@ -169,12 +151,6 @@ class Pack
'option' => $data['option'],
'selectable' => $json->selectable,
'visible' => $json->visible,
'build_memory' => $json->build->memory,
'build_swap' => $json->build->swap,
'build_cpu' => $json->build->cpu,
'build_io' => $json->build->io,
'build_container' => $json->build->container,
'build_script' => $json->build->script,
]);
}
}
@ -188,12 +164,6 @@ class Pack
'option' => 'required|exists:service_options,id',
'selectable' => 'sometimes|boolean',
'visible' => 'sometimes|boolean',
'build_memory' => 'required|integer|min:0',
'build_swap' => 'required|integer|min:0',
'build_cpu' => 'required|integer|min:0',
'build_io' => 'required|integer|min:10|max:1000',
'build_container' => 'required|string',
'build_script' => 'sometimes|string',
]);
if ($validator->fails()) {
@ -203,12 +173,6 @@ class Pack
DB::transaction(function () use ($id, $data) {
Models\ServicePack::findOrFail($id)->update([
'option' => $data['option'],
'build_memory' => $data['build_memory'],
'build_swap' => $data['build_swap'],
'build_cpu' => $data['build_swap'],
'build_io' => $data['build_io'],
'build_script' => (empty($data['build_script'])) ? null : $data['build_script'],
'build_container' => $data['build_container'],
'name' => $data['name'],
'version' => $data['version'],
'description' => (empty($data['description'])) ? null : $data['description'],

View File

@ -17,12 +17,6 @@ class AddPackSupport extends Migration
$table->increments('id');
$table->unsignedInteger('option');
$table->char('uuid', 36)->unique();
$table->unsignedInteger('build_memory')->nullable();
$table->unsignedInteger('build_swap')->nullable();
$table->unsignedInteger('build_cpu')->nullable();
$table->unsignedInteger('build_io')->nullable();
$table->text('build_script')->nullable();
$table->string('build_container')->default('alpine:latest');
$table->string('name');
$table->string('version');
$table->text('description')->nullable();

View File

@ -88,64 +88,6 @@
</div>
</div>
<hr />
<div class="row">
<div class="col-md-12">
<h5 class="nopad">Build Parameters</h5>
<div class="well" style="margin-bottom:0">
<div class="row">
<div class="form-group col-md-3 col-xs-6">
<label class="control-label">Memory:</label>
<div class="input-group">
<input type="text" name="build_memory" class="form-control" value="{{ old('build_memory', $pack->build_memory) }}"/>
<span class="input-group-addon">MB</span>
</div>
</div>
<div class="form-group col-md-3 col-xs-6">
<label class="control-label">Swap:</label>
<div class="input-group">
<input type="text" name="build_swap" class="form-control" value="{{ old('build_swap', $pack->build_swap) }}"/>
<span class="input-group-addon">MB</span>
</div>
</div>
<div class="form-group col-md-3 col-xs-6">
<label class="control-label">CPU:</label>
<div class="input-group">
<input type="text" name="build_cpu" class="form-control" value="{{ old('build_cpu', $pack->build_cpu) }}"/>
<span class="input-group-addon">%</span>
</div>
</div>
<div class="form-group col-md-3 col-xs-6">
<label class="control-label">IO:</label>
<div class="input-group">
<input type="text" name="build_io" class="form-control" value="{{ old('build_io', $pack->build_io) }}"/>
<span class="input-group-addon">I/O</span>
</div>
</div>
<div class="form-group col-md-12">
<div>
<p class="text-muted"><small>If you would like to set limits on the build container you may do so above. Setting <code>memory</code>, <code>swap</code>, or <code>cpu</code> to <code>0</code> will allow unlimited resource utilization. IO must be in a range between <code>10</code> to <code>1000</code> and is a relative weighting to other container IO usage.</small></p>
</div>
</div>
</div>
<div class="row">
<div class="form-group col-md-12">
<label class="control-label">Build Container:</label>
<div>
<input type="text" name="build_container" class="form-control" value="{{ old('build_container', $pack->build_container) }}"/>
<p class="text-muted"><small>Provide the docker container image that will be used to build this service pack. This container is <em>only</em> used if a build script is provided below.</small></p>
</div>
</div>
<div class="form-group col-md-12">
<label class="control-label">Build Script:</label>
<div id="build_script" style="height:200px">{{ $pack->build_script }}</div>
<textarea id="editor_contents" name="build_script" class="hidden"></textarea>
<p class="text-muted"><small>This script will be run inside the container if provided. You should use this script to download any additional dependencies or compile packages as necessary on the node. Your uploaded archive (if provided), will be available in <code>/input</code> as <code>archive.tar.gz</code> or as <code>archive.zip</code> depending on what format you uploaded as. Your completed pack should be saved as <code>package.tar.gz</code> in the <code>/output</code> directory (e.g. <code>/output/package.tar.gz</code>).</small></p>
</div>
</div>
</div>
</div>
</div>
<hr />
<div class="row">
<div class="col-md-12">
<h5 class="nopad">Package Archive</h5>
@ -153,7 +95,7 @@
<div class="row">
<div class="form-group col-md-12">
@if(count($files) > 1)
<div class="alert alert-danger"><strong>Warning!</strong> Service packs should only contain a single pack archive in either <code>.zip</code> or <code>.tar.gz</code> format. We've detected more than one file for this pack.</div>
<div class="alert alert-danger"><strong>Warning!</strong> Service packs should only contain a single pack archive in <code>.tar.gz</code> format. We've detected more than one file for this pack.</div>
@endif
<table class="table table-striped">
<thead>

View File

@ -85,64 +85,6 @@
</div>
</div>
<hr />
<div class="row">
<div class="col-md-12">
<h5 class="nopad">Build Parameters</h5>
<div class="well" style="margin-bottom:0">
<div class="row">
<div class="form-group col-md-3 col-xs-6">
<label class="control-label">Memory:</label>
<div class="input-group">
<input type="text" name="build_memory" class="form-control" value="{{ old('build_memory', 0) }}"/>
<span class="input-group-addon">MB</span>
</div>
</div>
<div class="form-group col-md-3 col-xs-6">
<label class="control-label">Swap:</label>
<div class="input-group">
<input type="text" name="build_swap" class="form-control" value="{{ old('build_swap', 0) }}"/>
<span class="input-group-addon">MB</span>
</div>
</div>
<div class="form-group col-md-3 col-xs-6">
<label class="control-label">CPU:</label>
<div class="input-group">
<input type="text" name="build_cpu" class="form-control" value="{{ old('build_cpu', 0) }}"/>
<span class="input-group-addon">%</span>
</div>
</div>
<div class="form-group col-md-3 col-xs-6">
<label class="control-label">IO:</label>
<div class="input-group">
<input type="text" name="build_io" class="form-control" value="{{ old('build_io', 300) }}"/>
<span class="input-group-addon">I/O</span>
</div>
</div>
<div class="form-group col-md-12">
<div>
<p class="text-muted"><small>If you would like to set limits on the build container you may do so above. Setting <code>memory</code>, <code>swap</code>, or <code>cpu</code> to <code>0</code> will allow unlimited resource utilization. IO must be in a range between <code>10</code> to <code>1000</code> and is a relative weighting to other container IO usage.</small></p>
</div>
</div>
</div>
<div class="row">
<div class="form-group col-md-12">
<label class="control-label">Build Container:</label>
<div>
<input type="text" name="build_container" class="form-control" value="{{ old('build_container', 'alpine:latest') }}"/>
<p class="text-muted"><small>Provide the docker container image that will be used to build this service pack. This container is <em>only</em> used if a build script is provided below.</small></p>
</div>
</div>
<div class="form-group col-md-12">
<label class="control-label">Build Script:</label>
<div id="build_script" style="height:200px"></div>
<textarea id="editor_contents" name="build_script" class="hidden"></textarea>
<p class="text-muted"><small>This script will be run inside the container if provided. You should use this script to download any additional dependencies or compile packages as necessary on the node. Your uploaded archive (if provided), will be available in <code>/input</code> as <code>archive.tar.gz</code> or as <code>archive.zip</code> depending on what format you uploaded as. Your completed pack should be saved as <code>package.tar.gz</code> in the <code>/output</code> directory (e.g. <code>/output/package.tar.gz</code>).</small></p>
</div>
</div>
</div>
</div>
</div>
<hr />
<div class="row">
<div class="col-md-12">
<h5 class="nopad">File Upload</h5>