ran pint
This commit is contained in:
@@ -20,6 +20,7 @@ class InstallFirewallRule
|
|||||||
$firewallRule->update([
|
$firewallRule->update([
|
||||||
'status' => FirewallRuleStatus::FAILED,
|
'status' => FirewallRuleStatus::FAILED,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ class UninstallFirewallRule
|
|||||||
$firewallRule->update([
|
$firewallRule->update([
|
||||||
'status' => FirewallRuleStatus::FAILED,
|
'status' => FirewallRuleStatus::FAILED,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -7,10 +7,10 @@ use App\Services\ServerProviders\ServerProviderService;
|
|||||||
|
|
||||||
class GetProviderService
|
class GetProviderService
|
||||||
{
|
{
|
||||||
public function execute(string $provider): ServerProviderService|null
|
public function execute(string $provider): ?ServerProviderService
|
||||||
{
|
{
|
||||||
return match ($provider) {
|
return match ($provider) {
|
||||||
'hetzner' => new HetznerService(),
|
'hetzner' => new HetznerService,
|
||||||
default => null,
|
default => null,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ use Illuminate\Console\Command;
|
|||||||
class CreateServiceCommand extends Command
|
class CreateServiceCommand extends Command
|
||||||
{
|
{
|
||||||
protected $signature = 'service:create';
|
protected $signature = 'service:create';
|
||||||
|
|
||||||
protected $description = 'Create a service';
|
protected $description = 'Create a service';
|
||||||
|
|
||||||
public function handle()
|
public function handle()
|
||||||
@@ -20,15 +21,16 @@ class CreateServiceCommand extends Command
|
|||||||
|
|
||||||
if (! $server) {
|
if (! $server) {
|
||||||
$this->components->error('Server not found');
|
$this->components->error('Server not found');
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$serviceType = $this->components->choice('select the service you want to install', [
|
$serviceType = $this->components->choice('select the service you want to install', [
|
||||||
'postgres-17'
|
'postgres-17',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$serviceName = $this->components->ask('Enter the service name');
|
$serviceName = $this->components->ask('Enter the service name');
|
||||||
list ($type, $version) = explode('-', $serviceType);
|
[$type, $version] = explode('-', $serviceType);
|
||||||
|
|
||||||
$service = app(CreateService::class)->execute(
|
$service = app(CreateService::class)->execute(
|
||||||
server: $server,
|
server: $server,
|
||||||
|
|||||||
@@ -8,12 +8,14 @@ use Illuminate\Support\Facades\Process;
|
|||||||
class GenerateSshKey extends Command
|
class GenerateSshKey extends Command
|
||||||
{
|
{
|
||||||
protected $signature = 'setup:generate-ssh-key';
|
protected $signature = 'setup:generate-ssh-key';
|
||||||
|
|
||||||
protected $description = 'Generates an SSH key pair for the application.';
|
protected $description = 'Generates an SSH key pair for the application.';
|
||||||
|
|
||||||
public function handle()
|
public function handle()
|
||||||
{
|
{
|
||||||
if (file_exists(storage_path('app/private/ssh/id_ed25519'))) {
|
if (file_exists(storage_path('app/private/ssh/id_ed25519'))) {
|
||||||
$this->components->info('SSH key pair already exists.');
|
$this->components->info('SSH key pair already exists.');
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -29,6 +31,7 @@ class GenerateSshKey extends Command
|
|||||||
$this->components->error('Failed to generate SSH key pair.');
|
$this->components->error('Failed to generate SSH key pair.');
|
||||||
$this->line($result->output());
|
$this->line($result->output());
|
||||||
$this->line($result->errorOutput());
|
$this->line($result->errorOutput());
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ use Illuminate\Console\Command;
|
|||||||
class Setup extends Command
|
class Setup extends Command
|
||||||
{
|
{
|
||||||
protected $signature = 'setup';
|
protected $signature = 'setup';
|
||||||
|
|
||||||
protected $description = 'Initialize the application.';
|
protected $description = 'Initialize the application.';
|
||||||
|
|
||||||
public function handle()
|
public function handle()
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ class PlannedStep
|
|||||||
foreach ($this->secrets as $key => $value) {
|
foreach ($this->secrets as $key => $value) {
|
||||||
$script = str_replace("[!{$key}]", '********', $script);
|
$script = str_replace("[!{$key}]", '********', $script);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $script;
|
return $script;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -33,6 +34,7 @@ class PlannedStep
|
|||||||
foreach ($this->secrets as $key => $value) {
|
foreach ($this->secrets as $key => $value) {
|
||||||
$script = str_replace("[!{$key}]", $value, $script);
|
$script = str_replace("[!{$key}]", $value, $script);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $script;
|
return $script;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -5,9 +5,13 @@ namespace App\Drivers;
|
|||||||
abstract class DatabaseDriver extends Driver
|
abstract class DatabaseDriver extends Driver
|
||||||
{
|
{
|
||||||
public string $defaultUser = 'keystone';
|
public string $defaultUser = 'keystone';
|
||||||
|
|
||||||
public string $defaultDb = 'keystone';
|
public string $defaultDb = 'keystone';
|
||||||
|
|
||||||
public ?string $containerName;
|
public ?string $containerName;
|
||||||
|
|
||||||
public ?string $containerId;
|
public ?string $containerId;
|
||||||
|
|
||||||
public ?string $defaultPassword;
|
public ?string $defaultPassword;
|
||||||
|
|
||||||
abstract public function __construct(
|
abstract public function __construct(
|
||||||
|
|||||||
@@ -7,7 +7,9 @@ use App\Data\Deployments\Plan;
|
|||||||
abstract class Driver
|
abstract class Driver
|
||||||
{
|
{
|
||||||
public Plan $deploymentPlan;
|
public Plan $deploymentPlan;
|
||||||
|
|
||||||
public ?string $containerName;
|
public ?string $containerName;
|
||||||
|
|
||||||
public ?string $containerId;
|
public ?string $containerId;
|
||||||
|
|
||||||
abstract public function __construct(
|
abstract public function __construct(
|
||||||
|
|||||||
@@ -9,15 +9,16 @@ use App\Drivers\DatabaseDriver;
|
|||||||
class Postgres17Driver extends DatabaseDriver
|
class Postgres17Driver extends DatabaseDriver
|
||||||
{
|
{
|
||||||
public Plan $deploymentPlan;
|
public Plan $deploymentPlan;
|
||||||
|
|
||||||
public string $defaultUser = 'keystone';
|
public string $defaultUser = 'keystone';
|
||||||
|
|
||||||
public string $defaultDb = 'keystone';
|
public string $defaultDb = 'keystone';
|
||||||
|
|
||||||
public function __construct(
|
public function __construct(
|
||||||
public ?string $containerName = null,
|
public ?string $containerName = null,
|
||||||
public ?string $containerId = null,
|
public ?string $containerId = null,
|
||||||
public ?string $defaultPassword = null,
|
public ?string $defaultPassword = null,
|
||||||
)
|
) {
|
||||||
{
|
|
||||||
$this->deploymentPlan = new Plan(steps: [
|
$this->deploymentPlan = new Plan(steps: [
|
||||||
new Step(
|
new Step(
|
||||||
name: 'Run the docker image',
|
name: 'Run the docker image',
|
||||||
@@ -32,12 +33,12 @@ class Postgres17Driver extends DatabaseDriver
|
|||||||
$script->push('docker stop '.$this->containerId.' || true');
|
$script->push('docker stop '.$this->containerId.' || true');
|
||||||
}
|
}
|
||||||
|
|
||||||
$runCommand = "docker run -d";
|
$runCommand = 'docker run -d';
|
||||||
if ($this->containerName) {
|
if ($this->containerName) {
|
||||||
$runCommand .= " --name {$this->containerName}";
|
$runCommand .= " --name {$this->containerName}";
|
||||||
}
|
}
|
||||||
if ($this->defaultPassword) {
|
if ($this->defaultPassword) {
|
||||||
$runCommand .= " -e POSTGRES_PASSWORD=[!defaultPassword!]";
|
$runCommand .= ' -e POSTGRES_PASSWORD=[!defaultPassword!]';
|
||||||
}
|
}
|
||||||
if ($this->defaultUser) {
|
if ($this->defaultUser) {
|
||||||
$runCommand .= " -e POSTGRES_USER={$this->defaultUser}";
|
$runCommand .= " -e POSTGRES_USER={$this->defaultUser}";
|
||||||
@@ -46,7 +47,7 @@ class Postgres17Driver extends DatabaseDriver
|
|||||||
$runCommand .= " -e POSTGRES_DB={$this->defaultDb}";
|
$runCommand .= " -e POSTGRES_DB={$this->defaultDb}";
|
||||||
}
|
}
|
||||||
|
|
||||||
$runCommand .= " -p 5432:5432 postgres:17";
|
$runCommand .= ' -p 5432:5432 postgres:17';
|
||||||
|
|
||||||
return $runCommand;
|
return $runCommand;
|
||||||
}
|
}
|
||||||
@@ -54,7 +55,7 @@ class Postgres17Driver extends DatabaseDriver
|
|||||||
new Step(
|
new Step(
|
||||||
name: 'Configure firewall',
|
name: 'Configure firewall',
|
||||||
script: 'ufw allow 5432/tcp || true',
|
script: 'ufw allow 5432/tcp || true',
|
||||||
)
|
),
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -14,13 +14,15 @@ enum ServiceCategory: string
|
|||||||
case STORAGE = 'storage';
|
case STORAGE = 'storage';
|
||||||
case CACHE = 'cache';
|
case CACHE = 'cache';
|
||||||
|
|
||||||
public static function getDescription(ServiceCategory|string $category) {
|
public static function getDescription(ServiceCategory|string $category)
|
||||||
|
{
|
||||||
if (is_string($category)) {
|
if (is_string($category)) {
|
||||||
$category = ServiceCategory::from($category);
|
$category = ServiceCategory::from($category);
|
||||||
}
|
}
|
||||||
if (! $category instanceof ServiceCategory) {
|
if (! $category instanceof ServiceCategory) {
|
||||||
throw new \InvalidArgumentException('Invalid category provided');
|
throw new \InvalidArgumentException('Invalid category provided');
|
||||||
}
|
}
|
||||||
|
|
||||||
return match ($category) {
|
return match ($category) {
|
||||||
self::APPLICATION => 'The base container image for your application',
|
self::APPLICATION => 'The base container image for your application',
|
||||||
self::DATABASE => 'Postgres or MySQL',
|
self::DATABASE => 'Postgres or MySQL',
|
||||||
|
|||||||
@@ -4,7 +4,8 @@ namespace App\Enums;
|
|||||||
|
|
||||||
use App\Enums\Concerns\Arrayable;
|
use App\Enums\Concerns\Arrayable;
|
||||||
|
|
||||||
enum ServiceType: string {
|
enum ServiceType: string
|
||||||
|
{
|
||||||
use Arrayable;
|
use Arrayable;
|
||||||
|
|
||||||
case FRANKENPHP = 'frankenphp';
|
case FRANKENPHP = 'frankenphp';
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ class ApplicationController extends Controller
|
|||||||
public function show(Request $request)
|
public function show(Request $request)
|
||||||
{
|
{
|
||||||
$id = $request->route('application');
|
$id = $request->route('application');
|
||||||
|
|
||||||
return inertia('applications/Show');
|
return inertia('applications/Show');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ class EnvironmentController extends Controller
|
|||||||
public function show(Request $request)
|
public function show(Request $request)
|
||||||
{
|
{
|
||||||
$id = $request->route('environment');
|
$id = $request->route('environment');
|
||||||
|
|
||||||
return inertia('environments/Show', [
|
return inertia('environments/Show', [
|
||||||
'environment' => Environment::findOrFail($id),
|
'environment' => Environment::findOrFail($id),
|
||||||
]);
|
]);
|
||||||
|
|||||||
@@ -2,8 +2,6 @@
|
|||||||
|
|
||||||
namespace App\Http\Controllers;
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
use Illuminate\Http\Request;
|
|
||||||
|
|
||||||
class OrganisationController extends Controller
|
class OrganisationController extends Controller
|
||||||
{
|
{
|
||||||
public function show()
|
public function show()
|
||||||
|
|||||||
@@ -8,11 +8,9 @@ use App\Enums\ServerProvider;
|
|||||||
use App\Enums\ServerStatus;
|
use App\Enums\ServerStatus;
|
||||||
use App\Jobs\Servers\WaitForServerToConnect;
|
use App\Jobs\Servers\WaitForServerToConnect;
|
||||||
use App\Models\Organisation;
|
use App\Models\Organisation;
|
||||||
use App\Services\ServerProviders\HetznerService;
|
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
use Illuminate\Support\Facades\Cache;
|
use Illuminate\Support\Facades\Cache;
|
||||||
use Illuminate\Support\Str;
|
use Illuminate\Support\Str;
|
||||||
use NunoMaduro\Collision\Provider;
|
|
||||||
|
|
||||||
class ServerController extends Controller
|
class ServerController extends Controller
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ class ServiceController extends Controller
|
|||||||
public function create(Request $request)
|
public function create(Request $request)
|
||||||
{
|
{
|
||||||
$server = $request->route('server');
|
$server = $request->route('server');
|
||||||
|
|
||||||
return inertia('services/Create', [
|
return inertia('services/Create', [
|
||||||
'server' => $server,
|
'server' => $server,
|
||||||
]);
|
]);
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ class HetznerConnector extends Connector
|
|||||||
{
|
{
|
||||||
public function resolveBaseUrl(): string
|
public function resolveBaseUrl(): string
|
||||||
{
|
{
|
||||||
return "https://api.hetzner.cloud/v1";
|
return 'https://api.hetzner.cloud/v1';
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function defaultHeaders(): array
|
protected function defaultHeaders(): array
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ namespace App\Http\Integrations\Requests\Hetzner\Images;
|
|||||||
|
|
||||||
use Saloon\Enums\Method;
|
use Saloon\Enums\Method;
|
||||||
use Saloon\Http\Request;
|
use Saloon\Http\Request;
|
||||||
use Saloon\Traits\Body\HasJsonBody;
|
|
||||||
|
|
||||||
class GetImagesRequest extends Request
|
class GetImagesRequest extends Request
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ use Illuminate\Contracts\Queue\ShouldQueue;
|
|||||||
use Illuminate\Foundation\Queue\Queueable;
|
use Illuminate\Foundation\Queue\Queueable;
|
||||||
use Spatie\Ssh\Ssh;
|
use Spatie\Ssh\Ssh;
|
||||||
|
|
||||||
class ProvisionServer implements ShouldQueue, ShouldBeEncrypted
|
class ProvisionServer implements ShouldBeEncrypted, ShouldQueue
|
||||||
{
|
{
|
||||||
use Queueable;
|
use Queueable;
|
||||||
|
|
||||||
@@ -46,6 +46,7 @@ class ProvisionServer implements ShouldQueue, ShouldBeEncrypted
|
|||||||
$this->server->update([
|
$this->server->update([
|
||||||
'status' => ServerStatus::PROVISIONING_FAILED,
|
'status' => ServerStatus::PROVISIONING_FAILED,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -7,14 +7,14 @@ use App\Models\Server;
|
|||||||
use Illuminate\Contracts\Queue\ShouldBeEncrypted;
|
use Illuminate\Contracts\Queue\ShouldBeEncrypted;
|
||||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||||
use Illuminate\Foundation\Queue\Queueable;
|
use Illuminate\Foundation\Queue\Queueable;
|
||||||
use Illuminate\Support\Str;
|
|
||||||
use Spatie\Ssh\Ssh;
|
use Spatie\Ssh\Ssh;
|
||||||
|
|
||||||
class WaitForServerToConnect implements ShouldQueue, ShouldBeEncrypted
|
class WaitForServerToConnect implements ShouldBeEncrypted, ShouldQueue
|
||||||
{
|
{
|
||||||
use Queueable;
|
use Queueable;
|
||||||
|
|
||||||
public int $retryAfter = 15;
|
public int $retryAfter = 15;
|
||||||
|
|
||||||
public int $tries = 40;
|
public int $tries = 40;
|
||||||
|
|
||||||
public function __construct(
|
public function __construct(
|
||||||
@@ -35,6 +35,7 @@ class WaitForServerToConnect implements ShouldQueue, ShouldBeEncrypted
|
|||||||
|
|
||||||
if (! $process->isSuccessful()) {
|
if (! $process->isSuccessful()) {
|
||||||
$this->release(15);
|
$this->release(15);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -18,8 +18,7 @@ class DeployService implements ShouldQueue
|
|||||||
public function __construct(
|
public function __construct(
|
||||||
public Service $service,
|
public Service $service,
|
||||||
public ?string $defaultPassword = null,
|
public ?string $defaultPassword = null,
|
||||||
)
|
) {
|
||||||
{
|
|
||||||
//
|
//
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -27,7 +26,7 @@ class DeployService implements ShouldQueue
|
|||||||
{
|
{
|
||||||
$driver = $this->service->driver($this->defaultPassword);
|
$driver = $this->service->driver($this->defaultPassword);
|
||||||
$this->service->update([
|
$this->service->update([
|
||||||
'status' => ServiceStatus::INSTALLING
|
'status' => ServiceStatus::INSTALLING,
|
||||||
]);
|
]);
|
||||||
$this->deployment = $this->service->deployments()->create([
|
$this->deployment = $this->service->deployments()->create([
|
||||||
'status' => DeploymentStatus::PENDING,
|
'status' => DeploymentStatus::PENDING,
|
||||||
|
|||||||
@@ -7,7 +7,6 @@ use App\Enums\ServiceStatus;
|
|||||||
use App\Models\Step;
|
use App\Models\Step;
|
||||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||||
use Illuminate\Foundation\Queue\Queueable;
|
use Illuminate\Foundation\Queue\Queueable;
|
||||||
use Spatie\Ssh\Ssh;
|
|
||||||
|
|
||||||
class RunStep implements ShouldQueue
|
class RunStep implements ShouldQueue
|
||||||
{
|
{
|
||||||
@@ -15,8 +14,7 @@ class RunStep implements ShouldQueue
|
|||||||
|
|
||||||
public function __construct(
|
public function __construct(
|
||||||
protected Step $step,
|
protected Step $step,
|
||||||
)
|
) {
|
||||||
{
|
|
||||||
//
|
//
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -36,21 +36,21 @@ class FirewallRule extends Model
|
|||||||
|
|
||||||
public function command(bool $delete = false): string
|
public function command(bool $delete = false): string
|
||||||
{
|
{
|
||||||
$command = "ufw";
|
$command = 'ufw';
|
||||||
|
|
||||||
if ($delete) {
|
if ($delete) {
|
||||||
$command .= " delete";
|
$command .= ' delete';
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this->type === 'allow') {
|
if ($this->type === 'allow') {
|
||||||
$command .= " allow";
|
$command .= ' allow';
|
||||||
} elseif ($this->type === 'deny') {
|
} elseif ($this->type === 'deny') {
|
||||||
$command .= " deny";
|
$command .= ' deny';
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this->from) {
|
if ($this->from) {
|
||||||
$command .= " from {$this->from}";
|
$command .= " from {$this->from}";
|
||||||
$command .= " to any port";
|
$command .= ' to any port';
|
||||||
}
|
}
|
||||||
|
|
||||||
$command .= " {$this->ports}";
|
$command .= " {$this->ports}";
|
||||||
|
|||||||
@@ -47,6 +47,7 @@ class Organisation extends Model
|
|||||||
while (Organisation::where('slug', $slug)->exists()) {
|
while (Organisation::where('slug', $slug)->exists()) {
|
||||||
$slug = Str::slug($name).'-'.$count++;
|
$slug = Str::slug($name).'-'.$count++;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $slug;
|
return $slug;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -41,12 +41,12 @@ class Service extends Model
|
|||||||
|
|
||||||
public function driver(
|
public function driver(
|
||||||
?string $defaultPassword = null,
|
?string $defaultPassword = null,
|
||||||
): Driver
|
): Driver {
|
||||||
{
|
|
||||||
$class = config("keystone.drivers.{$this->driver_name}");
|
$class = config("keystone.drivers.{$this->driver_name}");
|
||||||
if (! class_exists($class)) {
|
if (! class_exists($class)) {
|
||||||
throw new \Exception("Driver class {$class} not found");
|
throw new \Exception("Driver class {$class} not found");
|
||||||
}
|
}
|
||||||
|
|
||||||
return new $class($this->container_name, $this->container_id, defaultPassword: $defaultPassword);
|
return new $class($this->container_name, $this->container_id, defaultPassword: $defaultPassword);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ return [
|
|||||||
'drivers' => [
|
'drivers' => [
|
||||||
'postgres' => [
|
'postgres' => [
|
||||||
'17' => Postgres17Driver::class,
|
'17' => Postgres17Driver::class,
|
||||||
]
|
],
|
||||||
],
|
],
|
||||||
'internal_ip_base' => env('INTERNAL_IP_BASE', '192.168.2.'),
|
'internal_ip_base' => env('INTERNAL_IP_BASE', '192.168.2.'),
|
||||||
];
|
];
|
||||||
@@ -37,6 +37,6 @@ return [
|
|||||||
|
|
||||||
'hetzner' => [
|
'hetzner' => [
|
||||||
'key' => env('HETZNER_KEY'),
|
'key' => env('HETZNER_KEY'),
|
||||||
]
|
],
|
||||||
|
|
||||||
];
|
];
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ class OrganisationFactory extends Factory
|
|||||||
{
|
{
|
||||||
$name = $this->faker->company();
|
$name = $this->faker->company();
|
||||||
$owner = User::inRandomOrder()->first() ?: User::factory()->create();
|
$owner = User::inRandomOrder()->first() ?: User::factory()->create();
|
||||||
|
|
||||||
return [
|
return [
|
||||||
'name' => $this->faker->company(),
|
'name' => $this->faker->company(),
|
||||||
'slug' => Organisation::createUniqueSlug($name),
|
'slug' => Organisation::createUniqueSlug($name),
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ class DatabaseSeeder extends Seeder
|
|||||||
'name' => 'Dev',
|
'name' => 'Dev',
|
||||||
'branch' => 'main',
|
'branch' => 'main',
|
||||||
'url' => 'https://dev.clipbin.hjb.dev',
|
'url' => 'https://dev.clipbin.hjb.dev',
|
||||||
'status' => 'active'
|
'status' => 'active',
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -91,6 +91,7 @@ Route::post('/provision-callback', function (Request $request) {
|
|||||||
logger(' server ipv6: '.$server->ipv6);
|
logger(' server ipv6: '.$server->ipv6);
|
||||||
logger(' callback ip: '.$request->ip());
|
logger(' callback ip: '.$request->ip());
|
||||||
logger(' server id: '.$server->id);
|
logger(' server id: '.$server->id);
|
||||||
|
|
||||||
return response('Unauthorized', 401);
|
return response('Unauthorized', 401);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -5,8 +5,6 @@ use App\Data\ServerProviders\CreatedServer;
|
|||||||
use App\Models\Organisation;
|
use App\Models\Organisation;
|
||||||
use App\Models\Server;
|
use App\Models\Server;
|
||||||
use App\Models\User;
|
use App\Models\User;
|
||||||
use Illuminate\Support\Facades\Cache;
|
|
||||||
use Illuminate\Support\Facades\Session;
|
|
||||||
use Illuminate\Support\Str;
|
use Illuminate\Support\Str;
|
||||||
use Inertia\Testing\AssertableInertia;
|
use Inertia\Testing\AssertableInertia;
|
||||||
|
|
||||||
@@ -95,7 +93,7 @@ test('show route displays a single server', function () {
|
|||||||
|
|
||||||
$response = $this->get(route('servers.show', [
|
$response = $this->get(route('servers.show', [
|
||||||
'organisation' => $organisation->id,
|
'organisation' => $organisation->id,
|
||||||
'server' => $server->id
|
'server' => $server->id,
|
||||||
]));
|
]));
|
||||||
|
|
||||||
$response->assertStatus(200);
|
$response->assertStatus(200);
|
||||||
|
|||||||
Reference in New Issue
Block a user