Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace Allocations with Endpoints #395

Draft
wants to merge 112 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
112 commits
Select commit Hold shift + click to select a range
5b6c462
This isn’t typically used for a brand new server
lancepioch Jun 2, 2024
29f8ac6
This is for the api
lancepioch Jun 2, 2024
b220c58
Rearrange these
lancepioch Jun 2, 2024
9c81c0c
Use public member
lancepioch Jun 2, 2024
f480a27
Simplify logic
lancepioch Jun 2, 2024
4dbb550
Remove auto generated properties
lancepioch Jun 2, 2024
71684dc
Pint fix
lancepioch Jun 2, 2024
2e7c534
Disable this if there’s no egg
lancepioch Jun 2, 2024
bbe09ce
Add some new options for ports
lancepioch Jun 2, 2024
768a45b
More updates
lancepioch Jun 3, 2024
dbad5ae
WIP
lancepioch Jun 4, 2024
5511758
Better kebab names
lancepioch Jun 4, 2024
be6f795
Wip
lancepioch Jun 4, 2024
81f218d
Skip port variables down below
lancepioch Jun 6, 2024
b16a11c
No longer reserved
lancepioch Jun 6, 2024
32e96dc
Wip
lancepioch Jun 6, 2024
b1d7d21
Allow startup command to change with server variable
lancepioch Jun 7, 2024
beadce9
Wip
lancepioch Jun 9, 2024
9ad113b
Move these
lancepioch Jun 9, 2024
4319f24
Merge branch 'main' into issue/68
lancepioch Jun 9, 2024
17bc3de
Rename translation keys
lancepioch Jun 11, 2024
0895bd2
Remove relation managers
lancepioch Jun 11, 2024
f5edb34
Some filament changes for ports
lancepioch Jun 11, 2024
510ae3c
Swap this for now
lancepioch Jun 11, 2024
36e2fa8
Wip
lancepioch Jun 11, 2024
e15d515
Wip
lancepioch Jun 14, 2024
30051ab
Add tooltips for versions
lancepioch Jun 15, 2024
4cba154
Add endpoints
lancepioch Jun 15, 2024
0bd2935
Merge branch 'main' into issue/68
lancepioch Jun 15, 2024
405aa85
Reset these for now
lancepioch Jun 15, 2024
bcb7240
Pint fixes
lancepioch Jun 15, 2024
b47f40b
Remove debug
lancepioch Jun 15, 2024
1a26f5c
This goes first
lancepioch Jun 15, 2024
7c25fc2
Revert these doc blocks
lancepioch Jun 15, 2024
375a64a
Remove these relationships
lancepioch Jun 15, 2024
a97341f
Cast to int
lancepioch Jun 15, 2024
459d90e
Revert this
lancepioch Jun 15, 2024
8ea57bc
Remove unused audit logs
lancepioch Jun 15, 2024
44e0dd3
Remove final refs
lancepioch Jun 15, 2024
2b58160
Drop it
lancepioch Jun 15, 2024
6976fa8
Try again
lancepioch Jun 15, 2024
eff8e50
Wrap in transaction
lancepioch Jun 15, 2024
b24ff8b
Unwrap transaction
lancepioch Jun 15, 2024
f57232b
Fix tests
lancepioch Jun 16, 2024
d9dc932
Remove unused import
lancepioch Jun 16, 2024
a869970
Fix return
lancepioch Jun 16, 2024
738707b
Add validation rule
lancepioch Jun 16, 2024
c7bea4f
This was wrong but somehow worked in sqlite, wut
lancepioch Jun 16, 2024
ff261f9
Realism
lancepioch Jun 16, 2024
9d9720a
Start servers by default
lancepioch Jun 17, 2024
69acc48
Use constants
lancepioch Jun 17, 2024
3fa714c
Refactor
lancepioch Jun 17, 2024
05573f6
Group servers
lancepioch Jun 17, 2024
f699fd5
Make ports into badges
lancepioch Jun 17, 2024
48f4c35
Can be null apparently
lancepioch Jun 17, 2024
3201839
Add server io weight default
lancepioch Jun 17, 2024
ba5b81c
Show localhost
lancepioch Jun 17, 2024
7986505
Don’t report status anymore
lancepioch Jun 17, 2024
958e8fa
Simplify states and statuses and resolve #362
lancepioch Jun 17, 2024
d4484f5
Handle nulls
lancepioch Jun 18, 2024
48fd3cc
Add restore to simplify form
lancepioch Jun 18, 2024
eb0bad8
Wip
lancepioch Jun 22, 2024
e7ee86a
Fix whoopsie
lancepioch Jun 24, 2024
755632f
Wip
lancepioch Jun 24, 2024
343a5b8
Almost done
lancepioch Jun 27, 2024
7c8b204
Remove network tab
lancepioch Jun 27, 2024
19c7b4d
Clean up
lancepioch Jun 27, 2024
45fcc2a
Merge branch 'main' into issue/68
lancepioch Jun 27, 2024
4f10ec2
Fix name
lancepioch Jun 27, 2024
f6122f9
Rename this because order matters
lancepioch Jun 27, 2024
68ef0a1
Fix these
lancepioch Jun 27, 2024
5b468c2
Merge branch 'main' into issue/68
lancepioch Jul 1, 2024
d868439
Run pint
lancepioch Jul 1, 2024
4273880
Better helper text
lancepioch Jul 1, 2024
c45e4ed
Allow port rule to be optional
lancepioch Jul 1, 2024
6238d6d
Switch to port rule
lancepioch Jul 1, 2024
4c41e65
Add main server port and default
lancepioch Jul 1, 2024
f2eca17
Use constants
lancepioch Jul 2, 2024
6b104e3
Allow the server port to be selected if it also may only exist in the…
lancepioch Jul 2, 2024
9d9e4ad
Don’t need this anymore
lancepioch Jul 2, 2024
d9922e8
This has annoyed me...
notAreYouScared Jul 2, 2024
d71b1a4
Merge branch 'issue/68' of github.com:pelican-dev/panel into issue/68
lancepioch Jul 2, 2024
4574821
Also nuke this
notAreYouScared Jul 2, 2024
ec0fa3c
Revert "Also nuke this"
notAreYouScared Jul 2, 2024
bebc410
Update these
notAreYouScared Jul 2, 2024
11feef4
Update Eggs
notAreYouScared Jul 3, 2024
a9c7eed
Add the any ip address
lancepioch Jul 3, 2024
0f798e5
Add custom component
lancepioch Jul 3, 2024
e76630b
Merge branch 'issue/68' of github.com:pelican-dev/panel into issue/68
lancepioch Jul 3, 2024
3a76fb1
Revert "Add custom component"
lancepioch Jul 4, 2024
233fd50
Don’t include this by default
lancepioch Jul 4, 2024
8b86707
Wip
lancepioch Jul 4, 2024
f2754c3
Fix mappings
lancepioch Jul 4, 2024
aff9f4e
Don’t need this anymore
lancepioch Jul 4, 2024
0a6b846
Merge branch 'main' into issue/68
lancepioch Sep 19, 2024
9ba8c1d
Update Laravel framework
lancepioch Sep 19, 2024
906d4a7
Use new migration logic
lancepioch Sep 19, 2024
df88d33
Update pint
lancepioch Sep 21, 2024
5353d38
Merge branch 'main' into issue/68
lancepioch Oct 19, 2024
2cc4a42
This is now an array
lancepioch Oct 19, 2024
97a4601
Update laravel framework
lancepioch Oct 19, 2024
455d054
Fix double test runners
lancepioch Oct 19, 2024
c2f6842
Smarter check
lancepioch Oct 19, 2024
804ff64
Force register the validation rule
lancepioch Oct 19, 2024
50ffaf4
Fix tests
lancepioch Oct 19, 2024
a42cb19
Thank you merge conflict
lancepioch Oct 19, 2024
4fa49ae
This is now an array
lancepioch Oct 19, 2024
3d8847a
Resolve phpstan issues
lancepioch Oct 19, 2024
1aa51d1
Resolve this for now
lancepioch Oct 19, 2024
4f5e9a6
Merge branch 'main' into issue/68
lancepioch Oct 20, 2024
a2108c3
Various improvements
lancepioch Oct 20, 2024
4eeefab
Delete allocation exceptions
lancepioch Oct 20, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 45 additions & 0 deletions app/Casts/EndpointCollection.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
<?php

