This commit is contained in:
Joao Patricio 2023-05-03 07:25:50 +01:00
parent 79a850f3b9
commit 7c884797d1
4 changed files with 7 additions and 7 deletions

View File

@ -36,7 +36,7 @@ class RunRemoteProcess
public function __construct(Activity $activity, bool $hideFromOutput = false, bool $isFinished = false, bool $ignoreErrors = false) public function __construct(Activity $activity, bool $hideFromOutput = false, bool $isFinished = false, bool $ignoreErrors = false)
{ {
if ($activity->getExtraProperty('type') !== ActivityTypes::INSTANT->value && $activity->getExtraProperty('type') !== ActivityTypes::DEPLOYMENT->value) { if ($activity->getExtraProperty('type') !== ActivityTypes::INLINE->value && $activity->getExtraProperty('type') !== ActivityTypes::DEPLOYMENT->value) {
throw new \RuntimeException('Incompatible Activity to run a remote command.'); throw new \RuntimeException('Incompatible Activity to run a remote command.');
} }

View File

@ -4,6 +4,6 @@ namespace App\Enums;
enum ActivityTypes: string enum ActivityTypes: string
{ {
case INSTANT = 'instant'; case INLINE = 'inline';
case DEPLOYMENT = 'deployment'; case DEPLOYMENT = 'deployment';
} }

View File

@ -21,7 +21,7 @@ class ForceUpgrade extends Component
]); ]);
remoteProcess([ remoteProcess([
"sleep 10" "sleep 10"
], $server, ActivityTypes::INSTANT->value); ], $server, ActivityTypes::INLINE->value);
$this->emit('updateInitiated'); $this->emit('updateInitiated');
} else { } else {
$latestVersion = getLatestVersionOfCoolify(); $latestVersion = getLatestVersionOfCoolify();
@ -44,7 +44,7 @@ class ForceUpgrade extends Component
remoteProcess([ remoteProcess([
"bash /data/coolify/source/upgrade.sh $latestVersion" "bash /data/coolify/source/upgrade.sh $latestVersion"
], $server, ActivityTypes::INSTANT->value); ], $server, ActivityTypes::INLINE->value);
$this->emit('updateInitiated'); $this->emit('updateInitiated');
} }

View File

@ -32,19 +32,19 @@ class RunCommand extends Component
public function runCommand() public function runCommand()
{ {
$this->isKeepAliveOn = true; $this->isKeepAliveOn = true;
$this->activity = remoteProcess([$this->command], Server::where('uuid', $this->server)->first(), ActivityTypes::INSTANT->value); $this->activity = remoteProcess([$this->command], Server::where('uuid', $this->server)->first(), ActivityTypes::INLINE->value);
} }
public function runSleepingBeauty() public function runSleepingBeauty()
{ {
$this->isKeepAliveOn = true; $this->isKeepAliveOn = true;
$this->activity = remoteProcess(['x=1; while [ $x -le 40 ]; do sleep 0.1 && echo "Welcome $x times" $(( x++ )); done'], Server::where('uuid', $this->server)->first(), ActivityTypes::INSTANT->value); $this->activity = remoteProcess(['x=1; while [ $x -le 40 ]; do sleep 0.1 && echo "Welcome $x times" $(( x++ )); done'], Server::where('uuid', $this->server)->first(), ActivityTypes::INLINE->value);
} }
public function runDummyProjectBuild() public function runDummyProjectBuild()
{ {
$this->isKeepAliveOn = true; $this->isKeepAliveOn = true;
$this->activity = remoteProcess([' cd projects/dummy-project', 'docker-compose build --no-cache'], Server::where('uuid', $this->server)->first(), ActivityTypes::INSTANT->value); $this->activity = remoteProcess([' cd projects/dummy-project', 'docker-compose build --no-cache'], Server::where('uuid', $this->server)->first(), ActivityTypes::INLINE->value);
} }
public function polling() public function polling()