fix
This commit is contained in:
parent
8e819485e4
commit
8677b1d85d
@ -21,3 +21,5 @@ DB_PASSWORD=
|
||||
QUEUE_CONNECTION=redis
|
||||
REDIS_HOST=coolify-redis
|
||||
REDIS_PASSWORD=
|
||||
|
||||
CACHE_DRIVER=redis
|
||||
|
@ -16,6 +16,8 @@ class Kernel extends ConsoleKernel
|
||||
*/
|
||||
protected function schedule(Schedule $schedule): void
|
||||
{
|
||||
$schedule->command('horizon:snapshot')->everyFiveMinutes();
|
||||
|
||||
$schedule->job(new DockerCleanupDanglingImagesJob)->everyFiveMinutes();
|
||||
$schedule->job(new AutoUpdateJob)->everyFifteenMinutes();
|
||||
$schedule->job(new ProxyCheckJob)->everyMinute();
|
||||
|
@ -27,7 +27,7 @@ public function mount()
|
||||
$this->parameters = getParameters();
|
||||
$this->application = Application::where('id', $this->applicationId)->first();
|
||||
$this->destination = $this->application->destination->getMorphClass()::where('id', $this->application->destination->id)->first();
|
||||
dispatch(new ContainerStatusJob($this->application->uuid));
|
||||
// dispatch(new ContainerStatusJob($this->application->uuid));
|
||||
}
|
||||
protected function setDeploymentUuid()
|
||||
{
|
||||
|
@ -5,6 +5,7 @@
|
||||
use App\Actions\CoolifyTask\RunRemoteProcess;
|
||||
use App\Data\CoolifyTaskArgs;
|
||||
use App\Enums\ActivityTypes;
|
||||
use App\Enums\ProcessStatus;
|
||||
use App\Models\Application;
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
@ -18,12 +19,13 @@
|
||||
use Illuminate\Support\Str;
|
||||
use Spatie\Url\Url;
|
||||
use Illuminate\Queue\Middleware\WithoutOverlapping;
|
||||
use Throwable;
|
||||
|
||||
class DeployApplicationJob implements ShouldQueue
|
||||
{
|
||||
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
|
||||
|
||||
protected $application;
|
||||
protected Application $application;
|
||||
protected $destination;
|
||||
protected $source;
|
||||
protected Activity $activity;
|
||||
@ -34,15 +36,13 @@ class DeployApplicationJob implements ShouldQueue
|
||||
protected $env_args;
|
||||
public static int $batch_counter = 0;
|
||||
public $timeout = 3600;
|
||||
public $tries = 60;
|
||||
|
||||
public function middleware(): array
|
||||
{
|
||||
return [new WithoutOverlapping($this->application_uuid)];
|
||||
}
|
||||
public function uniqueId(): string
|
||||
{
|
||||
return $this->application_uuid;
|
||||
return [(new WithoutOverlapping($this->application->uuid))->releaseAfter(10)];
|
||||
}
|
||||
|
||||
public function __construct(
|
||||
public string $deployment_uuid,
|
||||
public string $application_uuid,
|
||||
@ -223,10 +223,26 @@ public function handle(): void
|
||||
Storage::disk('deployments')->put(Str::kebab($this->application->name) . '/docker-compose.yml', $this->docker_compose);
|
||||
}
|
||||
$this->executeNow(["docker rm -f {$this->deployment_uuid} >/dev/null 2>&1"], hideFromOutput: true);
|
||||
dispatch(new ContainerStatusJob($this->application_uuid));
|
||||
// dispatch(new ContainerStatusJob($this->application_uuid));
|
||||
}
|
||||
}
|
||||
|
||||
public function failed(Throwable $exception): void
|
||||
{
|
||||
$outputStack[] = [
|
||||
'type' => 'out',
|
||||
'output' => $exception->getMessage(),
|
||||
'timestamp' => hrtime(true),
|
||||
'batch' => DeployApplicationJob::$batch_counter,
|
||||
'order' => 0,
|
||||
];
|
||||
$this->activity->description = json_encode($outputStack);
|
||||
$this->activity->properties = $this->activity->properties->merge([
|
||||
'exitCode' => 0,
|
||||
'status' => ProcessStatus::ERROR->value,
|
||||
]);
|
||||
$this->activity->save();
|
||||
$this->fail($exception);
|
||||
}
|
||||
private function execute_in_builder(string $command)
|
||||
{
|
||||
return "docker exec {$this->deployment_uuid} bash -c '{$command}'";
|
||||
|
@ -14,7 +14,7 @@
|
||||
class DockerCleanupDanglingImagesJob implements ShouldQueue
|
||||
{
|
||||
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
|
||||
|
||||
public $timeout = 500;
|
||||
/**
|
||||
* Create a new job instance.
|
||||
*/
|
||||
|
@ -115,7 +115,7 @@ function generateSshCommand(string $private_key_location, string $server_ip, str
|
||||
. '-o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null '
|
||||
. '-o PasswordAuthentication=no '
|
||||
. '-o ConnectTimeout=3600 '
|
||||
. '-o ServerAliveInterval=60 '
|
||||
. '-o ServerAliveInterval=20 '
|
||||
. '-o RequestTTY=no '
|
||||
. '-o LogLevel=ERROR '
|
||||
. "-p {$port} "
|
||||
|
@ -180,7 +180,7 @@
|
||||
*/
|
||||
|
||||
'defaults' => [
|
||||
'supervisor-1' => [
|
||||
's6' => [
|
||||
'connection' => 'redis',
|
||||
'queue' => ['default'],
|
||||
'balance' => 'auto',
|
||||
@ -190,25 +190,27 @@
|
||||
'maxJobs' => 0,
|
||||
'memory' => 128,
|
||||
'tries' => 1,
|
||||
'timeout' => 600,
|
||||
'timeout' => 3600,
|
||||
'nice' => 0,
|
||||
],
|
||||
],
|
||||
|
||||
'environments' => [
|
||||
'production' => [
|
||||
'supervisor-1' => [
|
||||
's6' => [
|
||||
'autoScalingStrategy' => 'size',
|
||||
'maxProcesses' => env('HORIZON_MAX_PROCESSES', 10),
|
||||
'balanceMaxShift' => env('HORIZON_BALANCE_MAX_SHIFT', 1),
|
||||
'balanceCooldown' => env('HORIZON_BALANCE_COOLDOWN', 3),
|
||||
'balanceCooldown' => env('HORIZON_BALANCE_COOLDOWN', 1),
|
||||
],
|
||||
],
|
||||
|
||||
'local' => [
|
||||
'supervisor-1' => [
|
||||
's6' => [
|
||||
'autoScalingStrategy' => 'size',
|
||||
'maxProcesses' => env('HORIZON_MAX_PROCESSES', 10),
|
||||
'balanceMaxShift' => env('HORIZON_BALANCE_MAX_SHIFT', 1),
|
||||
'balanceCooldown' => env('HORIZON_BALANCE_COOLDOWN', 3),
|
||||
'balanceCooldown' => env('HORIZON_BALANCE_COOLDOWN', 1),
|
||||
],
|
||||
],
|
||||
],
|
||||
|
@ -1,2 +1,2 @@
|
||||
#!/command/execlineb -P
|
||||
su - webuser -c "php /var/www/html/artisan queue:listen --timeout=600"
|
||||
su - webuser -c "php /var/www/html/artisan queue:listen"
|
||||
|
@ -1,9 +1,10 @@
|
||||
<a @class([
|
||||
'bg-coolgray-200 p-2 border-l border-dashed border-transparent transition-colors hover:no-underline',
|
||||
'bg-coolgray-200 p-2 border-l border-dashed transition-colors hover:no-underline',
|
||||
'border-warning hover:bg-warning hover:text-black' =>
|
||||
$status == 'in_progress' || $status == 'queued',
|
||||
'border-error hover:bg-error' => $status == 'error',
|
||||
'border-success hover:bg-success' => $status == 'finished',
|
||||
$status === 'in_progress',
|
||||
'border-primary hover:bg-primary' => $status === 'queued',
|
||||
'border-error hover:bg-error' => $status === 'error',
|
||||
'border-success hover:bg-success' => $status === 'finished',
|
||||
]) @if ($status === 'in_progress' || $status === 'queued')
|
||||
wire:poll.5000ms='polling'
|
||||
@endif href="{{ url()->current() }}/{{ $deployment_uuid }}" class="hover:no-underline">
|
||||
|
@ -25,6 +25,9 @@ function sync-bunny {
|
||||
function queue {
|
||||
bash vendor/bin/spin exec -u webuser coolify php artisan queue:listen
|
||||
}
|
||||
function horizon {
|
||||
bash vendor/bin/spin exec -u webuser coolify php artisan horizon -vvv
|
||||
}
|
||||
function schedule {
|
||||
bash vendor/bin/spin exec -u webuser coolify php artisan schedule:work
|
||||
}
|
||||
|
2
storage/framework/cache/data/.gitignore
vendored
2
storage/framework/cache/data/.gitignore
vendored
@ -1,2 +0,0 @@
|
||||
*
|
||||
!.gitignore
|
Loading…
Reference in New Issue
Block a user