namespace App\Casts;

use App\Models\Objects\Endpoint;
use Illuminate\Contracts\Database\Eloquent\Castable;
use Illuminate\Contracts\Database\Eloquent\CastsAttributes;
use Illuminate\Support\Collection;

class EndpointCollection implements Castable
{
public static function castUsing(array $arguments)
{
return new class() implements CastsAttributes
{
public function get($model, $key, $value, $attributes)
{
if (!isset($attributes[$key])) {
return new Collection();
}

$data = json_decode($attributes[$key], true);

return (new Collection($data))->map(function ($value) {
return new Endpoint($value);
});
}

public function set($model, $key, $value, $attributes)
{
if (!is_array($value) && !$value instanceof Collection) {
return new Collection();
}

if (!$value instanceof Collection) {
$value = new Collection($value);
}

return [
'ports' => $value->toJson(),
];
}
};
}
}

This file was deleted.

This file was deleted.

16 changes: 0 additions & 16 deletions app/Exceptions/Service/Allocation/CidrOutOfRangeException.php

This file was deleted.

16 changes: 0 additions & 16 deletions app/Exceptions/Service/Allocation/InvalidPortMappingException.php

This file was deleted.

This file was deleted.

16 changes: 0 additions & 16 deletions app/Exceptions/Service/Allocation/PortOutOfRangeException.php

