Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
pterodactyl
GitHub Repository: pterodactyl/panel
Path: blob/1.0-develop/resources/views/admin/servers/new.blade.php
7460 views
1
@extends('layouts.admin')
2
3
@section('title')
4
New Server
5
@endsection
6
7
@section('content-header')
8
<h1>Create Server<small>Add a new server to the panel.</small></h1>
9
<ol class="breadcrumb">
10
<li><a href="{{ route('admin.index') }}">Admin</a></li>
11
<li><a href="{{ route('admin.servers') }}">Servers</a></li>
12
<li class="active">Create Server</li>
13
</ol>
14
@endsection
15
16
@section('content')
17
<form action="{{ route('admin.servers.new') }}" method="POST">
18
<div class="row">
19
<div class="col-xs-12">
20
<div class="box">
21
<div class="box-header with-border">
22
<h3 class="box-title">Core Details</h3>
23
</div>
24
25
<div class="box-body row">
26
<div class="col-md-6">
27
<div class="form-group">
28
<label for="pName">Server Name</label>
29
<input type="text" class="form-control" id="pName" name="name" value="{{ old('name') }}" placeholder="Server Name">
30
<p class="small text-muted no-margin">Character limits: <code>a-z A-Z 0-9 _ - .</code> and <code>[Space]</code>.</p>
31
</div>
32
33
<div class="form-group">
34
<label for="pUserId">Server Owner</label>
35
<select id="pUserId" name="owner_id" class="form-control" style="padding-left:0;"></select>
36
<p class="small text-muted no-margin">Email address of the Server Owner.</p>
37
</div>
38
</div>
39
40
<div class="col-md-6">
41
<div class="form-group">
42
<label for="pDescription" class="control-label">Server Description</label>
43
<textarea id="pDescription" name="description" rows="3" class="form-control">{{ old('description') }}</textarea>
44
<p class="text-muted small">A brief description of this server.</p>
45
</div>
46
47
<div class="form-group">
48
<div class="checkbox checkbox-primary no-margin-bottom">
49
<input id="pStartOnCreation" name="start_on_completion" type="checkbox" {{ \Pterodactyl\Helpers\Utilities::checked('start_on_completion', 1) }} />
50
<label for="pStartOnCreation" class="strong">Start Server when Installed</label>
51
</div>
52
</div>
53
</div>
54
</div>
55
</div>
56
</div>
57
</div>
58
59
<div class="row">
60
<div class="col-xs-12">
61
<div class="box">
62
<div class="overlay" id="allocationLoader" style="display:none;"><i class="fa fa-refresh fa-spin"></i></div>
63
<div class="box-header with-border">
64
<h3 class="box-title">Allocation Management</h3>
65
</div>
66
67
<div class="box-body row">
68
<div class="form-group col-sm-4">
69
<label for="pNodeId">Node</label>
70
<select name="node_id" id="pNodeId" class="form-control">
71
@foreach($locations as $location)
72
<optgroup label="{{ $location->long }} ({{ $location->short }})">
73
@foreach($location->nodes as $node)
74
75
<option value="{{ $node->id }}"
76
@if($location->id === old('location_id')) selected @endif
77
>{{ $node->name }}</option>
78
79
@endforeach
80
</optgroup>
81
@endforeach
82
</select>
83
84
<p class="small text-muted no-margin">The node which this server will be deployed to.</p>
85
</div>
86
87
<div class="form-group col-sm-4">
88
<label for="pAllocation">Default Allocation</label>
89
<select id="pAllocation" name="allocation_id" class="form-control"></select>
90
<p class="small text-muted no-margin">The main allocation that will be assigned to this server.</p>
91
</div>
92
93
<div class="form-group col-sm-4">
94
<label for="pAllocationAdditional">Additional Allocation(s)</label>
95
<select id="pAllocationAdditional" name="allocation_additional[]" class="form-control" multiple></select>
96
<p class="small text-muted no-margin">Additional allocations to assign to this server on creation.</p>
97
</div>
98
</div>
99
</div>
100
</div>
101
</div>
102
103
<div class="row">
104
<div class="col-xs-12">
105
<div class="box">
106
<div class="overlay" id="allocationLoader" style="display:none;"><i class="fa fa-refresh fa-spin"></i></div>
107
<div class="box-header with-border">
108
<h3 class="box-title">Application Feature Limits</h3>
109
</div>
110
111
<div class="box-body row">
112
<div class="form-group col-xs-6">
113
<label for="pDatabaseLimit" class="control-label">Database Limit</label>
114
<div>
115
<input type="text" id="pDatabaseLimit" name="database_limit" class="form-control" value="{{ old('database_limit', 0) }}"/>
116
</div>
117
<p class="text-muted small">The total number of databases a user is allowed to create for this server.</p>
118
</div>
119
<div class="form-group col-xs-6">
120
<label for="pAllocationLimit" class="control-label">Allocation Limit</label>
121
<div>
122
<input type="text" id="pAllocationLimit" name="allocation_limit" class="form-control" value="{{ old('allocation_limit', 0) }}"/>
123
</div>
124
<p class="text-muted small">The total number of allocations a user is allowed to create for this server.</p>
125
</div>
126
<div class="form-group col-xs-6">
127
<label for="pBackupLimit" class="control-label">Backup Limit</label>
128
<div>
129
<input type="text" id="pBackupLimit" name="backup_limit" class="form-control" value="{{ old('backup_limit', 0) }}"/>
130
</div>
131
<p class="text-muted small">The total number of backups that can be created for this server.</p>
132
</div>
133
</div>
134
</div>
135
</div>
136
</div>
137
<div class="row">
138
<div class="col-xs-12">
139
<div class="box">
140
<div class="box-header with-border">
141
<h3 class="box-title">Resource Management</h3>
142
</div>
143
144
<div class="box-body row">
145
<div class="form-group col-xs-6">
146
<label for="pCPU">CPU Limit</label>
147
148
<div class="input-group">
149
<input type="text" id="pCPU" name="cpu" class="form-control" value="{{ old('cpu', 0) }}" />
150
<span class="input-group-addon">%</span>
151
</div>
152
153
<p class="text-muted small">If you do not want to limit CPU usage, set the value to <code>0</code>. To determine a value, take the number of threads and multiply it by 100. For example, on a quad core system without hyperthreading <code>(4 * 100 = 400)</code> there is <code>400%</code> available. To limit a server to using half of a single thread, you would set the value to <code>50</code>. To allow a server to use up to two threads, set the value to <code>200</code>.<p>
154
</div>
155
156
<div class="form-group col-xs-6">
157
<label for="pThreads">CPU Pinning</label>
158
159
<div>
160
<input type="text" id="pThreads" name="threads" class="form-control" value="{{ old('threads') }}" />
161
</div>
162
163
<p class="text-muted small"><strong>Advanced:</strong> Enter the specific CPU threads that this process can run on, or leave blank to allow all threads. This can be a single number, or a comma separated list. Example: <code>0</code>, <code>0-1,3</code>, or <code>0,1,3,4</code>.</p>
164
</div>
165
</div>
166
167
<div class="box-body row">
168
<div class="form-group col-xs-6">
169
<label for="pMemory">Memory</label>
170
171
<div class="input-group">
172
<input type="text" id="pMemory" name="memory" class="form-control" value="{{ old('memory') }}" />
173
<span class="input-group-addon">MiB</span>
174
</div>
175
176
<p class="text-muted small">The maximum amount of memory allowed for this container. Setting this to <code>0</code> will allow unlimited memory in a container.</p>
177
</div>
178
179
<div class="form-group col-xs-6">
180
<label for="pSwap">Swap</label>
181
182
<div class="input-group">
183
<input type="text" id="pSwap" name="swap" class="form-control" value="{{ old('swap', 0) }}" />
184
<span class="input-group-addon">MiB</span>
185
</div>
186
187
<p class="text-muted small">Setting this to <code>0</code> will disable swap space on this server. Setting to <code>-1</code> will allow unlimited swap.</p>
188
</div>
189
</div>
190
191
<div class="box-body row">
192
<div class="form-group col-xs-6">
193
<label for="pDisk">Disk Space</label>
194
195
<div class="input-group">
196
<input type="text" id="pDisk" name="disk" class="form-control" value="{{ old('disk') }}" />
197
<span class="input-group-addon">MiB</span>
198
</div>
199
200
<p class="text-muted small">This server will not be allowed to boot if it is using more than this amount of space. If a server goes over this limit while running it will be safely stopped and locked until enough space is available. Set to <code>0</code> to allow unlimited disk usage.</p>
201
</div>
202
203
<div class="form-group col-xs-6">
204
<label for="pIO">Block IO Weight</label>
205
206
<div>
207
<input type="text" id="pIO" name="io" class="form-control" value="{{ old('io', 500) }}" />
208
</div>
209
210
<p class="text-muted small"><strong>Advanced</strong>: The IO performance of this server relative to other <em>running</em> containers on the system. Value should be between <code>10</code> and <code>1000</code>. Please see <a href="https://docs.docker.com/engine/reference/run/#block-io-bandwidth-blkio-constraint" target="_blank">this documentation</a> for more information about it.</p>
211
</div>
212
<div class="form-group col-xs-12">
213
<div class="checkbox checkbox-primary no-margin-bottom">
214
<input type="checkbox" id="pOomDisabled" name="oom_disabled" value="0" {{ \Pterodactyl\Helpers\Utilities::checked('oom_disabled', 0) }} />
215
<label for="pOomDisabled" class="strong">Enable OOM Killer</label>
216
</div>
217
218
<p class="small text-muted no-margin">Terminates the server if it breaches the memory limits. Enabling OOM killer may cause server processes to exit unexpectedly.</p>
219
</div>
220
</div>
221
</div>
222
</div>
223
</div>
224
225
<div class="row">
226
<div class="col-md-6">
227
<div class="box">
228
<div class="box-header with-border">
229
<h3 class="box-title">Nest Configuration</h3>
230
</div>
231
232
<div class="box-body row">
233
<div class="form-group col-xs-12">
234
<label for="pNestId">Nest</label>
235
236
<select id="pNestId" name="nest_id" class="form-control">
237
@foreach($nests as $nest)
238
<option value="{{ $nest->id }}"
239
@if($nest->id === old('nest_id'))
240
selected="selected"
241
@endif
242
>{{ $nest->name }}</option>
243
@endforeach
244
</select>
245
246
<p class="small text-muted no-margin">Select the Nest that this server will be grouped under.</p>
247
</div>
248
249
<div class="form-group col-xs-12">
250
<label for="pEggId">Egg</label>
251
<select id="pEggId" name="egg_id" class="form-control"></select>
252
<p class="small text-muted no-margin">Select the Egg that will define how this server should operate.</p>
253
</div>
254
<div class="form-group col-xs-12">
255
<div class="checkbox checkbox-primary no-margin-bottom">
256
<input type="checkbox" id="pSkipScripting" name="skip_scripts" value="1" {{ \Pterodactyl\Helpers\Utilities::checked('skip_scripts', 0) }} />
257
<label for="pSkipScripting" class="strong">Skip Egg Install Script</label>
258
</div>
259
260
<p class="small text-muted no-margin">If the selected Egg has an install script attached to it, the script will run during the install. If you would like to skip this step, check this box.</p>
261
</div>
262
</div>
263
</div>
264
</div>
265
266
<div class="col-md-6">
267
<div class="box">
268
<div class="box-header with-border">
269
<h3 class="box-title">Docker Configuration</h3>
270
</div>
271
272
<div class="box-body row">
273
<div class="form-group col-xs-12">
274
<label for="pDefaultContainer">Docker Image</label>
275
<select id="pDefaultContainer" name="image" class="form-control"></select>
276
<input id="pDefaultContainerCustom" name="custom_image" value="{{ old('custom_image') }}" class="form-control" placeholder="Or enter a custom image..." style="margin-top:1rem"/>
277
<p class="small text-muted no-margin">This is the default Docker image that will be used to run this server. Select an image from the dropdown above, or enter a custom image in the text field above.</p>
278
</div>
279
</div>
280
</div>
281
</div>
282
</div>
283
284
<div class="row">
285
<div class="col-md-12">
286
<div class="box">
287
<div class="box-header with-border">
288
<h3 class="box-title">Startup Configuration</h3>
289
</div>
290
291
<div class="box-body row">
292
<div class="form-group col-xs-12">
293
<label for="pStartup">Startup Command</label>
294
<input type="text" id="pStartup" name="startup" value="{{ old('startup') }}" class="form-control" />
295
<p class="small text-muted no-margin">The following data substitutes are available for the startup command: <code>@{{SERVER_MEMORY}}</code>, <code>@{{SERVER_IP}}</code>, and <code>@{{SERVER_PORT}}</code>. They will be replaced with the allocated memory, server IP, and server port respectively.</p>
296
</div>
297
</div>
298
299
<div class="box-header with-border" style="margin-top:-10px;">
300
<h3 class="box-title">Service Variables</h3>
301
</div>
302
303
<div class="box-body row" id="appendVariablesTo"></div>
304
305
<div class="box-footer">
306
{!! csrf_field() !!}
307
<input type="submit" class="btn btn-success pull-right" value="Create Server" />
308
</div>
309
</div>
310
</div>
311
</div>
312
</form>
313
@endsection
314
315
@section('footer-scripts')
316
@parent
317
{!! Theme::js('vendor/lodash/lodash.js') !!}
318
319
<script type="application/javascript">
320
// Persist 'Service Variables'
321
function serviceVariablesUpdated(eggId, ids) {
322
@if (old('egg_id'))
323
// Check if the egg id matches.
324
if (eggId != '{{ old('egg_id') }}') {
325
return;
326
}
327
328
@if (old('environment'))
329
@foreach (old('environment') as $key => $value)
330
$('#' + ids['{{ $key }}']).val('{{ $value }}');
331
@endforeach
332
@endif
333
@endif
334
@if(old('image'))
335
$('#pDefaultContainer').val('{{ old('image') }}');
336
@endif
337
}
338
// END Persist 'Service Variables'
339
</script>
340
341
{!! Theme::js('js/admin/new-server.js?v=20220530') !!}
342
343
<script type="application/javascript">
344
$(document).ready(function() {
345
// Persist 'Server Owner' select2
346
@if (old('owner_id'))
347
$.ajax({
348
url: '/admin/users/accounts.json?user_id={{ old('owner_id') }}',
349
dataType: 'json',
350
}).then(function (data) {
351
initUserIdSelect([ data ]);
352
});
353
@else
354
initUserIdSelect();
355
@endif
356
// END Persist 'Server Owner' select2
357
358
// Persist 'Node' select2
359
@if (old('node_id'))
360
$('#pNodeId').val('{{ old('node_id') }}').change();
361
362
// Persist 'Default Allocation' select2
363
@if (old('allocation_id'))
364
$('#pAllocation').val('{{ old('allocation_id') }}').change();
365
@endif
366
// END Persist 'Default Allocation' select2
367
368
// Persist 'Additional Allocations' select2
369
@if (old('allocation_additional'))
370
const additional_allocations = [];
371
372
@for ($i = 0; $i < count(old('allocation_additional')); $i++)
373
additional_allocations.push('{{ old('allocation_additional.'.$i)}}');
374
@endfor
375
376
$('#pAllocationAdditional').val(additional_allocations).change();
377
@endif
378
// END Persist 'Additional Allocations' select2
379
@endif
380
// END Persist 'Node' select2
381
382
// Persist 'Nest' select2
383
@if (old('nest_id'))
384
$('#pNestId').val('{{ old('nest_id') }}').change();
385
386
// Persist 'Egg' select2
387
@if (old('egg_id'))
388
$('#pEggId').val('{{ old('egg_id') }}').change();
389
@endif
390
// END Persist 'Egg' select2
391
@endif
392
// END Persist 'Nest' select2
393
});
394
</script>
395
@endsection
396
397