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.
PHP coolifydatabasesdeploymentdockerdocker-composeinertiajslaravelmariadbmysqlnextjsnodejsphppostgresredisself-hostedself-hostingserverstatic-sitesveltesvelte5
Add human-friendly output to upgrade script
Andras Bacsai6a9027dcbf52
diff --git a/app/Actions/Server/UpdateCoolify.php b/app/Actions/Server/UpdateCoolify.phpindex a26e7daaa3..b5ebd92b2f 100644--- a/app/Actions/Server/UpdateCoolify.php+++ b/app/Actions/Server/UpdateCoolify.php@@ -30,7 +30,6 @@ class UpdateCoolifyif (! $this->server) {return;}- CleanupDocker::dispatch($this->server, false, false);// Fetch fresh version from CDN instead of using cachetry {@@ -117,17 +116,12 @@ class UpdateCoolifyprivate function update(){- $helperImage = config('constants.coolify.helper_image');- $latest_version = getHelperVersion();- instant_remote_process(["docker pull -q {$helperImage}:{$latest_version}"], $this->server, false);-- $image = config('constants.coolify.registry_url').'/coollabsio/coolify:'.$this->latestVersion;- instant_remote_process(["docker pull -q $image"], $this->server, false);-+ $latestHelperImageVersion = getHelperVersion();$upgradeScriptUrl = config('constants.coolify.upgrade_script_url');+remote_process(["curl -fsSL {$upgradeScriptUrl} -o /data/coolify/source/upgrade.sh",- "bash /data/coolify/source/upgrade.sh $this->latestVersion",+ "bash /data/coolify/source/upgrade.sh $this->latestVersion $latestHelperImageVersion",], $this->server);}}diff --git a/scripts/upgrade.sh b/scripts/upgrade.shindex 3ce4265487..73514214fc 100644--- a/scripts/upgrade.sh+++ b/scripts/upgrade.sh@@ -11,13 +11,22 @@ ENV_FILE="/data/coolify/source/.env"DATE=$(date +%Y-%m-%d-%H-%M-%S)LOGFILE="/data/coolify/source/upgrade-${DATE}.log"+echo ""+echo "=========================================="+echo " Coolify Upgrade - ${DATE}"+echo "=========================================="+echo ""++echo "1/6 Downloading latest configuration files..."curl -fsSL -L $CDN/docker-compose.yml -o /data/coolify/source/docker-compose.ymlcurl -fsSL -L $CDN/docker-compose.prod.yml -o /data/coolify/source/docker-compose.prod.ymlcurl -fsSL -L $CDN/.env.production -o /data/coolify/source/.env.production+echo " Done."# Backup existing .env file before making any changesif [ "$SKIP_BACKUP" != "true" ]; thenif [ -f "$ENV_FILE" ]; then+ echo " Creating backup of .env file..."echo "Creating backup of existing .env file to .env-$DATE" >>"$LOGFILE"cp "$ENV_FILE" "$ENV_FILE-$DATE"else@@ -25,6 +34,8 @@ if [ "$SKIP_BACKUP" != "true" ]; thenfifi+echo ""+echo "2/6 Updating environment configuration..."echo "Merging .env.production values into .env" >>"$LOGFILE"awk -F '=' '!seen[$1]++' "$ENV_FILE" /data/coolify/source/.env.production > "$ENV_FILE.tmp" && mv "$ENV_FILE.tmp" "$ENV_FILE"echo ".env file merged successfully" >>"$LOGFILE"@@ -48,12 +59,13 @@ echo "Checking and updating environment variables if necessary..." >>"$LOGFILE"update_env_var "PUSHER_APP_ID" "$(openssl rand -hex 32)"update_env_var "PUSHER_APP_KEY" "$(openssl rand -hex 32)"update_env_var "PUSHER_APP_SECRET" "$(openssl rand -hex 32)"+echo " Done."# Make sure coolify network exists# It is created when starting Coolify with docker composeif ! docker network inspect coolify >/dev/null 2>&1; thenif ! docker network create --attachable --ipv6 coolify 2>/dev/null; then- echo "Failed to create coolify network with ipv6. Trying without ipv6..."+ echo "Failed to create coolify network with ipv6. Trying without ipv6..." >>"$LOGFILE"docker network create --attachable coolify 2>/dev/nullfifi@@ -64,31 +76,59 @@ if [ -f /root/.docker/config.json ]; thenDOCKER_CONFIG_MOUNT="-v /root/.docker/config.json:/root/.docker/config.json"fi-# Pull all required images before stopping containers-# This ensures we don't take down the system if image pull fails (rate limits, network issues, etc.)+echo ""+echo "3/6 Pulling Docker images..."+echo " This may take a few minutes depending on your connection."echo "Pulling required Docker images..." >>"$LOGFILE"-docker pull "${REGISTRY_URL:-ghcr.io}/coollabsio/coolify:${LATEST_IMAGE}" >>"$LOGFILE" 2>&1 || { echo "Failed to pull Coolify image. Aborting upgrade." >>"$LOGFILE"; exit 1; }-docker pull "${REGISTRY_URL:-ghcr.io}/coollabsio/coolify-helper:${LATEST_HELPER_VERSION}" >>"$LOGFILE" 2>&1 || { echo "Failed to pull Coolify helper image. Aborting upgrade." >>"$LOGFILE"; exit 1; }-docker pull postgres:15-alpine >>"$LOGFILE" 2>&1 || { echo "Failed to pull PostgreSQL image. Aborting upgrade." >>"$LOGFILE"; exit 1; }-docker pull redis:7-alpine >>"$LOGFILE" 2>&1 || { echo "Failed to pull Redis image. Aborting upgrade." >>"$LOGFILE"; exit 1; }-# Pull realtime image - version is hardcoded in docker-compose.prod.yml, extract it or use a known version-docker pull "${REGISTRY_URL:-ghcr.io}/coollabsio/coolify-realtime:1.0.10" >>"$LOGFILE" 2>&1 || { echo "Failed to pull Coolify realtime image. Aborting upgrade." >>"$LOGFILE"; exit 1; }++echo " - Pulling Coolify image..."+docker pull "${REGISTRY_URL:-ghcr.io}/coollabsio/coolify:${LATEST_IMAGE}" >>"$LOGFILE" 2>&1 || { echo " ERROR: Failed to pull Coolify image. Aborting upgrade."; echo "Failed to pull Coolify image. Aborting upgrade." >>"$LOGFILE"; exit 1; }++echo " - Pulling Coolify helper image..."+docker pull "${REGISTRY_URL:-ghcr.io}/coollabsio/coolify-helper:${LATEST_HELPER_VERSION}" >>"$LOGFILE" 2>&1 || { echo " ERROR: Failed to pull helper image. Aborting upgrade."; echo "Failed to pull Coolify helper image. Aborting upgrade." >>"$LOGFILE"; exit 1; }++echo " - Pulling PostgreSQL image..."+docker pull postgres:15-alpine >>"$LOGFILE" 2>&1 || { echo " ERROR: Failed to pull PostgreSQL image. Aborting upgrade."; echo "Failed to pull PostgreSQL image. Aborting upgrade." >>"$LOGFILE"; exit 1; }++echo " - Pulling Redis image..."+docker pull redis:7-alpine >>"$LOGFILE" 2>&1 || { echo " ERROR: Failed to pull Redis image. Aborting upgrade."; echo "Failed to pull Redis image. Aborting upgrade." >>"$LOGFILE"; exit 1; }++echo " - Pulling Coolify realtime image..."+docker pull "${REGISTRY_URL:-ghcr.io}/coollabsio/coolify-realtime:1.0.10" >>"$LOGFILE" 2>&1 || { echo " ERROR: Failed to pull realtime image. Aborting upgrade."; echo "Failed to pull Coolify realtime image. Aborting upgrade." >>"$LOGFILE"; exit 1; }+echo "All images pulled successfully." >>"$LOGFILE"+echo " All images pulled successfully."-# Stop and remove existing Coolify containers to prevent conflicts-# This handles both old installations (project "source") and new ones (project "coolify")+echo ""+echo "4/6 Stopping existing containers..."echo "Stopping existing Coolify containers..." >>"$LOGFILE"for container in coolify coolify-db coolify-redis coolify-realtime; doif docker ps -a --format '{{.Names}}' | grep -q "^${container}$"; then+ echo " - Stopping ${container}..."docker stop "$container" >>"$LOGFILE" 2>&1 || truedocker rm "$container" >>"$LOGFILE" 2>&1 || trueecho " - Removed container: $container" >>"$LOGFILE"fidone+echo " Done."+echo ""+echo "5/6 Starting new containers..."if [ -f /data/coolify/source/docker-compose.custom.yml ]; then+ echo " Custom docker-compose.yml detected."echo "docker-compose.custom.yml detected." >>"$LOGFILE"docker run -v /data/coolify/source:/data/coolify/source -v /var/run/docker.sock:/var/run/docker.sock ${DOCKER_CONFIG_MOUNT} --rm ${REGISTRY_URL:-ghcr.io}/coollabsio/coolify-helper:${LATEST_HELPER_VERSION} bash -c "LATEST_IMAGE=${LATEST_IMAGE} docker compose --project-name coolify --env-file /data/coolify/source/.env -f /data/coolify/source/docker-compose.yml -f /data/coolify/source/docker-compose.prod.yml -f /data/coolify/source/docker-compose.custom.yml up -d --remove-orphans --wait --wait-timeout 60" >>"$LOGFILE" 2>&1elsedocker run -v /data/coolify/source:/data/coolify/source -v /var/run/docker.sock:/var/run/docker.sock ${DOCKER_CONFIG_MOUNT} --rm ${REGISTRY_URL:-ghcr.io}/coollabsio/coolify-helper:${LATEST_HELPER_VERSION} bash -c "LATEST_IMAGE=${LATEST_IMAGE} docker compose --project-name coolify --env-file /data/coolify/source/.env -f /data/coolify/source/docker-compose.yml -f /data/coolify/source/docker-compose.prod.yml up -d --remove-orphans --wait --wait-timeout 60" >>"$LOGFILE" 2>&1fi+echo " Done."++echo ""+echo "6/6 Upgrade complete!"+echo ""+echo "=========================================="+echo " Coolify has been upgraded to ${LATEST_IMAGE}"+echo "=========================================="+echo ""+echo " Log file: ${LOGFILE}"+echo ""