This file was deleted.

This file was deleted.

16 changes: 0 additions & 16 deletions app/Exceptions/Service/Allocation/TooManyPortsInRangeException.php

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace App\Filament\Resources\DatabaseHostResource\Pages;

use App\Filament\Resources\DatabaseHostResource;
use App\Models\Objects\Endpoint;
use App\Services\Databases\Hosts\HostCreationService;
use Closure;
use Exception;
Expand Down Expand Up @@ -59,7 +60,7 @@ public function form(Form $form): Form
->numeric()
->default(3306)
->minValue(0)
->maxValue(65535),
->maxValue(Endpoint::PORT_CEIL),
TextInput::make('max_databases')
->label('Max databases')
->helpertext('Blank is unlimited.')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
use App\Filament\Resources\DatabaseHostResource;
use App\Filament\Resources\DatabaseHostResource\RelationManagers\DatabasesRelationManager;
use App\Models\DatabaseHost;
use App\Models\Objects\Endpoint;
use App\Services\Databases\Hosts\HostUpdateService;
use Closure;
use Exception;
Expand Down Expand Up @@ -55,7 +56,7 @@ public function form(Form $form): Form
->required()
->numeric()
->minValue(0)
->maxValue(65535),
->maxValue(Endpoint::PORT_CEIL),
TextInput::make('max_databases')
->label('Max databases')
->helpertext('Blank is unlimited.')
Expand Down
2 changes: 1 addition & 1 deletion app/Filament/Resources/EggResource/Pages/CreateEgg.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public function form(Form $form): Form
->columnSpan(['default' => 1, 'sm' => 1, 'md' => 2, 'lg' => 2]),
Toggle::make('force_outgoing_ip')
->hintIcon('tabler-question-mark')
->hintIconTooltip("Forces all outgoing network traffic to have its Source IP NATed to the IP of the server's primary allocation IP.
->hintIconTooltip("Forces all outgoing network traffic to have its Source IP NATed to the IP of the server's primary endpoint.
Required for certain games to work properly when the Node has multiple public IP addresses.
Enabling this option will disable internal networking for any servers using this egg, causing them to be unable to internally access other servers on the same node."),
Hidden::make('script_is_privileged')
Expand Down
2 changes: 1 addition & 1 deletion app/Filament/Resources/EggResource/Pages/EditEgg.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ public function form(Form $form): Form
Toggle::make('force_outgoing_ip')
->inline(false)
->hintIcon('tabler-question-mark')
->hintIconTooltip("Forces all outgoing network traffic to have its Source IP NATed to the IP of the server's primary allocation IP.
->hintIconTooltip("Forces all outgoing network traffic to have its Source IP NATed to the IP of the server's endpoint.
Required for certain games to work properly when the Node has multiple public IP addresses.
Enabling this option will disable internal networking for any servers using this egg, causing them to be unable to internally access other servers on the same node."),
Hidden::make('script_is_privileged')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

use App\Models\Server;
use Filament\Resources\RelationManagers\RelationManager;
use Filament\Tables\Columns\SelectColumn;
use Filament\Tables\Columns\TextColumn;
use Filament\Tables\Table;

Expand Down Expand Up @@ -33,11 +32,6 @@ public function table(Table $table): Table
->url(fn (Server $server): string => route('filament.admin.resources.nodes.edit', ['record' => $server->node])),
TextColumn::make('image')
->label('Docker Image'),
SelectColumn::make('allocation.id')
->label('Primary Allocation')
->options(fn (Server $server) => [$server->allocation->id => $server->allocation->address])
->selectablePlaceholder(false)
->sortable(),
]);
}
}
2 changes: 0 additions & 2 deletions app/Filament/Resources/NodeResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
namespace App\Filament\Resources;

