Add back missing node creation page.

This commit is contained in:
Dane Everitt 2017-03-15 21:38:09 -04:00
parent 4094a49e9c
commit 1852018397
No known key found for this signature in database
GPG key ID: EEA66103B3D71F53
3 changed files with 192 additions and 12 deletions

2
.gitignore vendored
View file

@ -3,6 +3,7 @@
.env
.vagrant/*
.vscode/*
storage/framework/*
composer.lock
@ -15,5 +16,4 @@ yarn.lock
node_modules
_ide_helper_models.php
_ide_helper.php

View file

@ -82,11 +82,16 @@ class NodesController extends Controller
{
try {
$repo = new NodeRepository;
$node = $repo->create($request->intersect([
'name', 'location_id', 'public', 'fqdn', 'scheme', 'memory',
'memory_overallocate', 'disk', 'disk_overallocate',
'daemonBase', 'daemonSFTP', 'daemonListen',
]));
$node = $repo->create(array_merge(
$request->only([
'public', 'disk_overallocate', 'memory_overallocate',
]),
$request->intersect([
'name', 'location_id', 'fqdn',
'scheme', 'memory', 'disk',
'daemonBase', 'daemonSFTP', 'daemonListen',
])
));
Alert::success('Successfully created new node that can be configured automatically on your remote machine by visiting the configuration tab. <strong>Before you can add any servers you need to first assign some IP addresses and ports.</strong>')->flash();
return redirect()->route('admin.nodes.view', $node->id);
@ -213,12 +218,16 @@ class NodesController extends Controller
$repo = new NodeRepository;
try {
$repo->update($id, $request->intersect([
'name', 'location_id', 'public', 'fqdn', 'scheme', 'memory',
'memory_overallocate', 'disk', 'disk_overallocate', 'upload_size',
'daemonSFTP', 'daemonListen', 'reset_secret',
]));
$node = $repo->update($id, array_merge(
$request->only([
'public', 'disk_overallocate', 'memory_overallocate',
]),
$request->intersect([
'name', 'location_id', 'fqdn',
'scheme', 'memory', 'disk', 'upload_size',
'reset_secret', 'daemonSFTP', 'daemonListen',
])
));
Alert::success('Successfully updated this node\'s information. If you changed any daemon settings you will need to restart it now.')->flash();
} catch (DisplayValidationException $ex) {
return redirect()->route('admin.nodes.view.settings', $id)->withErrors(json_decode($ex->getMessage()))->withInput();

View file

@ -0,0 +1,171 @@
{{-- Copyright (c) 2015 - 2017 Dane Everitt <dane@daneeveritt.com> --}}
{{-- Permission is hereby granted, free of charge, to any person obtaining a copy --}}
{{-- of this software and associated documentation files (the "Software"), to deal --}}
{{-- in the Software without restriction, including without limitation the rights --}}
{{-- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell --}}
{{-- copies of the Software, and to permit persons to whom the Software is --}}
{{-- furnished to do so, subject to the following conditions: --}}
{{-- The above copyright notice and this permission notice shall be included in all --}}
{{-- copies or substantial portions of the Software. --}}
{{-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR --}}
{{-- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, --}}
{{-- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE --}}
{{-- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER --}}
{{-- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, --}}
{{-- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE --}}
{{-- SOFTWARE. --}}
@extends('layouts.admin')
@section('title')
Nodes &rarr; New
@endsection
@section('content-header')
<h1>New Node<small>Create a new local or remote node for servers to be installed to.</small></h1>
<ol class="breadcrumb">
<li><a href="{{ route('admin.index') }}">Admin</a></li>
<li><a href="{{ route('admin.nodes') }}">Nodes</a></li>
<li class="active">New</li>
</ol>
@endsection
@section('content')
<form action="{{ route('admin.nodes.new') }}" method="POST">
<div class="row">
<div class="col-sm-6">
<div class="box box-primary">
<div class="box-header with-border">
<h3 class="box-title">Basic Details</h3>
</div>
<div class="box-body">
<div class="form-group">
<label for="pName" class="form-label">Name</label>
<input type="text" name="name" id="pName" class="form-control" />
<p class="text-muted small">Character limits: <code>a-zA-Z0-9_.-</code> and <code>[Space]</code> (min 1, max 100 characters).</p>
</div>
<div class="form-group">
<label for="pLocationId" class="form-label">Location</label>
<select name="location_id" id="pLocationId">
@foreach($locations as $location)
<option value="{{ $location->id }}">{{ $location->short }}</option>
@endforeach
</select>
</div>
<div class="form-group">
<label class="form-label">Node Visibility</label>
<div>
<div class="radio radio-success radio-inline">
<input type="radio" id="pPublicTrue" value="1" name="public" checked>
<label for="pPublicTrue"> Public </label>
</div>
<div class="radio radio-danger radio-inline">
<input type="radio" id="pPublicFalse" value="0" name="public">
<label for="pPublicFalse"> Private </label>
</div>
</div>
<p class="text-muted small">By setting a node to <code>private</code> you will be denying the ability to auto-deploy to this node.
</div>
<div class="form-group">
<label for="pFQDN" class="form-label">FQDN</label>
<input type="text" name="fqdn" id="pFQDN" class="form-control" />
<p class="text-muted small">Please enter domain name (e.g <code>node.example.com</code>) to be used for connecting to the daemon. An IP address may be used <em>only</em> if you are not using SSL for this node.</p>
</div>
<div class="form-group">
<label class="form-label">Communicate Over SSL</label>
<div>
<div class="radio radio-success radio-inline">
<input type="radio" id="pSSLTrue" value="https" name="scheme" checked>
<label for="pSSLTrue"> Enable SSL </label>
</div>
<div class="radio radio-danger radio-inline">
<input type="radio" id="pSSLFalse" value="http" name="scheme">
<label for="pSSLFalse"> Disable SSL </label>
</div>
</div>
<p class="text-muted small">SSL should only be disabled if this node is assigned an IP address as the FQDN and not an actual FQDN. Disabling SSL could allow a malicious user to intercept traffic between the panel and the daemon potentially exposing sensitive information.</p>
</div>
<div class="form-group">
<label for="pDaemonBase" class="form-label">Daemon Server File Directory</label>
<input type="text" name="daemonBase" id="pDaemonBase" class="form-control" value="/srv/daemon-data" />
<p class="text-muted small">Enter the directory where server files should be stored. <strong>If you use OVH you should check your partition scheme. You may need to use <code>/home/daemon-data</code> to have enough space.</strong></p>
</div>
</div>
</div>
</div>
<div class="col-sm-6">
<div class="box box-primary">
<div class="box-header with-border">
<h3 class="box-title">Configuration</h3>
</div>
<div class="box-body">
<div class="row">
<div class="form-group col-md-6">
<label for="pMemory" class="form-label">Total Memory</label>
<div class="input-group">
<input type="text" name="memory" data-multiplicator="true" class="form-control" id="pMemory"/>
<span class="input-group-addon">MB</span>
</div>
</div>
<div class="form-group col-md-6">
<label for="pMemoryOverallocate" class="form-label">Memory Over-Allocation</label>
<div class="input-group">
<input type="text" name="memory_overallocate" class="form-control" id="pMemoryOverallocate"/>
<span class="input-group-addon">%</span>
</div>
</div>
<div class="col-md-12">
<p class="text-muted small">Enter the total amount of memory avaliable for new servers. If you would like to allow overallocation of memory enter the percentage that you want to allow. To disable checking for overallocation enter <code>-1</code> into the field. Entering <code>0</code> will prevent creating new servers if it would put the node over the limit.</p>
</div>
</div>
<div class="row">
<div class="form-group col-md-6">
<label for="pDisk" class="form-label">Total Disk Space</label>
<div class="input-group">
<input type="text" name="disk" data-multiplicator="true" class="form-control" id="pDisk"/>
<span class="input-group-addon">MB</span>
</div>
</div>
<div class="form-group col-md-6">
<label for="pDiskOverallocate" class="form-label">Disk Over-Allocation</label>
<div class="input-group">
<input type="text" name="disk_overallocate" class="form-control" id="pDiskOverallocate"/>
<span class="input-group-addon">%</span>
</div>
</div>
<div class="col-md-12">
<p class="text-muted small">Enter the total amount of disk space avaliable for new servers. If you would like to allow overallocation of disk space enter the percentage that you want to allow. To disable checking for overallocation enter <code>-1</code> into the field. Entering <code>0</code> will prevent creating new servers if it would put the node over the limit.</p>
</div>
</div>
<div class="row">
<div class="form-group col-md-6">
<label for="pDaemonListen" class="form-label">Daemon Port</label>
<input type="text" name="daemonListen" class="form-control" id="pDaemonListen" value="8080" />
</div>
<div class="form-group col-md-6">
<label for="pDaemonSFTP" class="form-label">Daemon SFTP Port</label>
<input type="text" name="daemonSFTP" class="form-control" id="pDaemonSFTP" value="2022" />
</div>
<div class="col-md-12">
<p class="text-muted small">The daemon runs its own SFTP management container and does not use the SSHd process on the main physical server. <Strong>Do not use the same port that you have assigned for your physcial server's SSH process.</strong> If you will be running the daemon behind CloudFlare&reg; you should set the daemon port to <code>8443</code> to allow websocket proxying over SSL.</p>
</div>
</div>
</div>
<div class="box-footer">
{!! csrf_field() !!}
<button type="submit" class="btn btn-success pull-right">Create Node</button>
</div>
</div>
</div>
</div>
</form>
@endsection
@section('footer-scripts')
@parent
<script>
$('#pLocationId').select2();
</script>
@endsection