fix confs etc

This commit is contained in:
Andras Bacsai
2024-12-10 10:46:05 +01:00
parent 854fd3eab2
commit 3893754a10
15 changed files with 99 additions and 28 deletions

View File

@@ -13,7 +13,7 @@ class Horizon extends Command
public function handle() public function handle()
{ {
if (config('constants.horizon.is_horizon_enabled')) { if (config('constants.horizon.is_horizon_enabled')) {
$this->info('[x]: Horizon is enabled. Starting.'); $this->info('Horizon is enabled on this server.');
$this->call('horizon'); $this->call('horizon');
exit(0); exit(0);
} else { } else {

View File

@@ -55,10 +55,8 @@ class Init extends Command
} else { } else {
$this->cleanup_in_progress_application_deployments(); $this->cleanup_in_progress_application_deployments();
} }
echo "[3]: Cleanup Redis keys.\n";
$this->call('cleanup:redis'); $this->call('cleanup:redis');
echo "[4]: Cleanup stucked resources.\n";
$this->call('cleanup:stucked-resources'); $this->call('cleanup:stucked-resources');
try { try {
@@ -114,7 +112,6 @@ class Init extends Command
private function optimize() private function optimize()
{ {
echo "[1]: Optimizing Laravel (caching config, routes, views).\n";
Artisan::call('optimize:clear'); Artisan::call('optimize:clear');
Artisan::call('optimize'); Artisan::call('optimize');
} }
@@ -189,7 +186,6 @@ class Init extends Command
} }
} }
if ($commands->isNotEmpty()) { if ($commands->isNotEmpty()) {
echo "Cleaning up unused networks from coolify proxy\n";
remote_process(command: $commands, type: ActivityTypes::INLINE->value, server: $server, ignore_errors: false); remote_process(command: $commands, type: ActivityTypes::INLINE->value, server: $server, ignore_errors: false);
} }
} catch (\Throwable $e) { } catch (\Throwable $e) {
@@ -232,15 +228,14 @@ class Init extends Command
$settings = instanceSettings(); $settings = instanceSettings();
$do_not_track = data_get($settings, 'do_not_track'); $do_not_track = data_get($settings, 'do_not_track');
if ($do_not_track == true) { if ($do_not_track == true) {
echo "[2]: Skipping sending live signal as do_not_track is enabled\n"; echo "Do_not_track is enabled\n";
return; return;
} }
try { try {
Http::get("https://undead.coolify.io/v4/alive?appId=$id&version=$version"); Http::get("https://undead.coolify.io/v4/alive?appId=$id&version=$version");
echo "[2]: Sending live signal!\n";
} catch (\Throwable $e) { } catch (\Throwable $e) {
echo "[2]: Error in sending live signal: {$e->getMessage()}\n"; echo "Error in sending live signal: {$e->getMessage()}\n";
} }
} }
@@ -253,7 +248,6 @@ class Init extends Command
} }
$queued_inprogress_deployments = ApplicationDeploymentQueue::whereIn('status', [ApplicationDeploymentStatus::IN_PROGRESS->value, ApplicationDeploymentStatus::QUEUED->value])->get(); $queued_inprogress_deployments = ApplicationDeploymentQueue::whereIn('status', [ApplicationDeploymentStatus::IN_PROGRESS->value, ApplicationDeploymentStatus::QUEUED->value])->get();
foreach ($queued_inprogress_deployments as $deployment) { foreach ($queued_inprogress_deployments as $deployment) {
echo "Cleaning up deployment: {$deployment->id}\n";
$deployment->status = ApplicationDeploymentStatus::FAILED->value; $deployment->status = ApplicationDeploymentStatus::FAILED->value;
$deployment->save(); $deployment->save();
} }

View File