use App\Filament\Resources\NodeResource\Pages;
use App\Filament\Resources\NodeResource\RelationManagers\AllocationsRelationManager;
use App\Filament\Resources\NodeResource\RelationManagers\NodesRelationManager;
use App\Models\Node;
use Filament\Resources\Resource;
Expand All @@ -24,7 +23,6 @@ public static function getNavigationBadge(): ?string
public static function getRelations(): array
{
return [
AllocationsRelationManager::class,
NodesRelationManager::class,
];
}
Expand Down
5 changes: 3 additions & 2 deletions app/Filament/Resources/NodeResource/Pages/CreateNode.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace App\Filament\Resources\NodeResource\Pages;

use App\Filament\Resources\NodeResource;
use App\Models\Objects\Endpoint;
use Filament\Forms;
use Filament\Forms\Components\Actions\Action;
use Filament\Forms\Components\Grid;
Expand Down Expand Up @@ -139,7 +140,7 @@ public function form(Forms\Form $form): Forms\Form
->label(trans('strings.port'))
->helperText('If you are running the daemon behind Cloudflare you should set the daemon port to 8443 to allow websocket proxying over SSL.')
->minValue(1)
->maxValue(65535)
->maxValue(Endpoint::PORT_CEIL)
->default(8080)
->required()
->integer(),
Expand Down Expand Up @@ -244,7 +245,7 @@ public function form(Forms\Form $form): Forms\Form
->columnSpan(1)
->label('SFTP Port')
->minValue(1)
->maxValue(65535)
->maxValue(Endpoint::PORT_CEIL)
->default(2022)
->required()
->integer(),
Expand Down
5 changes: 3 additions & 2 deletions app/Filament/Resources/NodeResource/Pages/EditNode.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

use App\Filament\Resources\NodeResource;
use App\Models\Node;
use App\Models\Objects\Endpoint;
use App\Services\Nodes\NodeUpdateService;
use Filament\Actions;
use Filament\Forms;
Expand Down Expand Up @@ -165,7 +166,7 @@ public function form(Forms\Form $form): Forms\Form
->label(trans('strings.port'))
->helperText('If you are running the daemon behind Cloudflare you should set the daemon port to 8443 to allow websocket proxying over SSL.')
->minValue(1)
->maxValue(65535)
->maxValue(Endpoint::PORT_CEIL)
->default(8080)
->required()
->integer(),
Expand Down Expand Up @@ -243,7 +244,7 @@ public function form(Forms\Form $form): Forms\Form
->columnSpan(['default' => 1, 'sm' => 1, 'md' => 1, 'lg' => 3])
->label('SFTP Port')
->minValue(1)
->maxValue(65535)
->maxValue(Endpoint::PORT_CEIL)
->default(2022)
->required()
->integer(),
Expand Down
Loading
Loading