wip
This commit is contained in:
@@ -45,7 +45,7 @@ class StandaloneDocker extends Component
|
||||
|
||||
$server = Server::find($this->server_id);
|
||||
|
||||
runRemoteCommandSync($server, ['docker network create --attachable ' . $this->network], throwError: false);
|
||||
instantRemoteProcess($server, ['docker network create --attachable ' . $this->network], throwError: false);
|
||||
return redirect()->route('destination.show', $docker->uuid);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,25 +2,26 @@
|
||||
|
||||
namespace App\Http\Livewire;
|
||||
|
||||
use App\Enums\ActivityTypes;
|
||||
use App\Models\Server;
|
||||
use Illuminate\Support\Facades\Http;
|
||||
use Livewire\Component;
|
||||
|
||||
class ForceUpgrade extends Component
|
||||
{
|
||||
public function upgrade()
|
||||
{
|
||||
if (env('APP_ENV') === 'local') {
|
||||
//if (env('APP_ENV') === 'local') {
|
||||
if (config('app.env') === 'local') {
|
||||
$server = Server::where('ip', 'coolify-testing-host')->first();
|
||||
if (!$server) {
|
||||
return;
|
||||
}
|
||||
runRemoteCommandSync($server, [
|
||||
instantRemoteProcess($server, [
|
||||
"sleep 2"
|
||||
]);
|
||||
remoteProcess([
|
||||
"sleep 10"
|
||||
], $server);
|
||||
], $server, ActivityTypes::INSTANT->value);
|
||||
$this->emit('updateInitiated');
|
||||
} else {
|
||||
$latestVersion = getLatestVersionOfCoolify();
|
||||
@@ -31,19 +32,19 @@ class ForceUpgrade extends Component
|
||||
return;
|
||||
}
|
||||
|
||||
runRemoteCommandSync($server, [
|
||||
instantRemoteProcess($server, [
|
||||
"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",
|
||||
]);
|
||||
runRemoteCommandSync($server, [
|
||||
instantRemoteProcess($server, [
|
||||
"docker compose -f /data/coolify/source/docker-compose.yml -f /data/coolify/source/docker-compose.prod.yml pull",
|
||||
]);
|
||||
|
||||
remoteProcess([
|
||||
"bash /data/coolify/source/upgrade.sh $latestVersion"
|
||||
], $server);
|
||||
], $server, ActivityTypes::INSTANT->value);
|
||||
|
||||
$this->emit('updateInitiated');
|
||||
}
|
||||
|
||||
@@ -73,7 +73,7 @@ class Deploy extends Component
|
||||
}
|
||||
public function stop()
|
||||
{
|
||||
runRemoteCommandSync($this->destination->server, ["docker rm -f {$this->application->uuid}"]);
|
||||
instantRemoteProcess($this->destination->server, ["docker rm -f {$this->application->uuid}"]);
|
||||
if ($this->application->status != 'exited') {
|
||||
$this->application->status = 'exited';
|
||||
$this->application->save();
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Http\Livewire;
|
||||
|
||||
use App\Enums\ActivityTypes;
|
||||
use App\Models\Server;
|
||||
use Livewire\Component;
|
||||
|
||||
@@ -31,19 +32,19 @@ class RunCommand extends Component
|
||||
public function runCommand()
|
||||
{
|
||||
$this->isKeepAliveOn = true;
|
||||
$this->activity = remoteProcess([$this->command], Server::where('uuid', $this->server)->first());
|
||||
$this->activity = remoteProcess([$this->command], Server::where('uuid', $this->server)->first(), ActivityTypes::INSTANT->value);
|
||||
}
|
||||
|
||||
public function runSleepingBeauty()
|
||||
{
|
||||
$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());
|
||||
$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);
|
||||
}
|
||||
|
||||
public function runDummyProjectBuild()
|
||||
{
|
||||
$this->isKeepAliveOn = true;
|
||||
$this->activity = remoteProcess([' cd projects/dummy-project', 'docker-compose build --no-cache'], Server::where('uuid', $this->server)->first());
|
||||
$this->activity = remoteProcess([' cd projects/dummy-project', 'docker-compose build --no-cache'], Server::where('uuid', $this->server)->first(), ActivityTypes::INSTANT->value);
|
||||
}
|
||||
|
||||
public function polling()
|
||||
|
||||
@@ -28,15 +28,15 @@ class Form extends Component
|
||||
public function installDocker()
|
||||
{
|
||||
$config = base64_encode('{ "live-restore": true }');
|
||||
runRemoteCommandSync($this->server, [
|
||||
instantRemoteProcess($this->server, [
|
||||
"curl https://releases.rancher.com/install-docker/23.0.sh | sh"
|
||||
]);
|
||||
}
|
||||
public function checkServer()
|
||||
{
|
||||
$this->uptime = runRemoteCommandSync($this->server, ['uptime']);
|
||||
$this->dockerVersion = runRemoteCommandSync($this->server, ['docker version|head -2|grep -i version'], false);
|
||||
$this->dockerComposeVersion = runRemoteCommandSync($this->server, ['docker compose version|head -2|grep -i version'], false);
|
||||
$this->uptime = instantRemoteProcess($this->server, ['uptime']);
|
||||
$this->dockerVersion = instantRemoteProcess($this->server, ['docker version|head -2|grep -i version'], false);
|
||||
$this->dockerComposeVersion = instantRemoteProcess($this->server, ['docker compose version|head -2|grep -i version'], false);
|
||||
}
|
||||
public function submit()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user