mirror of
https://github.com/coollabsio/coolify.git
synced 2026-10-08 23:15:59 -04:00
Merge scripts/dev-instances into scripts/dev. Each branch gets its own Compose project, container, volumes, port block, libvirt network, and KVM VMs, so stop and start reuse the same data and worktrees do not collide. - Name instances after the branch; keep slots and APP_KEYs in the main checkout's .dev-instances/ so they survive worktree removal - Reuse existing QEMU VMs instead of recreating them; add dev:qemu --fresh - Give each instance an isolated libvirt network (10.221.<slot>.0/24) and VM names coolify-dev-<branch>--<profile> - Publish per-instance browser ports and publish them with tailscale serve when APP_URL is a tailnet host - Add urls, exec, logs, container, destroy, and teardown commands; run teardown from jean.json before Jean deletes a worktree - Fix Reverb/terminal browser ports and the testing-host alias in the instance compose file - Keep fresh worktree instances working: pre-create laravel.log, log the host dev:qemu call to stderr, and stop Vite from watching vendor/ Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
47 lines
1.6 KiB
PHP
47 lines
1.6 KiB
PHP
<?php
|
|
|
|
namespace App\Console\Commands;
|
|
|
|
use App\Actions\Development\ManageDevelopmentQemuVm;
|
|
use Illuminate\Console\Command;
|
|
|
|
use function Laravel\Prompts\multiselect;
|
|
|
|
class ManageDevelopmentQemuVmCommand extends Command
|
|
{
|
|
protected $signature = 'dev:qemu {profiles?* : Profile keys from config/development-qemu.php} {--as-localhost : Use the VM for the localhost server (id 0)} {--fresh : Destroy and recreate the selected VMs instead of reusing them}';
|
|
|
|
protected $description = 'Start (or create) selected development QEMU VMs and seed their Coolify servers';
|
|
|
|
public function handle(): int
|
|
{
|
|
if (! isDev()) {
|
|
$this->error('This command may only run in development mode.');
|
|
|
|
return self::FAILURE;
|
|
}
|
|
|
|
$profiles = config('development-qemu.profiles');
|
|
$profileNames = $this->argument('profiles') ?: multiselect(
|
|
label: 'Which QEMU servers should be started and seeded?',
|
|
options: collect($profiles)->mapWithKeys(fn (array $profile, string $key) => [$key => $profile['label']])->all(),
|
|
required: true,
|
|
);
|
|
|
|
if ($this->option('as-localhost') && count($profileNames) !== 1) {
|
|
$this->error('Select exactly one QEMU profile for localhost.');
|
|
|
|
return self::FAILURE;
|
|
}
|
|
|
|
ManageDevelopmentQemuVm::run($profileNames, (bool) $this->option('as-localhost'), (bool) $this->option('fresh'));
|
|
|
|
foreach ($profileNames as $profileName) {
|
|
$profile = $profiles[$profileName];
|
|
$this->info("Started and seeded {$profile['label']} at {$profile['ip']}.");
|
|
}
|
|
|
|
return self::SUCCESS;
|
|
}
|
|
}
|