initial commit
This commit is contained in:
70
database/seeders/HostingSeeder.php
Normal file
70
database/seeders/HostingSeeder.php
Normal file
@@ -0,0 +1,70 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use App\Enums\IpPoolType;
|
||||
use App\Enums\UserRole;
|
||||
use App\Models\HostingPlan;
|
||||
use App\Models\IpPool;
|
||||
use App\Models\User;
|
||||
use Illuminate\Database\Seeder;
|
||||
use Illuminate\Support\Facades\Hash;
|
||||
|
||||
class HostingSeeder extends Seeder
|
||||
{
|
||||
public function run(): void
|
||||
{
|
||||
User::query()->updateOrCreate(
|
||||
['email' => 'admin@hexahost.local'],
|
||||
[
|
||||
'name' => 'Administrator',
|
||||
'password' => Hash::make('admin1234'),
|
||||
'role' => UserRole::Admin,
|
||||
'is_active' => true,
|
||||
],
|
||||
);
|
||||
|
||||
$plans = [
|
||||
['slug' => 'small', 'name' => 'Small', 'cpu' => 2, 'ram' => 4096, 'disk' => 40],
|
||||
['slug' => 'medium', 'name' => 'Medium', 'cpu' => 4, 'ram' => 8192, 'disk' => 80],
|
||||
['slug' => 'large', 'name' => 'Large', 'cpu' => 8, 'ram' => 16384, 'disk' => 160],
|
||||
];
|
||||
|
||||
foreach ($plans as $plan) {
|
||||
HostingPlan::query()->updateOrCreate(
|
||||
['slug' => $plan['slug']],
|
||||
[
|
||||
...$plan,
|
||||
'max_backups' => (int) config('hosting.backups.max_per_customer', 4),
|
||||
'allow_public_ip' => true,
|
||||
'allow_iso_upload' => true,
|
||||
'is_active' => true,
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
IpPool::query()->updateOrCreate(
|
||||
['name' => 'Privat 10.32.0.0/24', 'type' => IpPoolType::Private],
|
||||
[
|
||||
'start_ip' => config('hosting.network.ip_pool_start', '10.32.0.10'),
|
||||
'end_ip' => config('hosting.network.ip_pool_end', '10.32.0.254'),
|
||||
'gateway' => config('hosting.network.gateway', '10.32.0.1'),
|
||||
'cidr' => (int) config('hosting.network.cidr', 24),
|
||||
'description' => 'Internes VM-Netz (Hyperion)',
|
||||
'is_active' => true,
|
||||
],
|
||||
);
|
||||
|
||||
IpPool::query()->updateOrCreate(
|
||||
['name' => 'Öffentlich 185.45.149.x', 'type' => IpPoolType::Public],
|
||||
[
|
||||
'start_ip' => config('hosting.public_network.ip_pool_start', '185.45.149.246'),
|
||||
'end_ip' => config('hosting.public_network.ip_pool_end', '185.45.149.252'),
|
||||
'gateway' => config('hosting.public_network.gateway', '185.45.149.241'),
|
||||
'cidr' => (int) config('hosting.public_network.cidr', 28),
|
||||
'description' => 'Öffentliche IPs /28',
|
||||
'is_active' => true,
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user