Merge remote-tracking branch 'origin/v4-next' into patricio-deploy-proxy

This commit is contained in:
Joao Patricio
2023-05-03 09:32:09 +01:00
13 changed files with 64 additions and 42 deletions

View File

@@ -45,7 +45,7 @@ class StandaloneDocker extends Component
$server = Server::find($this->server_id);
instantRemoteProcess($server, ['docker network create --attachable ' . $this->network], throwError: false);
instantRemoteProcess(['docker network create --attachable ' . $this->network], $server, throwError: false);
return redirect()->route('destination.show', $docker->uuid);
}
}

View File

@@ -10,15 +10,14 @@ class ForceUpgrade extends Component
{
public function upgrade()
{
//if (env('APP_ENV') === 'local') {
if (config('app.env') === 'local') {
$server = Server::where('ip', 'coolify-testing-host')->first();
if (!$server) {
return;
}
instantRemoteProcess($server, [
instantRemoteProcess([
"sleep 2"
]);
], $server);
remoteProcess([
"sleep 10"
], $server, ActivityTypes::INLINE->value);
@@ -32,15 +31,16 @@ class ForceUpgrade extends Component
return;
}
instantRemoteProcess($server, [
instantRemoteProcess([
"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",
]);
instantRemoteProcess($server, [
], $server);
instantRemoteProcess([
"docker compose -f /data/coolify/source/docker-compose.yml -f /data/coolify/source/docker-compose.prod.yml pull",
]);
], $server);
remoteProcess([
"bash /data/coolify/source/upgrade.sh $latestVersion"

View File

@@ -73,7 +73,7 @@ class Deploy extends Component
}
public function stop()
{
instantRemoteProcess($this->destination->server, ["docker rm -f {$this->application->uuid}"]);
instantRemoteProcess(["docker rm -f {$this->application->uuid}"], $this->destination->server);
if ($this->application->status != 'exited') {
$this->application->status = 'exited';
$this->application->save();

View File

@@ -2,6 +2,7 @@
namespace App\Http\Livewire\Server;
use App\Enums\ActivityTypes;
use App\Models\Server;
use Illuminate\Support\Facades\Validator;
use Livewire\Component;
@@ -28,15 +29,30 @@ class Form extends Component
public function installDocker()
{
$config = base64_encode('{ "live-restore": true }');
instantRemoteProcess($this->server, [
"curl https://releases.rancher.com/install-docker/23.0.sh | sh"
]);
remoteProcess([
"curl https://releases.rancher.com/install-docker/23.0.sh | sh",
"echo '{$config}' | base64 -d > /etc/docker/daemon.json",
"systemctl restart docker"
], $this->server, ActivityTypes::INLINE->value);
}
public function checkServer()
{
$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);
try {
$this->uptime = instantRemoteProcess(['uptime'], $this->server, false);
if (!$this->uptime) {
$this->uptime = 'Server not reachable.';
throw new \Exception('Server not reachable.');
}
$this->dockerVersion = instantRemoteProcess(['docker version|head -2|grep -i version'], $this->server, false);
if (!$this->dockerVersion) {
$this->dockerVersion = 'Not installed.';
}
$this->dockerComposeVersion = instantRemoteProcess(['docker compose version|head -2|grep -i version'], $this->server, false);
if (!$this->dockerComposeVersion) {
$this->dockerComposeVersion = 'Not installed.';
}
} catch (\Exception $e) {
}
}
public function submit()
{