diff --git a/app/Actions/RemoteProcess/DispatchRemoteProcess.php b/app/Actions/RemoteProcess/DispatchRemoteProcess.php new file mode 100644 index 000000000..9c7cb20b2 --- /dev/null +++ b/app/Actions/RemoteProcess/DispatchRemoteProcess.php @@ -0,0 +1,29 @@ +activity = activity() + ->withProperties($remoteProcessArgs->toArray()) + ->log("Awaiting command to start...\n\n"); + } + + public function __invoke(): Activity + { + $job = new ExecuteRemoteProcess($this->activity); + + dispatch($job); + + $this->activity->refresh(); + + return $this->activity; + } +} diff --git a/app/Jobs/ExecuteCoolifyProcess.php b/app/Actions/RemoteProcess/RunRemoteProcess.php old mode 100755 new mode 100644 similarity index 70% rename from app/Jobs/ExecuteCoolifyProcess.php rename to app/Actions/RemoteProcess/RunRemoteProcess.php index 8dca3bc00..69dc35465 --- a/app/Jobs/ExecuteCoolifyProcess.php +++ b/app/Actions/RemoteProcess/RunRemoteProcess.php @@ -1,25 +1,17 @@ getExtraProperty('type') !== ActivityTypes::COOLIFY_PROCESS->value) { + throw new \RuntimeException('Incompatible Activity to run a remote command.'); + } - /** - * Execute the job. - */ - public function handle(): ProcessResult + $this->activity = $activity; + } + + public function __invoke(): ProcessResult { $this->timeStart = hrtime(true); - $user = $this->activity->getExtraProperty('user'); - $destination = $this->activity->getExtraProperty('destination'); - $port = $this->activity->getExtraProperty('port'); - $command = $this->activity->getExtraProperty('command'); - - $delimiter = 'EOF-COOLIFY-SSH'; - - $sshCommand = 'ssh ' - . '-o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null ' - . '-o PasswordAuthentication=no ' - . '-o RequestTTY=no ' - // Quiet mode. Causes most warning and diagnostic messages to be suppressed. - // Errors are still out put. This is to silence for example, that warning - // Permanently added to the list of known hosts. - . '-q ' - . "-p {$port} " - . "{$user}@{$destination} " - . " 'bash -se' << \\$delimiter" . PHP_EOL - . $command . PHP_EOL - . $delimiter; - - $process = Process::start($sshCommand, $this->handleOutput(...)); - - $processResult = $process->wait(); + $processResult = Process::run($this->getCommand(), $this->handleOutput(...)); $status = match ($processResult->exitCode()) { 0 => ProcessStatus::FINISHED, @@ -87,6 +60,26 @@ class ExecuteCoolifyProcess implements ShouldQueue return $processResult; } + protected function getCommand(): string + { + $user = $this->activity->getExtraProperty('user'); + $destination = $this->activity->getExtraProperty('destination'); + $port = $this->activity->getExtraProperty('port'); + $command = $this->activity->getExtraProperty('command'); + + $delimiter = 'EOF-COOLIFY-SSH'; + + return 'ssh ' + . '-o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null ' + . '-o PasswordAuthentication=no ' + . '-o RequestTTY=no ' + . "-p {$port} " + . "{$user}@{$destination} " + . " 'bash -se' << \\$delimiter" . PHP_EOL + . $command . PHP_EOL + . $delimiter; + } + protected function handleOutput(string $type, string $output) { $this->currentTime = $this->elapsedTime(); @@ -109,7 +102,7 @@ class ExecuteCoolifyProcess implements ShouldQueue } /** - * Decides if it's time to write again to database. + * Determines if it's time to write again to database. * * @return bool */ diff --git a/app/Data/RemoteProcessArgs.php b/app/Data/RemoteProcessArgs.php new file mode 100644 index 000000000..65ed0e645 --- /dev/null +++ b/app/Data/RemoteProcessArgs.php @@ -0,0 +1,19 @@ +value, + public string $status = ProcessStatus::HOLDING->value, + ){} +} diff --git a/app/Enums/ActivityTypes.php b/app/Enums/ActivityTypes.php new file mode 100644 index 000000000..52a35e2f8 --- /dev/null +++ b/app/Enums/ActivityTypes.php @@ -0,0 +1,8 @@ +isKeepAliveOn = true; - $this->activity = coolifyProcess($this->command, 'testing-host'); + $this->activity = remoteProcess($this->command, 'testing-host'); } public function runSleepingBeauty() { $this->isKeepAliveOn = true; - $this->activity = coolifyProcess('x=1; while [ $x -le 40 ]; do sleep 0.1 && echo "Welcome $x times" $(( x++ )); done', 'testing-host'); + $this->activity = remoteProcess('x=1; while [ $x -le 40 ]; do sleep 0.1 && echo "Welcome $x times" $(( x++ )); done', 'testing-host'); } public function runDummyProjectBuild() { $this->isKeepAliveOn = true; - $this->activity = coolifyProcess(<<activity = remoteProcess(<< $this->activity, + ]); + + $remoteProcess(); + } +} diff --git a/app/Services/CoolifyProcess.php b/app/Services/CoolifyProcess.php deleted file mode 100644 index 16071ebd7..000000000 --- a/app/Services/CoolifyProcess.php +++ /dev/null @@ -1,47 +0,0 @@ -activity = activity() - ->withProperties([ - 'type' => 'COOLIFY_PROCESS', - 'user' => $this->user, - 'destination' => $this->destination, - 'port' => $this->port, - 'command' => $this->command, - 'status' => ProcessStatus::HOLDING, - ]) - ->log("Awaiting to start command...\n\n"); - } - - public function __invoke(): Activity|ProcessResult - { - $job = new ExecuteCoolifyProcess($this->activity); - - if (app()->environment('testing')) { - return $job->handle(); - } - - dispatch($job); - - return $this->activity; - } - - -} diff --git a/bootstrap/helpers.php b/bootstrap/helpers.php index 0d48f5401..c7517b0db 100644 --- a/bootstrap/helpers.php +++ b/bootstrap/helpers.php @@ -1,24 +1,29 @@ $destination, - 'command' => $command, - ]); - - $activityLog = $process(); - - return $activityLog; + return resolve(DispatchRemoteProcess::class, [ + 'remoteProcessArgs' => new RemoteProcessArgs( + destination: $destination, + command: $command, + port: $port, + user: $user, + ), + ])(); } } diff --git a/composer.json b/composer.json index 2b626323e..207edd878 100644 --- a/composer.json +++ b/composer.json @@ -5,13 +5,14 @@ "keywords": ["framework", "laravel"], "license": "MIT", "require": { - "php": "^8.1", + "php": "^8.2", "guzzlehttp/guzzle": "^7.2", "laravel/framework": "^10.0", "laravel/sanctum": "^3.2", "laravel/tinker": "^2.8", "livewire/livewire": "^2.12", "spatie/laravel-activitylog": "^4.7", + "spatie/laravel-data": "^3.2", "spatie/laravel-ray": "^1.32" }, "require-dev": { diff --git a/composer.lock b/composer.lock index bad962709..ad3d8bd5e 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "5b876c04da75e4ae5fab21efa402fd45", + "content-hash": "c6bfcd94dc256f9124e84a380eaaf556", "packages": [ { "name": "brick/math", @@ -137,6 +137,49 @@ }, "time": "2022-10-27T11:44:00+00:00" }, + { + "name": "doctrine/deprecations", + "version": "v1.0.0", + "source": { + "type": "git", + "url": "https://github.com/doctrine/deprecations.git", + "reference": "0e2a4f1f8cdfc7a92ec3b01c9334898c806b30de" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/deprecations/zipball/0e2a4f1f8cdfc7a92ec3b01c9334898c806b30de", + "reference": "0e2a4f1f8cdfc7a92ec3b01c9334898c806b30de", + "shasum": "" + }, + "require": { + "php": "^7.1|^8.0" + }, + "require-dev": { + "doctrine/coding-standard": "^9", + "phpunit/phpunit": "^7.5|^8.5|^9.5", + "psr/log": "^1|^2|^3" + }, + "suggest": { + "psr/log": "Allows logging deprecations via PSR-3 logger implementation" + }, + "type": "library", + "autoload": { + "psr-4": { + "Doctrine\\Deprecations\\": "lib/Doctrine/Deprecations" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "A small layer on top of trigger_error(E_USER_DEPRECATED) or PSR-3 logging with options to disable all deprecations or selectively for packages.", + "homepage": "https://www.doctrine-project.org/", + "support": { + "issues": "https://github.com/doctrine/deprecations/issues", + "source": "https://github.com/doctrine/deprecations/tree/v1.0.0" + }, + "time": "2022-05-02T15:47:09+00:00" + }, { "name": "doctrine/inflector", "version": "2.0.6", @@ -2276,6 +2319,117 @@ ], "time": "2023-02-08T01:06:31+00:00" }, + { + "name": "phpdocumentor/reflection-common", + "version": "2.2.0", + "source": { + "type": "git", + "url": "https://github.com/phpDocumentor/ReflectionCommon.git", + "reference": "1d01c49d4ed62f25aa84a747ad35d5a16924662b" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionCommon/zipball/1d01c49d4ed62f25aa84a747ad35d5a16924662b", + "reference": "1d01c49d4ed62f25aa84a747ad35d5a16924662b", + "shasum": "" + }, + "require": { + "php": "^7.2 || ^8.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-2.x": "2.x-dev" + } + }, + "autoload": { + "psr-4": { + "phpDocumentor\\Reflection\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Jaap van Otterdijk", + "email": "opensource@ijaap.nl" + } + ], + "description": "Common reflection classes used by phpdocumentor to reflect the code structure", + "homepage": "http://www.phpdoc.org", + "keywords": [ + "FQSEN", + "phpDocumentor", + "phpdoc", + "reflection", + "static analysis" + ], + "support": { + "issues": "https://github.com/phpDocumentor/ReflectionCommon/issues", + "source": "https://github.com/phpDocumentor/ReflectionCommon/tree/2.x" + }, + "time": "2020-06-27T09:03:43+00:00" + }, + { + "name": "phpdocumentor/type-resolver", + "version": "1.7.0", + "source": { + "type": "git", + "url": "https://github.com/phpDocumentor/TypeResolver.git", + "reference": "1534aea9bde19a5c85c5d1e1f834ab63f4c5dcf5" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/1534aea9bde19a5c85c5d1e1f834ab63f4c5dcf5", + "reference": "1534aea9bde19a5c85c5d1e1f834ab63f4c5dcf5", + "shasum": "" + }, + "require": { + "doctrine/deprecations": "^1.0", + "php": "^7.4 || ^8.0", + "phpdocumentor/reflection-common": "^2.0", + "phpstan/phpdoc-parser": "^1.13" + }, + "require-dev": { + "ext-tokenizer": "*", + "phpbench/phpbench": "^1.2", + "phpstan/extension-installer": "^1.1", + "phpstan/phpstan": "^1.8", + "phpstan/phpstan-phpunit": "^1.1", + "phpunit/phpunit": "^9.5", + "rector/rector": "^0.13.9", + "vimeo/psalm": "^4.25" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-1.x": "1.x-dev" + } + }, + "autoload": { + "psr-4": { + "phpDocumentor\\Reflection\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Mike van Riel", + "email": "me@mikevanriel.com" + } + ], + "description": "A PSR-5 based resolver of Class names, Types and Structural Element Names", + "support": { + "issues": "https://github.com/phpDocumentor/TypeResolver/issues", + "source": "https://github.com/phpDocumentor/TypeResolver/tree/1.7.0" + }, + "time": "2023-03-12T10:13:29+00:00" + }, { "name": "phpoption/phpoption", "version": "1.9.1", @@ -2351,6 +2505,51 @@ ], "time": "2023-02-25T19:38:58+00:00" }, + { + "name": "phpstan/phpdoc-parser", + "version": "1.16.1", + "source": { + "type": "git", + "url": "https://github.com/phpstan/phpdoc-parser.git", + "reference": "e27e92d939e2e3636f0a1f0afaba59692c0bf571" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpstan/phpdoc-parser/zipball/e27e92d939e2e3636f0a1f0afaba59692c0bf571", + "reference": "e27e92d939e2e3636f0a1f0afaba59692c0bf571", + "shasum": "" + }, + "require": { + "php": "^7.2 || ^8.0" + }, + "require-dev": { + "php-parallel-lint/php-parallel-lint": "^1.2", + "phpstan/extension-installer": "^1.0", + "phpstan/phpstan": "^1.5", + "phpstan/phpstan-phpunit": "^1.1", + "phpstan/phpstan-strict-rules": "^1.0", + "phpunit/phpunit": "^9.5", + "symfony/process": "^5.2" + }, + "type": "library", + "autoload": { + "psr-4": { + "PHPStan\\PhpDocParser\\": [ + "src/" + ] + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "PHPDoc parser with support for nullable, intersection and generic types", + "support": { + "issues": "https://github.com/phpstan/phpdoc-parser/issues", + "source": "https://github.com/phpstan/phpdoc-parser/tree/1.16.1" + }, + "time": "2023-02-07T18:11:17+00:00" + }, { "name": "pimple/pimple", "version": "v3.5.0", @@ -3222,6 +3421,89 @@ ], "time": "2023-01-25T17:04:51+00:00" }, + { + "name": "spatie/laravel-data", + "version": "3.2.0", + "source": { + "type": "git", + "url": "https://github.com/spatie/laravel-data.git", + "reference": "c4f632924870e52beefe982aa50a88ff59250bfd" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/spatie/laravel-data/zipball/c4f632924870e52beefe982aa50a88ff59250bfd", + "reference": "c4f632924870e52beefe982aa50a88ff59250bfd", + "shasum": "" + }, + "require": { + "illuminate/contracts": "^9.30|^10.0", + "php": "^8.1", + "phpdocumentor/type-resolver": "^1.5", + "spatie/laravel-package-tools": "^1.9.0" + }, + "require-dev": { + "fakerphp/faker": "^1.14", + "friendsofphp/php-cs-fixer": "^3.0", + "inertiajs/inertia-laravel": "^0.6.3", + "nesbot/carbon": "^2.63", + "nette/php-generator": "^3.5", + "nunomaduro/larastan": "^2.0", + "orchestra/testbench": "^7.6|^8.0", + "pestphp/pest": "^1.22", + "pestphp/pest-plugin-laravel": "^1.3", + "phpbench/phpbench": "^1.2", + "phpstan/extension-installer": "^1.1", + "phpunit/phpunit": "^9.3", + "spatie/invade": "^1.0", + "spatie/laravel-typescript-transformer": "^2.1.6", + "spatie/pest-plugin-snapshots": "^1.1", + "spatie/phpunit-snapshot-assertions": "^4.2", + "spatie/test-time": "^1.2" + }, + "type": "library", + "extra": { + "laravel": { + "providers": [ + "Spatie\\LaravelData\\LaravelDataServiceProvider" + ] + } + }, + "autoload": { + "psr-4": { + "Spatie\\LaravelData\\": "src", + "Spatie\\LaravelData\\Database\\Factories\\": "database/factories" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Ruben Van Assche", + "email": "ruben@spatie.be", + "role": "Developer" + } + ], + "description": "Create unified resources and data transfer objects", + "homepage": "https://github.com/spatie/laravel-data", + "keywords": [ + "laravel", + "laravel-data", + "spatie" + ], + "support": { + "issues": "https://github.com/spatie/laravel-data/issues", + "source": "https://github.com/spatie/laravel-data/tree/3.2.0" + }, + "funding": [ + { + "url": "https://github.com/spatie", + "type": "github" + } + ], + "time": "2023-03-17T09:48:15+00:00" + }, { "name": "spatie/laravel-package-tools", "version": "1.14.2", @@ -6406,49 +6688,6 @@ ], "time": "2023-03-20T15:15:41+00:00" }, - { - "name": "doctrine/deprecations", - "version": "v1.0.0", - "source": { - "type": "git", - "url": "https://github.com/doctrine/deprecations.git", - "reference": "0e2a4f1f8cdfc7a92ec3b01c9334898c806b30de" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/doctrine/deprecations/zipball/0e2a4f1f8cdfc7a92ec3b01c9334898c806b30de", - "reference": "0e2a4f1f8cdfc7a92ec3b01c9334898c806b30de", - "shasum": "" - }, - "require": { - "php": "^7.1|^8.0" - }, - "require-dev": { - "doctrine/coding-standard": "^9", - "phpunit/phpunit": "^7.5|^8.5|^9.5", - "psr/log": "^1|^2|^3" - }, - "suggest": { - "psr/log": "Allows logging deprecations via PSR-3 logger implementation" - }, - "type": "library", - "autoload": { - "psr-4": { - "Doctrine\\Deprecations\\": "lib/Doctrine/Deprecations" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "description": "A small layer on top of trigger_error(E_USER_DEPRECATED) or PSR-3 logging with options to disable all deprecations or selectively for packages.", - "homepage": "https://www.doctrine-project.org/", - "support": { - "issues": "https://github.com/doctrine/deprecations/issues", - "source": "https://github.com/doctrine/deprecations/tree/v1.0.0" - }, - "time": "2022-05-02T15:47:09+00:00" - }, { "name": "fakerphp/faker", "version": "v1.21.0", @@ -7521,59 +7760,6 @@ }, "time": "2022-02-21T01:04:05+00:00" }, - { - "name": "phpdocumentor/reflection-common", - "version": "2.2.0", - "source": { - "type": "git", - "url": "https://github.com/phpDocumentor/ReflectionCommon.git", - "reference": "1d01c49d4ed62f25aa84a747ad35d5a16924662b" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionCommon/zipball/1d01c49d4ed62f25aa84a747ad35d5a16924662b", - "reference": "1d01c49d4ed62f25aa84a747ad35d5a16924662b", - "shasum": "" - }, - "require": { - "php": "^7.2 || ^8.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-2.x": "2.x-dev" - } - }, - "autoload": { - "psr-4": { - "phpDocumentor\\Reflection\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Jaap van Otterdijk", - "email": "opensource@ijaap.nl" - } - ], - "description": "Common reflection classes used by phpdocumentor to reflect the code structure", - "homepage": "http://www.phpdoc.org", - "keywords": [ - "FQSEN", - "phpDocumentor", - "phpdoc", - "reflection", - "static analysis" - ], - "support": { - "issues": "https://github.com/phpDocumentor/ReflectionCommon/issues", - "source": "https://github.com/phpDocumentor/ReflectionCommon/tree/2.x" - }, - "time": "2020-06-27T09:03:43+00:00" - }, { "name": "phpdocumentor/reflection-docblock", "version": "5.3.0", @@ -7631,109 +7817,6 @@ }, "time": "2021-10-19T17:43:47+00:00" }, - { - "name": "phpdocumentor/type-resolver", - "version": "1.7.0", - "source": { - "type": "git", - "url": "https://github.com/phpDocumentor/TypeResolver.git", - "reference": "1534aea9bde19a5c85c5d1e1f834ab63f4c5dcf5" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/1534aea9bde19a5c85c5d1e1f834ab63f4c5dcf5", - "reference": "1534aea9bde19a5c85c5d1e1f834ab63f4c5dcf5", - "shasum": "" - }, - "require": { - "doctrine/deprecations": "^1.0", - "php": "^7.4 || ^8.0", - "phpdocumentor/reflection-common": "^2.0", - "phpstan/phpdoc-parser": "^1.13" - }, - "require-dev": { - "ext-tokenizer": "*", - "phpbench/phpbench": "^1.2", - "phpstan/extension-installer": "^1.1", - "phpstan/phpstan": "^1.8", - "phpstan/phpstan-phpunit": "^1.1", - "phpunit/phpunit": "^9.5", - "rector/rector": "^0.13.9", - "vimeo/psalm": "^4.25" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-1.x": "1.x-dev" - } - }, - "autoload": { - "psr-4": { - "phpDocumentor\\Reflection\\": "src" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Mike van Riel", - "email": "me@mikevanriel.com" - } - ], - "description": "A PSR-5 based resolver of Class names, Types and Structural Element Names", - "support": { - "issues": "https://github.com/phpDocumentor/TypeResolver/issues", - "source": "https://github.com/phpDocumentor/TypeResolver/tree/1.7.0" - }, - "time": "2023-03-12T10:13:29+00:00" - }, - { - "name": "phpstan/phpdoc-parser", - "version": "1.16.1", - "source": { - "type": "git", - "url": "https://github.com/phpstan/phpdoc-parser.git", - "reference": "e27e92d939e2e3636f0a1f0afaba59692c0bf571" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpdoc-parser/zipball/e27e92d939e2e3636f0a1f0afaba59692c0bf571", - "reference": "e27e92d939e2e3636f0a1f0afaba59692c0bf571", - "shasum": "" - }, - "require": { - "php": "^7.2 || ^8.0" - }, - "require-dev": { - "php-parallel-lint/php-parallel-lint": "^1.2", - "phpstan/extension-installer": "^1.0", - "phpstan/phpstan": "^1.5", - "phpstan/phpstan-phpunit": "^1.1", - "phpstan/phpstan-strict-rules": "^1.0", - "phpunit/phpunit": "^9.5", - "symfony/process": "^5.2" - }, - "type": "library", - "autoload": { - "psr-4": { - "PHPStan\\PhpDocParser\\": [ - "src/" - ] - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "description": "PHPDoc parser with support for nullable, intersection and generic types", - "support": { - "issues": "https://github.com/phpstan/phpdoc-parser/issues", - "source": "https://github.com/phpstan/phpdoc-parser/tree/1.16.1" - }, - "time": "2023-02-07T18:11:17+00:00" - }, { "name": "phpunit/php-code-coverage", "version": "10.0.2", @@ -9484,7 +9567,7 @@ "prefer-stable": true, "prefer-lowest": false, "platform": { - "php": "^8.1" + "php": "^8.2" }, "platform-dev": [], "plugin-api-version": "2.3.0" diff --git a/resources/views/livewire/run-command.blade.php b/resources/views/livewire/run-command.blade.php index aa7aeaddd..d97150f73 100755 --- a/resources/views/livewire/run-command.blade.php +++ b/resources/views/livewire/run-command.blade.php @@ -8,6 +8,7 @@ +
@@ -20,7 +21,7 @@ Activity: {{ $activity?->id ?? 'waiting' }}
 {{ data_get($activity, 'description') }}
+ @if ($isKeepAliveOn || $manualKeepAlive) wire:poll.750ms="polling" @endif>{{ data_get($activity, 'description') }}
Details:
{{ json_encode(data_get($activity, 'properties'), JSON_PRETTY_PRINT) }}
diff --git a/tests/Feature/DockerCommandsTest.php b/tests/Feature/DockerCommandsTest.php index 32340a70d..8fc551a04 100644 --- a/tests/Feature/DockerCommandsTest.php +++ b/tests/Feature/DockerCommandsTest.php @@ -13,20 +13,20 @@ it('starts a docker container correctly', function () { $host = 'testing-host'; // Assert there's no containers start with coolify_test_* - $processResult = coolifyProcess($areThereCoolifyTestContainers, $host); - $containers = Output::containerList($processResult->output()); + $activity = remoteProcess($areThereCoolifyTestContainers, $host); + $containers = Output::containerList($activity->getExtraProperty('stdout')); expect($containers)->toBeEmpty(); // start a container nginx -d --name = $containerName - $processResult = coolifyProcess("docker run -d --name {$containerName} nginx", $host); - expect($processResult->successful())->toBeTrue(); + $activity = remoteProcess("docker run -d --rm --name {$containerName} nginx", $host); + expect($activity->getExtraProperty('exitCode'))->toBe(0); // docker ps name = $container - $processResult = coolifyProcess($areThereCoolifyTestContainers, $host); - $containers = Output::containerList($processResult->output()); + $activity = remoteProcess($areThereCoolifyTestContainers, $host); + $containers = Output::containerList($activity->getExtraProperty('stdout')); expect($containers->where('Names', $containerName)->count())->toBe(1); // Stop testing containers - $processResult = coolifyProcess("docker stop $(docker ps --filter='name={$coolifyNamePrefix}*' -q)", $host); - expect($processResult->successful())->toBeTrue(); + $activity = remoteProcess("docker stop $(docker ps --filter='name={$coolifyNamePrefix}*' -q)", $host); + expect($activity->getExtraProperty('exitCode'))->toBe(0); }); diff --git a/tests/Unit/RulesTest.php b/tests/Unit/RulesTest.php new file mode 100644 index 000000000..02e14ba48 --- /dev/null +++ b/tests/Unit/RulesTest.php @@ -0,0 +1,5 @@ +expect(['dd', 'dump', 'ray']) + ->not->toBeUsed();