This commit is contained in:
Andras Bacsai
2023-05-24 15:25:08 +02:00
parent a0306f3951
commit 167379b0e0
23 changed files with 118 additions and 125 deletions

View File

@@ -60,7 +60,7 @@ class ApplicationDeploymentJob implements ShouldQueue
$server = $this->destination->server;
$private_key_location = savePrivateKeyForServer($server);
$private_key_location = save_private_key_for_server($server);
$remoteProcessArgs = new CoolifyTaskArgs(
server_ip: $server->ip,
@@ -452,13 +452,13 @@ COPY --from={$this->application->uuid}:{$this->git_commit}-build /app/{$this->ap
if ($isDebuggable && !$this->application->settings->is_debug) {
$hideFromOutput = true;
}
$remoteProcess = resolve(RunRemoteProcess::class, [
$remote_process = resolve(RunRemoteProcess::class, [
'activity' => $this->activity,
'hideFromOutput' => $hideFromOutput,
'isFinished' => $isFinished,
'ignoreErrors' => $ignoreErrors,
]);
$result = $remoteProcess();
$result = $remote_process();
if ($propertyName) {
$this->activity->properties = $this->activity->properties->merge([
$propertyName => trim($result->output()),

View File

@@ -47,7 +47,7 @@ class ContainerStatusJob implements ShouldQueue, ShouldBeUnique
$not_found_applications = $applications;
$containers = collect();
foreach ($servers as $server) {
$output = instantRemoteProcess(['docker ps -a -q --format \'{{json .}}\''], $server);
$output = instant_remote_process(['docker ps -a -q --format \'{{json .}}\''], $server);
$containers = $containers->concat(format_docker_command_output_to_json($output));
}
foreach ($containers as $container) {

View File

@@ -29,7 +29,7 @@ class ContainerStopJob implements ShouldQueue, ShouldBeUnique
{
try {
$application = Application::find($this->application_id)->first();
instantRemoteProcess(["docker rm -f {$application->uuid}"], $this->server);
instant_remote_process(["docker rm -f {$application->uuid}"], $this->server);
$application->status = get_container_status(server: $application->destination->server, container_id: $application->uuid);
$application->save();
} catch (\Exception $e) {

View File

@@ -19,18 +19,19 @@ class CoolifyTask implements ShouldQueue
*/
public function __construct(
public Activity $activity,
){}
) {
}
/**
* Execute the job.
*/
public function handle(): void
{
$remoteProcess = resolve(RunRemoteProcess::class, [
$remote_process = resolve(RunRemoteProcess::class, [
'activity' => $this->activity,
]);
$remoteProcess();
$remote_process();
// @TODO: Remove file at $this->activity->getExtraProperty('private_key_location') after process is finished
}
}

View File

@@ -46,10 +46,10 @@ class InstanceAutoUpdate implements ShouldQueue
if (!$server) {
return;
}
instantRemoteProcess([
instant_remote_process([
"sleep 2"
], $server);
remoteProcess([
remote_process([
"sleep 10"
], $server, ActivityTypes::INLINE->value);
} else {
@@ -68,18 +68,18 @@ class InstanceAutoUpdate implements ShouldQueue
return;
}
instantRemoteProcess([
instant_remote_process([
"curl -fsSL $cdn/docker-compose.yml -o /data/coolify/source/docker-compose.yml",
"curl -fsSL $cdn/docker-compose.prod.yml -o /data/coolify/source/docker-compose.prod.yml",
"curl -fsSL $cdn/.env.production -o /data/coolify/source/.env.production",
"curl -fsSL $cdn/upgrade.sh -o /data/coolify/source/upgrade.sh",
], $server);
instantRemoteProcess([
instant_remote_process([
"docker compose -f /data/coolify/source/docker-compose.yml -f /data/coolify/source/docker-compose.prod.yml pull",
], $server);
remoteProcess([
remote_process([
"bash /data/coolify/source/upgrade.sh $latest_version"
], $server, ActivityTypes::INLINE->value);
}

View File

@@ -31,7 +31,7 @@ class InstanceDockerCleanup implements ShouldQueue
try {
$servers = Server::all();
foreach ($servers as $server) {
instantRemoteProcess(['docker image prune -f'], $server);
instant_remote_process(['docker image prune -f'], $server);
}
} catch (\Exception $e) {
Log::error($e->getMessage());