@@ -13,7 +13,7 @@ class Scheduler extends Command
public function handle() public function handle()
{ {
if (config('constants.horizon.is_scheduler_enabled')) { if (config('constants.horizon.is_scheduler_enabled')) {
$this->info('[x]: Scheduler is enabled. Starting.'); $this->info('Scheduler is enabled on this server.');
$this->call('schedule:work'); $this->call('schedule:work');
exit(0); exit(0);
} else { } else {

View File

@@ -22,9 +22,9 @@ class ProductionSeeder extends Seeder
public function run(): void public function run(): void
{ {
if (isCloud()) { if (isCloud()) {
echo "[x]: Running in cloud mode.\n"; echo " Running in cloud mode.\n";
} else { } else {
echo "[x]: Running in self-hosted mode.\n"; echo " Running in self-hosted mode.\n";
} }
// Fix for 4.0.0-beta.37 // Fix for 4.0.0-beta.37

View File

@@ -1,5 +1,12 @@
#!/command/execlineb -P #!/command/execlineb -P
# Use with-contenv to ensure environment variables are available
with-contenv
cd /var/www/html
foreground { foreground {
s6-sleep 5 php
php /var/www/html/artisan start:horizon artisan
start:horizon
} }

View File

@@ -1,5 +1,22 @@
#!/command/execlineb -P #!/command/execlineb -P
foreground { composer -d /var/www/html/ install }
foreground { php /var/www/html/artisan migrate --step } # Use with-contenv to ensure environment variables are available
foreground { php /var/www/html/artisan dev --init } with-contenv
cd /var/www/html
foreground {
composer
install
}
foreground {
php
artisan
migrate
--step
}
foreground {
php
artisan
dev
--init
}

View File

@@ -1,5 +1,13 @@
#!/command/execlineb -P #!/command/execlineb -P
# Use with-contenv to ensure environment variables are available
with-contenv
cd /var/www/html
foreground { foreground {
s6-sleep 5 php
php /var/www/html/artisan start:scheduler artisan
start:scheduler
} }

View File

@@ -1,6 +1,6 @@
error_reporting = E_ALL & ~E_DEPRECATED & ~E_STRICT & ~E_NOTICE error_reporting = E_ERROR
error_log = /var/www/html/storage/logs/php-error.log error_log = /var/www/html/storage/logs/php-error.log
log_errors = On log_errors = Off
log_errors_max_len = 8192 log_errors_max_len = 8192
ignore_repeated_errors = On ignore_repeated_errors = On
ignore_repeated_source = On ignore_repeated_source = On

View File

@@ -1,2 +1,13 @@
#!/command/execlineb -P #!/command/execlineb -P
php /var/www/html/artisan migrate --force --isolated
# Use with-contenv to ensure environment variables are available
with-contenv
cd /var/www/html
foreground {
php
artisan
migrate
--force
--isolated
}

View File

@@ -1,5 +1,11 @@
#!/command/execlineb -P #!/command/execlineb -P
# Use with-contenv to ensure environment variables are available
with-contenv
cd /var/www/html
foreground { foreground {
s6-sleep 5 php
php /var/www/html/artisan start:horizon artisan
start:horizon
} }

View File

@@ -1,2 +1,12 @@
#!/command/execlineb -P #!/command/execlineb -P
php /var/www/html/artisan app:init
# Use with-contenv to ensure environment variables are available
with-contenv
cd /var/www/html
foreground {
php
artisan
app:init
}

View File

@@ -1,2 +1,15 @@
#!/command/execlineb -P #!/command/execlineb -P
php /var/www/html/artisan db:seed --class ProductionSeeder --force
# Use with-contenv to ensure environment variables are available
with-contenv
cd /var/www/html
foreground {
php
artisan
db:seed
--class
ProductionSeeder
--force
}

View File

@@ -1,5 +1,10 @@
#!/command/execlineb -P #!/command/execlineb -P
# Use with-contenv to ensure environment variables are available
with-contenv
cd /var/www/html
foreground { foreground {
s6-sleep 5 php
php /var/www/html/artisan start:scheduler artisan
start:scheduler
} }