Skip to content

An open-source, self-hostable PaaS alternative to Vercel, Heroku & Netlify that lets you easily deploy static sites, databases, full-stack applications and 360+ one-click services on your own servers.

autoupdate feature

Andras Bacsai4d69094a1fdf
diff --git a/app/Http/Livewire/CheckUpdate.php b/app/Http/Livewire/CheckUpdate.php
index 964c360f0c..d2c6bb93be 100644
--- a/app/Http/Livewire/CheckUpdate.php
+++ b/app/Http/Livewire/CheckUpdate.php
@@ -4,7 +4,6 @@ namespace App\Http\Livewire;
use App\Models\Server;
use Illuminate\Support\Facades\Http;
-use Illuminate\Support\Facades\Process;
use Livewire\Component;
class CheckUpdate extends Component
@@ -14,6 +13,19 @@ class CheckUpdate extends Component
protected $currentVersion;
protected $image = 'ghcr.io/coollabsio/coolify';
+ protected function upgrade()
+ {
+ $server = Server::where('ip', 'host.docker.internal')->first();
+ if (!$server) {
+ return;
+ }
+ runRemoteCommandSync($server, ['curl -fsSL https://raw.githubusercontent.com/coollabsio/coolify/v4/scripts/upgrade.sh -o /data/coolify/source/upgrade.sh']);
+ runRemoteCommandSync($server, ['bash /data/coolify/source/upgrade.sh']);
+ }
+ public function forceUpgrade()
+ {
+ $this->upgrade();
+ }
public function checkUpdate()
{
$response = Http::get('https://get.coollabs.io/versions.json');
diff --git a/resources/views/components/navbar.blade.php b/resources/views/components/navbar.blade.php
index dfceb777e2..f31bc96565 100644
--- a/resources/views/components/navbar.blade.php
+++ b/resources/views/components/navbar.blade.php
@@ -13,6 +13,6 @@
@csrf
<button type="submit">Logout</button>
</form>
- {{-- <livewire:check-update> --}}
- @endauth
+ <livewire:check-update>
+ @endauth
</nav>
diff --git a/resources/views/livewire/check-update.blade.php b/resources/views/livewire/check-update.blade.php
index 5ba478a43e..dcd2f64b6a 100644
--- a/resources/views/livewire/check-update.blade.php
+++ b/resources/views/livewire/check-update.blade.php
@@ -1,4 +1,7 @@
<div>
<button wire:click='checkUpdate'>Updates</button>
+ @env('production')
+ <button wire:click='forceUpgrade'>Force Upgrade</button>
+ @endenv
{{ $updateAvailable ? 'Update available' : 'No updates' }}
</div>
diff --git a/scripts/install.sh b/scripts/install.sh
index 40ab1e2551..dd8215186a 100644
--- a/scripts/install.sh
+++ b/scripts/install.sh
@@ -23,18 +23,29 @@ mkdir -p /data/coolify/source
chown -R 9999:root /data
chmod -R 700 /data
-if [ ! -z "$(ls -A /data/coolify/source/.gitignore)" ]; then
- git -C /data/coolify/source fetch --all
- git -C /data/coolify/source reset --hard origin/${COOLIFY_VERSION_BRANCH}
-else
- git -C /data/coolify/source clone --branch ${COOLIFY_VERSION_BRANCH} https://github.com/coollabsio/coolify .
+if [ ! -f /data/coolify/source/docker-compose.yml ]; then
+ echo "Downloading docker-compose.yml..."
+ curl -fsSL https://raw.githubusercontent.com/coollabsio/coolify/${COOLIFY_VERSION_BRANCH}/docker-compose.yml -o /data/coolify/source/docker-compose.yml
+ echo "docker-compose.yml downloaded successfully"
+fi
+
+if [ ! -f /data/coolify/source/docker-compose.prod.yml ]; then
+ echo "Downloading docker-compose.prod.yml..."
+ curl -fsSL https://raw.githubusercontent.com/coollabsio/coolify/${COOLIFY_VERSION_BRANCH}/docker-compose.prod.yml -o /data/coolify/source/docker-compose.prod.yml
+ echo "docker-compose.prod.yml downloaded successfully"
+fi
+
+if [ ! -f /data/coolify/source/.env.example ]; then
+ echo "Downloading .env.example..."
+ curl -fsSL https://raw.githubusercontent.com/coollabsio/coolify/${COOLIFY_VERSION_BRANCH}/.env.example -o /data/coolify/source/.env.example
+ echo ".env.example downloaded successfully"
fi
# Copy .env.example if .env does not exist
if [ ! -f /data/coolify/source/.env ]; then
cp /data/coolify/source/.env.example /data/coolify/source/.env
sed -i 's/APP_ENV=.*/APP_ENV=production/g' /data/coolify/source/.env
- sed -i 's/APP_DEBUG=.*/APP_DEBUG=false/g' /data/coolify/source/.env
+ sed -i 's/APP_DEBUG=.*/APP_DEBUG=true/g' /data/coolify/source/.env
sed -i "s|APP_KEY=.*|APP_KEY=base64:$(openssl rand -base64 32)|g" /data/coolify/source/.env
sed -i "s|DB_PASSWORD=.*|DB_PASSWORD=$(openssl rand -base64 32)|g" /data/coolify/source/.env
fi
diff --git a/scripts/upgrade.sh b/scripts/upgrade.sh
new file mode 100644
index 0000000000..949ff9e85e
--- /dev/null
+++ b/scripts/upgrade.sh
@@ -0,0 +1,4 @@
+#!/bin/bash
+## Do not modify this file. You will lost the ability to autoupdate!
+
+docker compose --env-file /data/coolify/source/.env -f /data/coolify/source/docker-compose.yml -f /data/coolify/source/docker-compose.prod.yml up --pull always