forked from coollabsio/coolify
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: use local versions + service templates and query them every 10 m…
…inutes
- Loading branch information
1 parent
3237ca0
commit 10f3d8a
Showing
11 changed files
with
95 additions
and
1,149 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
<?php | ||
|
||
namespace App\Jobs; | ||
|
||
use App\Models\Server; | ||
use Illuminate\Bus\Queueable; | ||
use Illuminate\Contracts\Queue\ShouldBeEncrypted; | ||
use Illuminate\Contracts\Queue\ShouldQueue; | ||
use Illuminate\Foundation\Bus\Dispatchable; | ||
use Illuminate\Queue\InteractsWithQueue; | ||
use Illuminate\Queue\SerializesModels; | ||
use Illuminate\Support\Facades\File; | ||
use Illuminate\Support\Facades\Http; | ||
|
||
class PullTemplatesAndVersions implements ShouldQueue, ShouldBeEncrypted | ||
{ | ||
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels; | ||
|
||
public $timeout = 10; | ||
|
||
public function __construct() | ||
{ | ||
} | ||
public function handle(): void | ||
{ | ||
try { | ||
if (!isDev() && !isCloud()) { | ||
ray('PullTemplatesAndVersions versions.json'); | ||
$response = Http::retry(3, 1000)->get('https://cdn.coollabs.io/coolify/versions.json'); | ||
if ($response->successful()) { | ||
$versions = $response->json(); | ||
File::put(base_path('versions.json'), json_encode($versions, JSON_PRETTY_PRINT)); | ||
} else { | ||
send_internal_notification('PullTemplatesAndVersions failed with: ' . $response->status() . ' ' . $response->body()); | ||
} | ||
} | ||
} catch (\Throwable $e) { | ||
send_internal_notification('PullTemplatesAndVersions failed with: ' . $e->getMessage()); | ||
ray($e->getMessage()); | ||
} | ||
try { | ||
ray('PullTemplatesAndVersions service-templates'); | ||
$response = Http::retry(3, 1000)->get(config('constants.services.official')); | ||
if ($response->successful()) { | ||
$services = $response->json(); | ||
File::put(base_path('templates/service-templates.json'), json_encode($services)); | ||
} else { | ||
send_internal_notification('PullTemplatesAndVersions failed with: ' . $response->status() . ' ' . $response->body()); | ||
} | ||
} catch (\Throwable $e) { | ||
send_internal_notification('PullTemplatesAndVersions failed with: ' . $e->getMessage()); | ||
ray($e->getMessage()); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.