fix: services
This commit is contained in:
parent
fe8a7fc54f
commit
d609fcaee1
@ -7,6 +7,8 @@
|
|||||||
use Illuminate\Http\Client\Pool;
|
use Illuminate\Http\Client\Pool;
|
||||||
use Illuminate\Support\Facades\Http;
|
use Illuminate\Support\Facades\Http;
|
||||||
|
|
||||||
|
use function Laravel\Prompts\confirm;
|
||||||
|
|
||||||
class SyncBunny extends Command
|
class SyncBunny extends Command
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
@ -14,7 +16,7 @@ class SyncBunny extends Command
|
|||||||
*
|
*
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
protected $signature = 'sync:bunny';
|
protected $signature = 'sync:bunny {--only-template}';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The console command description.
|
* The console command description.
|
||||||
@ -28,6 +30,7 @@ class SyncBunny extends Command
|
|||||||
*/
|
*/
|
||||||
public function handle()
|
public function handle()
|
||||||
{
|
{
|
||||||
|
$only_template = $this->option('only-template');
|
||||||
$bunny_cdn = "https://cdn.coollabs.io";
|
$bunny_cdn = "https://cdn.coollabs.io";
|
||||||
$bunny_cdn_path = "coolify";
|
$bunny_cdn_path = "coolify";
|
||||||
$bunny_cdn_storage_name = "coolcdn";
|
$bunny_cdn_storage_name = "coolcdn";
|
||||||
@ -39,6 +42,7 @@ public function handle()
|
|||||||
$install_script = "install.sh";
|
$install_script = "install.sh";
|
||||||
$upgrade_script = "upgrade.sh";
|
$upgrade_script = "upgrade.sh";
|
||||||
$production_env = ".env.production";
|
$production_env = ".env.production";
|
||||||
|
$service_template = "service-templates.json";
|
||||||
|
|
||||||
$versions = "versions.json";
|
$versions = "versions.json";
|
||||||
|
|
||||||
@ -64,6 +68,19 @@ public function handle()
|
|||||||
]);
|
]);
|
||||||
});
|
});
|
||||||
try {
|
try {
|
||||||
|
$confirmed = confirm('Are you sure?');
|
||||||
|
if (!$confirmed) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if ($only_template) {
|
||||||
|
Http::pool(fn (Pool $pool) => [
|
||||||
|
$pool->storage(file: "$parent_dir/templates/$service_template")->put("/$bunny_cdn_storage_name/$bunny_cdn_path/$service_template"),
|
||||||
|
$pool->purge("$bunny_cdn/$bunny_cdn_path/$service_template"),
|
||||||
|
]);
|
||||||
|
$this->info('Service template uploaded & purged...');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
Http::pool(fn (Pool $pool) => [
|
Http::pool(fn (Pool $pool) => [
|
||||||
$pool->storage(file: "$parent_dir/$compose_file")->put("/$bunny_cdn_storage_name/$bunny_cdn_path/$compose_file"),
|
$pool->storage(file: "$parent_dir/$compose_file")->put("/$bunny_cdn_storage_name/$bunny_cdn_path/$compose_file"),
|
||||||
$pool->storage(file: "$parent_dir/$compose_file_prod")->put("/$bunny_cdn_storage_name/$bunny_cdn_path/$compose_file_prod"),
|
$pool->storage(file: "$parent_dir/$compose_file_prod")->put("/$bunny_cdn_storage_name/$bunny_cdn_path/$compose_file_prod"),
|
||||||
@ -72,7 +89,7 @@ public function handle()
|
|||||||
$pool->storage(file: "$parent_dir/scripts/$install_script")->put("/$bunny_cdn_storage_name/$bunny_cdn_path/$install_script"),
|
$pool->storage(file: "$parent_dir/scripts/$install_script")->put("/$bunny_cdn_storage_name/$bunny_cdn_path/$install_script"),
|
||||||
$pool->storage(file: "$parent_dir/$versions")->put("/$bunny_cdn_storage_name/$bunny_cdn_path/$versions"),
|
$pool->storage(file: "$parent_dir/$versions")->put("/$bunny_cdn_storage_name/$bunny_cdn_path/$versions"),
|
||||||
]);
|
]);
|
||||||
ray("{$bunny_cdn}/{$bunny_cdn_path}");
|
$this->info("{$bunny_cdn}/{$bunny_cdn_path}");
|
||||||
Http::pool(fn (Pool $pool) => [
|
Http::pool(fn (Pool $pool) => [
|
||||||
$pool->purge("$bunny_cdn/$bunny_cdn_path/$compose_file"),
|
$pool->purge("$bunny_cdn/$bunny_cdn_path/$compose_file"),
|
||||||
$pool->purge("$bunny_cdn/$bunny_cdn_path/$compose_file_prod"),
|
$pool->purge("$bunny_cdn/$bunny_cdn_path/$compose_file_prod"),
|
||||||
@ -81,9 +98,9 @@ public function handle()
|
|||||||
$pool->purge("$bunny_cdn/$bunny_cdn_path/$install_script"),
|
$pool->purge("$bunny_cdn/$bunny_cdn_path/$install_script"),
|
||||||
$pool->purge("$bunny_cdn/$bunny_cdn_path/$versions"),
|
$pool->purge("$bunny_cdn/$bunny_cdn_path/$versions"),
|
||||||
]);
|
]);
|
||||||
echo "All files uploaded & purged...\n";
|
$this->info("All files uploaded & purged...");
|
||||||
} catch (\Throwable $e) {
|
} catch (\Throwable $e) {
|
||||||
echo $e->getMessage();
|
$this->error("Error: " . $e->getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -23,6 +23,7 @@ class Select extends Component
|
|||||||
public array $parameters;
|
public array $parameters;
|
||||||
public Collection|array $services = [];
|
public Collection|array $services = [];
|
||||||
public bool $loadingServices = true;
|
public bool $loadingServices = true;
|
||||||
|
public bool $loading = false;
|
||||||
|
|
||||||
public ?string $existingPostgresqlUrl = null;
|
public ?string $existingPostgresqlUrl = null;
|
||||||
|
|
||||||
@ -61,19 +62,19 @@ public function loadServices(bool $forceReload = false)
|
|||||||
}
|
}
|
||||||
if (isDev()) {
|
if (isDev()) {
|
||||||
$cached = Cache::remember('services', 3600, function () {
|
$cached = Cache::remember('services', 3600, function () {
|
||||||
$services = File::get(base_path('examples/service-templates.json'));
|
$services = File::get(base_path('templates/service-templates.json'));
|
||||||
$services = collect(json_decode($services));
|
$services = collect(json_decode($services))->sortKeys();
|
||||||
$this->emit('success', 'Successfully reloaded services from filesystem (development mode).');
|
$this->emit('success', 'Successfully reloaded services from filesystem (development mode).');
|
||||||
return $services;
|
return $services;
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
$cached = Cache::remember('services', 3600, function () {
|
$cached = Cache::remember('services', 3600, function () {
|
||||||
$services = Http::get(config('constants.services.offical'));
|
$services = Http::get(config('constants.services.official'));
|
||||||
if ($services->failed()) {
|
if ($services->failed()) {
|
||||||
throw new \Exception($services->body());
|
throw new \Exception($services->body());
|
||||||
}
|
}
|
||||||
|
|
||||||
$services = collect($services->json());
|
$services = collect($services->json())->sortKeys();
|
||||||
$this->emit('success', 'Successfully reloaded services from the internet.');
|
$this->emit('success', 'Successfully reloaded services from the internet.');
|
||||||
return $services;
|
return $services;
|
||||||
});
|
});
|
||||||
@ -89,6 +90,8 @@ public function loadServices(bool $forceReload = false)
|
|||||||
public function setType(string $type)
|
public function setType(string $type)
|
||||||
{
|
{
|
||||||
$this->type = $type;
|
$this->type = $type;
|
||||||
|
if ($this->loading) return;
|
||||||
|
$this->loading = true;
|
||||||
if ($type === "existing-postgresql") {
|
if ($type === "existing-postgresql") {
|
||||||
$this->current_step = $type;
|
$this->current_step = $type;
|
||||||
return;
|
return;
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
],
|
],
|
||||||
],
|
],
|
||||||
'services' => [
|
'services' => [
|
||||||
'offical' => 'https://cdn.coollabs.io/coolify/service-templates.json',
|
'official' => 'https://cdn.coollabs.io/coolify/service-templates.json',
|
||||||
],
|
],
|
||||||
'limits' => [
|
'limits' => [
|
||||||
'trial_period'=> 7,
|
'trial_period'=> 7,
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
<div class="grid justify-start grid-cols-1 gap-2 text-left xl:grid-cols-3">
|
<div class="grid justify-start grid-cols-1 gap-2 text-left xl:grid-cols-3">
|
||||||
<div class="box group" wire:click="setType('public')">
|
<div class="box group" wire:click="setType('public')">
|
||||||
<div class="flex flex-col mx-6">
|
<div class="flex flex-col mx-6">
|
||||||
<div class="group-hover:text-white">
|
<div class="text-xl font-bold text-white group-hover:text-white">
|
||||||
Public Repository
|
Public Repository
|
||||||
</div>
|
</div>
|
||||||
<div class="text-xs group-hover:text-white">
|
<div class="text-xs group-hover:text-white">
|
||||||
@ -22,7 +22,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="box group" wire:click="setType('private-gh-app')">
|
<div class="box group" wire:click="setType('private-gh-app')">
|
||||||
<div class="flex flex-col mx-6">
|
<div class="flex flex-col mx-6">
|
||||||
<div class="group-hover:text-white">
|
<div class="text-xl font-bold text-white group-hover:text-white">
|
||||||
Private Repository
|
Private Repository
|
||||||
</div>
|
</div>
|
||||||
<div class="text-xs group-hover:text-white">
|
<div class="text-xs group-hover:text-white">
|
||||||
@ -32,7 +32,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="box group" wire:click="setType('private-deploy-key')">
|
<div class="box group" wire:click="setType('private-deploy-key')">
|
||||||
<div class="flex flex-col mx-6">
|
<div class="flex flex-col mx-6">
|
||||||
<div class="group-hover:text-white">
|
<div class="text-xl font-bold text-white group-hover:text-white">
|
||||||
Private Repository (with deploy key)
|
Private Repository (with deploy key)
|
||||||
</div>
|
</div>
|
||||||
<div class="text-xs group-hover:text-white">
|
<div class="text-xs group-hover:text-white">
|
||||||
@ -44,7 +44,7 @@
|
|||||||
<div class="grid justify-start grid-cols-1 gap-2 text-left xl:grid-cols-3">
|
<div class="grid justify-start grid-cols-1 gap-2 text-left xl:grid-cols-3">
|
||||||
<div class="box group" wire:click="setType('dockerfile')">
|
<div class="box group" wire:click="setType('dockerfile')">
|
||||||
<div class="flex flex-col mx-6">
|
<div class="flex flex-col mx-6">
|
||||||
<div class="group-hover:text-white">
|
<div class="text-xl font-bold text-white group-hover:text-white">
|
||||||
Based on a Dockerfile
|
Based on a Dockerfile
|
||||||
</div>
|
</div>
|
||||||
<div class="text-xs group-hover:text-white">
|
<div class="text-xs group-hover:text-white">
|
||||||
@ -54,7 +54,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="box group" wire:click="setType('docker-compose-empty')">
|
<div class="box group" wire:click="setType('docker-compose-empty')">
|
||||||
<div class="flex flex-col mx-6">
|
<div class="flex flex-col mx-6">
|
||||||
<div class="group-hover:text-white">
|
<div class="text-xl font-bold text-white group-hover:text-white">
|
||||||
Based on a Docker Compose
|
Based on a Docker Compose
|
||||||
</div>
|
</div>
|
||||||
<div class="text-xs group-hover:text-white">
|
<div class="text-xs group-hover:text-white">
|
||||||
@ -67,7 +67,7 @@
|
|||||||
<div class="grid justify-start grid-cols-1 gap-2 text-left xl:grid-cols-3">
|
<div class="grid justify-start grid-cols-1 gap-2 text-left xl:grid-cols-3">
|
||||||
<div class="box group" wire:click="setType('postgresql')">
|
<div class="box group" wire:click="setType('postgresql')">
|
||||||
<div class="flex flex-col mx-6">
|
<div class="flex flex-col mx-6">
|
||||||
<div class="group-hover:text-white">
|
<div class="text-xl font-bold text-white group-hover:text-white">
|
||||||
New PostgreSQL
|
New PostgreSQL
|
||||||
</div>
|
</div>
|
||||||
<div class="text-xs group-hover:text-white">
|
<div class="text-xs group-hover:text-white">
|
||||||
@ -88,26 +88,28 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="flex items-center gap-2">
|
<div class="flex items-center gap-2">
|
||||||
<h2 class="py-4">Services</h2>
|
<h2 class="py-4">Services</h2>
|
||||||
<x-forms.button wire:click='loadServices(true)'>Reload Services from Templates</x-forms.button>
|
<x-forms.button wire:click='loadServices(true)'>Reload Services List</x-forms.button>
|
||||||
</div>
|
</div>
|
||||||
<div class="grid justify-start grid-cols-1 gap-2 text-left xl:grid-cols-3">
|
<div class="grid justify-start grid-cols-1 gap-2 text-left xl:grid-cols-3">
|
||||||
@if ($loadingServices)
|
@if ($loadingServices)
|
||||||
<span class="loading loading-xs loading-spinner"></span>
|
<span class="loading loading-xs loading-spinner"></span>
|
||||||
@else
|
@else
|
||||||
@foreach ($services as $serviceName => $service)
|
@foreach ($services as $serviceName => $service)
|
||||||
<div class="box group" wire:click="setType('one-click-service-{{ $serviceName }}')">
|
<button class="text-left box group"
|
||||||
|
wire:loading.attr="disabled" wire:click="setType('one-click-service-{{ $serviceName }}')">
|
||||||
<div class="flex flex-col mx-6">
|
<div class="flex flex-col mx-6">
|
||||||
<div class="group-hover:text-white">
|
<div class="text-xl font-bold text-white group-hover:text-white">
|
||||||
{{ Str::headline($serviceName) }}
|
{{ Str::headline($serviceName) }}
|
||||||
</div>
|
</div>
|
||||||
<div class="text-xs group-hover:text-white">
|
@if (data_get($service, 'slogan'))
|
||||||
|
<div class="text-xs">
|
||||||
</div>
|
{{ data_get($service, 'slogan') }}
|
||||||
|
</div>
|
||||||
|
@endif
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</button>
|
||||||
@endforeach
|
@endforeach
|
||||||
@endif
|
@endif
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
@endif
|
@endif
|
||||||
@if ($current_step === 'servers')
|
@if ($current_step === 'servers')
|
||||||
|
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue
Block a user