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.

Enhance upgrade and installation scripts with logging and status tracking

Andras Bacsai51f1be2995c9
diff --git a/other/nightly/install.sh b/other/nightly/install.sh
index b037fe382c..7d2a78541c 100755
--- a/other/nightly/install.sh
+++ b/other/nightly/install.sh
@@ -29,9 +29,14 @@ if [ $EUID != 0 ]; then
exit
fi
-echo -e "Welcome to Coolify Installer!"
-echo -e "This script will install everything for you. Sit back and relax."
-echo -e "Source code: https://github.com/coollabsio/coolify/blob/v4.x/scripts/install.sh"
+echo ""
+echo "=========================================="
+echo " Coolify Installation - ${DATE}"
+echo "=========================================="
+echo ""
+echo "Welcome to Coolify Installer!"
+echo "This script will install everything for you. Sit back and relax."
+echo "Source code: https://github.com/coollabsio/coolify/blob/v4.x/scripts/install.sh"
# Predefined root user
ROOT_USERNAME=${ROOT_USERNAME:-}
@@ -242,6 +247,29 @@ getAJoke() {
fi
}
+# Helper function to log with timestamp
+log() {
+ echo "[$(date '+%Y-%m-%d %H:%M:%S')] $1"
+}
+
+# Helper function to log section headers
+log_section() {
+ echo ""
+ echo "============================================================"
+ echo "[$(date '+%Y-%m-%d %H:%M:%S')] $1"
+ echo "============================================================"
+}
+
+# Helper function to check if all required packages are installed
+all_packages_installed() {
+ for pkg in curl wget git jq openssl; do
+ if ! command -v "$pkg" >/dev/null 2>&1; then
+ return 1
+ fi
+ done
+ return 0
+}
+
# Check if the OS is manjaro, if so, change it to arch
if [ "$OS_TYPE" = "manjaro" ] || [ "$OS_TYPE" = "manjaro-arm" ]; then
OS_TYPE="arch"
@@ -288,9 +316,11 @@ if [ "$OS_TYPE" = 'amzn' ]; then
dnf install -y findutils >/dev/null
fi
-LATEST_VERSION=$(curl -L --silent $CDN/versions.json | grep -i version | xargs | awk '{print $2}' | tr -d ',')
-LATEST_HELPER_VERSION=$(curl -L --silent $CDN/versions.json | grep -i version | xargs | awk '{print $6}' | tr -d ',')
-LATEST_REALTIME_VERSION=$(curl -L --silent $CDN/versions.json | grep -i version | xargs | awk '{print $8}' | tr -d ',')
+# Fetch versions.json once and parse all values from it
+VERSIONS_JSON=$(curl -L --silent $CDN/versions.json)
+LATEST_VERSION=$(echo "$VERSIONS_JSON" | grep -i version | xargs | awk '{print $2}' | tr -d ',')
+LATEST_HELPER_VERSION=$(echo "$VERSIONS_JSON" | grep -i version | xargs | awk '{print $6}' | tr -d ',')
+LATEST_REALTIME_VERSION=$(echo "$VERSIONS_JSON" | grep -i version | xargs | awk '{print $8}' | tr -d ',')
if [ -z "$LATEST_HELPER_VERSION" ]; then
LATEST_HELPER_VERSION=latest
@@ -315,7 +345,7 @@ if [ "$1" != "" ]; then
LATEST_VERSION="${LATEST_VERSION#v}"
fi
-echo -e "---------------------------------------------"
+echo "---------------------------------------------"
echo "| Operating System | $OS_TYPE $OS_VERSION"
echo "| Docker | $DOCKER_VERSION"
echo "| Coolify | $LATEST_VERSION"
@@ -323,46 +353,61 @@ echo "| Helper | $LATEST_HELPER_VERSION"
echo "| Realtime | $LATEST_REALTIME_VERSION"
echo "| Docker Pool | $DOCKER_ADDRESS_POOL_BASE (size $DOCKER_ADDRESS_POOL_SIZE)"
echo "| Registry URL | $REGISTRY_URL"
-echo -e "---------------------------------------------\n"
-echo -e "1. Installing required packages (curl, wget, git, jq, openssl). "
+echo "---------------------------------------------"
+echo ""
-case "$OS_TYPE" in
-arch)
- pacman -Sy --noconfirm --needed curl wget git jq openssl >/dev/null || true
- ;;
-alpine)
- sed -i '/^#.*\/community/s/^#//' /etc/apk/repositories
- apk update >/dev/null
- apk add curl wget git jq openssl >/dev/null
- ;;
-ubuntu | debian | raspbian)
- apt-get update -y >/dev/null
- apt-get install -y curl wget git jq openssl >/dev/null
- ;;
-centos | fedora | rhel | ol | rocky | almalinux | amzn)
- if [ "$OS_TYPE" = "amzn" ]; then
- dnf install -y wget git jq openssl >/dev/null
- else
- if ! command -v dnf >/dev/null; then
- yum install -y dnf >/dev/null
- fi
- if ! command -v curl >/dev/null; then
- dnf install -y curl >/dev/null
+log_section "Step 1/9: Installing required packages"
+echo "1/9 Installing required packages (curl, wget, git, jq, openssl)..."
+
+# Track if apt-get update was run to avoid redundant calls later
+APT_UPDATED=false
+
+if all_packages_installed; then
+ log "All required packages already installed, skipping installation"
+ echo " - All required packages already installed."
+else
+ case "$OS_TYPE" in
+ arch)
+ pacman -Sy --noconfirm --needed curl wget git jq openssl >/dev/null || true
+ ;;
+ alpine)
+ sed -i '/^#.*\/community/s/^#//' /etc/apk/repositories
+ apk update >/dev/null
+ apk add curl wget git jq openssl >/dev/null
+ ;;
+ ubuntu | debian | raspbian)
+ apt-get update -y >/dev/null
+ APT_UPDATED=true
+ apt-get install -y curl wget git jq openssl >/dev/null
+ ;;
+ centos | fedora | rhel | ol | rocky | almalinux | amzn)
+ if [ "$OS_TYPE" = "amzn" ]; then
+ dnf install -y wget git jq openssl >/dev/null
+ else
+ if ! command -v dnf >/dev/null; then
+ yum install -y dnf >/dev/null
+ fi
+ if ! command -v curl >/dev/null; then
+ dnf install -y curl >/dev/null
+ fi
+ dnf install -y wget git jq openssl >/dev/null
fi
- dnf install -y wget git jq openssl >/dev/null
- fi
- ;;
-sles | opensuse-leap | opensuse-tumbleweed)
- zypper refresh >/dev/null
- zypper install -y curl wget git jq openssl >/dev/null
- ;;
-*)
- echo "This script only supports Debian, Redhat, Arch Linux, or SLES based operating systems for now."
- exit
- ;;
-esac
+ ;;
+ sles | opensuse-leap | opensuse-tumbleweed)
+ zypper refresh >/dev/null
+ zypper install -y curl wget git jq openssl >/dev/null
+ ;;
+ *)
+ echo "This script only supports Debian, Redhat, Arch Linux, or SLES based operating systems for now."
+ exit
+ ;;
+ esac
+ log "Required packages installed successfully"
+fi
+echo " Done."
-echo -e "2. Check OpenSSH server configuration. "
+log_section "Step 2/9: Checking OpenSSH server configuration"
+echo "2/9 Checking OpenSSH server configuration..."
# Detect OpenSSH server
SSH_DETECTED=false
@@ -398,7 +443,10 @@ if [ "$SSH_DETECTED" = "false" ]; then
service sshd start >/dev/null 2>&1
;;
ubuntu | debian | raspbian)
- apt-get update -y >/dev/null
+ if [ "$APT_UPDATED" = false ]; then
+ apt-get update -y >/dev/null
+ APT_UPDATED=true
+ fi
apt-get install -y openssh-server >/dev/null
systemctl enable ssh >/dev/null 2>&1
systemctl start ssh >/dev/null 2>&1
@@ -465,7 +513,10 @@ install_docker() {
install_docker_manually() {
case "$OS_TYPE" in
"ubuntu" | "debian" | "raspbian")
- apt-get update
+ if [ "$APT_UPDATED" = false ]; then
+ apt-get update
+ APT_UPDATED=true
+ fi
apt-get install -y ca-certificates curl
install -m 0755 -d /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/$OS_TYPE/gpg -o /etc/apt/keyrings/docker.asc
@@ -491,7 +542,8 @@ install_docker_manually() {
echo "Docker installed successfully."
fi
}
-echo -e "3. Check Docker Installation. "
+log_section "Step 3/9: Checking Docker installation"
+echo "3/9 Checking Docker installation..."
if ! [ -x "$(command -v docker)" ]; then
echo " - Docker is not installed. Installing Docker. It may take a while."
getAJoke
@@ -575,7 +627,8 @@ else
echo " - Docker is installed."
fi
-echo -e "4. Check Docker Configuration. "
+log_section "Step 4/9: Checking Docker configuration"
+echo "4/9 Checking Docker configuration..."
echo " - Network pool configuration: ${DOCKER_ADDRESS_POOL_BASE}/${DOCKER_ADDRESS_POOL_SIZE}"
echo " - To override existing configuration: DOCKER_POOL_FORCE_OVERRIDE=true"
@@ -704,13 +757,38 @@ else
fi
fi
-echo -e "5. Download required files from CDN. "
-curl -fsSL -L $CDN/docker-compose.yml -o /data/coolify/source/docker-compose.yml
-curl -fsSL -L $CDN/docker-compose.prod.yml -o /data/coolify/source/docker-compose.prod.yml
-curl -fsSL -L $CDN/.env.production -o /data/coolify/source/.env.production
-curl -fsSL -L $CDN/upgrade.sh -o /data/coolify/source/upgrade.sh
+log_section "Step 5/9: Downloading required files from CDN"
+echo "5/9 Downloading required files from CDN..."
+log "Downloading configuration files in parallel..."
+
+# Download files in parallel for faster installation
+curl -fsSL -L $CDN/docker-compose.yml -o /data/coolify/source/docker-compose.yml &
+PID1=$!
+curl -fsSL -L $CDN/docker-compose.prod.yml -o /data/coolify/source/docker-compose.prod.yml &
+PID2=$!
+curl -fsSL -L $CDN/.env.production -o /data/coolify/source/.env.production &
+PID3=$!
+curl -fsSL -L $CDN/upgrade.sh -o /data/coolify/source/upgrade.sh &
+PID4=$!
+
+# Wait for all downloads to complete and check for errors
+DOWNLOAD_FAILED=false
+for PID in $PID1 $PID2 $PID3 $PID4; do
+ if ! wait $PID; then
+ DOWNLOAD_FAILED=true
+ fi
+done
+
+if [ "$DOWNLOAD_FAILED" = true ]; then
+ echo " - ERROR: One or more downloads failed. Please check your network connection."
+ exit 1
+fi
+
+log "All configuration files downloaded successfully"
+echo " Done."
-echo -e "6. Setting up environment variable file"
+log_section "Step 6/9: Setting up environment variable file"
+echo "6/9 Setting up environment variable file..."
if [ -f "$ENV_FILE" ]; then
# If .env exists, create backup
@@ -725,8 +803,11 @@ else
echo " - No .env file found, copying .env.production to .env"
cp "/data/coolify/source/.env.production" "$ENV_FILE"
fi
+log "Environment file setup completed"
+echo " Done."
-echo -e "7. Checking and updating environment variables if necessary..."
+log_section "Step 7/9: Checking and updating environment variables"
+echo "7/9 Checking and updating environment variables..."
update_env_var() {
local key="$1"
@@ -786,8 +867,11 @@ else
update_env_var "DOCKER_ADDRESS_POOL_SIZE" "$DOCKER_ADDRESS_POOL_SIZE"
fi
fi
+log "Environment variables check completed"
+echo " Done."
-echo -e "8. Checking for SSH key for localhost access."
+log_section "Step 8/9: Checking SSH key for localhost access"
+echo "8/9 Checking SSH key for localhost access..."
if [ ! -f ~/.ssh/authorized_keys ]; then
mkdir -p ~/.ssh
chmod 700 ~/.ssh
@@ -812,8 +896,11 @@ fi
chown -R 9999:root /data/coolify
chmod -R 700 /data/coolify
+log "SSH key check completed"
+echo " Done."
-echo -e "9. Installing Coolify ($LATEST_VERSION)"
+log_section "Step 9/9: Installing Coolify"
+echo "9/9 Installing Coolify ($LATEST_VERSION)..."
echo -e " - It could take a while based on your server's performance, network speed, stars, etc."
echo -e " - Please wait."
getAJoke
@@ -824,11 +911,85 @@ else
bash /data/coolify/source/upgrade.sh "${LATEST_VERSION:-latest}" "${LATEST_HELPER_VERSION:-latest}" "${REGISTRY_URL:-ghcr.io}" "true"
fi
echo " - Coolify installed successfully."
+echo " - Waiting for Coolify to be ready..."
+
+# Wait for upgrade.sh background process to complete
+# upgrade.sh writes status to /data/coolify/source/.upgrade-status
+# Status file format: step|message|timestamp
+# Step 6 = "Upgrade complete", file deleted 10 seconds after
+UPGRADE_STATUS_FILE="/data/coolify/source/.upgrade-status"
+MAX_WAIT=180
+WAITED=0
+SEEN_STATUS_FILE=false
+
+while [ $WAITED -lt $MAX_WAIT ]; do
+ if [ -f "$UPGRADE_STATUS_FILE" ]; then
+ SEEN_STATUS_FILE=true
+ STATUS=$(cat "$UPGRADE_STATUS_FILE" 2>/dev/null | cut -d'|' -f1)
+ MESSAGE=$(cat "$UPGRADE_STATUS_FILE" 2>/dev/null | cut -d'|' -f2)
+ if [ "$STATUS" = "6" ]; then
+ log "Upgrade completed: $MESSAGE"
+ echo " - Upgrade complete!"
+ break
+ elif [ "$STATUS" = "error" ]; then
+ echo " - ERROR: Upgrade failed: $MESSAGE"
+ echo " - Please check the upgrade logs: /data/coolify/source/upgrade-*.log"
+ exit 1
+ else
+ if [ $((WAITED % 10)) -eq 0 ]; then
+ echo " - Upgrade in progress: $MESSAGE (${WAITED}s)"
+ fi
+ fi
+ else
+ # Status file doesn't exist
+ if [ "$SEEN_STATUS_FILE" = true ]; then
+ # We saw the file before, now it's gone = upgrade completed and cleaned up
+ log "Upgrade status file cleaned up - upgrade complete"
+ echo " - Upgrade complete!"
+ break
+ fi
+ # Haven't seen status file yet - either very early or upgrade.sh hasn't started
+ if [ $((WAITED % 10)) -eq 0 ] && [ $WAITED -gt 0 ]; then
+ echo " - Waiting for upgrade process to start... (${WAITED}s)"
+ fi
+ fi
+ sleep 2
+ WAITED=$((WAITED + 2))
+done
+
+if [ $WAITED -ge $MAX_WAIT ]; then
+ if [ "$SEEN_STATUS_FILE" = false ]; then
+ # Never saw status file - fallback to old behavior (wait 20s + health check)
+ log "Status file not found, using fallback wait"
+ echo " - Status file not found, waiting 20 seconds..."
+ sleep 20
+ else
+ echo " - ERROR: Upgrade timed out after ${MAX_WAIT}s"
+ echo " - Please check the upgrade logs: /data/coolify/source/upgrade-*.log"
+ exit 1
+ fi
+fi
-echo " - Waiting 20 seconds for Coolify database migrations to complete."
-getAJoke
-
-sleep 20
+# Final health verification - wait for container to be healthy
+echo " - Verifying Coolify is healthy..."
+HEALTH_WAIT=60
+HEALTH_WAITED=0
+while [ $HEALTH_WAITED -lt $HEALTH_WAIT ]; do
+ HEALTH=$(docker inspect --format='{{.State.Health.Status}}' coolify 2>/dev/null || echo "unknown")
+ if [ "$HEALTH" = "healthy" ]; then
+ log "Coolify container is healthy"
+ echo " - Coolify is ready!"
+ break
+ fi
+ sleep 2
+ HEALTH_WAITED=$((HEALTH_WAITED + 2))
+done
+
+if [ "$HEALTH" != "healthy" ]; then
+ echo " - ERROR: Coolify container is not healthy after ${HEALTH_WAIT}s. Status: $HEALTH"
+ echo " - Please check: docker logs coolify"
+ exit 1
+fi
echo -e "\033[0;35m
____ _ _ _ _ _
/ ___|___ _ __ __ _ _ __ __ _| |_ _ _| | __ _| |_(_) ___ _ __ ___| |
@@ -838,8 +999,18 @@ echo -e "\033[0;35m
|___/
\033[0m"
-IPV4_PUBLIC_IP=$(curl -4s https://ifconfig.io || true)
-IPV6_PUBLIC_IP=$(curl -6s https://ifconfig.io || true)
+# Fetch public IPs in parallel for faster completion
+IPV4_TMP=$(mktemp)
+IPV6_TMP=$(mktemp)
+curl -4s --max-time 5 https://ifconfig.io > "$IPV4_TMP" 2>/dev/null &
+IPV4_PID=$!
+curl -6s --max-time 5 https://ifconfig.io > "$IPV6_TMP" 2>/dev/null &
+IPV6_PID=$!
+wait $IPV4_PID 2>/dev/null || true
+wait $IPV6_PID 2>/dev/null || true
+IPV4_PUBLIC_IP=$(cat "$IPV4_TMP" 2>/dev/null || true)
+IPV6_PUBLIC_IP=$(cat "$IPV6_TMP" 2>/dev/null || true)
+rm -f "$IPV4_TMP" "$IPV6_TMP"
echo -e "\nYour instance is ready to use!\n"
if [ -n "$IPV4_PUBLIC_IP" ]; then
@@ -864,3 +1035,8 @@ if [ -n "$PRIVATE_IPS" ]; then
fi
echo -e "\nWARNING: It is highly recommended to backup your Environment variables file (/data/coolify/source/.env) to a safe location, outside of this server (e.g. into a Password Manager).\n"
+
+log_section "Installation Complete"
+log "Coolify installation completed successfully"
+log "Version: ${LATEST_VERSION}"
+log "Log file: ${INSTALLATION_LOG_WITH_DATE}"
diff --git a/other/nightly/upgrade.sh b/other/nightly/upgrade.sh
index 0d38966477..a21d39e41c 100644
--- a/other/nightly/upgrade.sh
+++ b/other/nightly/upgrade.sh
@@ -7,27 +7,101 @@ LATEST_HELPER_VERSION=${2:-latest}
REGISTRY_URL=${3:-ghcr.io}
SKIP_BACKUP=${4:-false}
ENV_FILE="/data/coolify/source/.env"
+STATUS_FILE="/data/coolify/source/.upgrade-status"
DATE=$(date +%Y-%m-%d-%H-%M-%S)
LOGFILE="/data/coolify/source/upgrade-${DATE}.log"
-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
+# Helper function to log with timestamp
+log() {
+ echo "[$(date '+%Y-%m-%d %H:%M:%S')] $1" >>"$LOGFILE"
+}
+
+# Helper function to log section headers
+log_section() {
+ echo "" >>"$LOGFILE"
+ echo "============================================================" >>"$LOGFILE"
+ echo "[$(date '+%Y-%m-%d %H:%M:%S')] $1" >>"$LOGFILE"
+ echo "============================================================" >>"$LOGFILE"
+}
+
+# Helper function to write upgrade status for API polling
+write_status() {
+ local step="$1"
+ local message="$2"
+ echo "${step}|${message}|$(date -Iseconds)" > "$STATUS_FILE"
+}
+
+echo ""
+echo "=========================================="
+echo " Coolify Upgrade - ${DATE}"
+echo "=========================================="
+echo ""
+
+# Initialize log file with header
+echo "============================================================" >>"$LOGFILE"
+echo "Coolify Upgrade Log" >>"$LOGFILE"
+echo "Started: $(date '+%Y-%m-%d %H:%M:%S')" >>"$LOGFILE"
+echo "Target Version: ${LATEST_IMAGE}" >>"$LOGFILE"
+echo "Helper Version: ${LATEST_HELPER_VERSION}" >>"$LOGFILE"
+echo "Registry URL: ${REGISTRY_URL}" >>"$LOGFILE"
+echo "============================================================" >>"$LOGFILE"
+
+log_section "Step 1/6: Downloading configuration files"
+write_status "1" "Downloading configuration files"
+echo "1/6 Downloading latest configuration files..."
+log "Downloading docker-compose.yml from ${CDN}/docker-compose.yml"
+curl -fsSL -L $CDN/docker-compose.yml -o /data/coolify/source/docker-compose.yml
+log "Downloading docker-compose.prod.yml from ${CDN}/docker-compose.prod.yml"
+curl -fsSL -L $CDN/docker-compose.prod.yml -o /data/coolify/source/docker-compose.prod.yml
+log "Downloading .env.production from ${CDN}/.env.production"
+curl -fsSL -L $CDN/.env.production -o /data/coolify/source/.env.production
+log "Configuration files downloaded successfully"
+echo " Done."
+
+# Extract all images from docker-compose configuration
+log "Extracting all images from docker-compose configuration..."
+COMPOSE_FILES="-f /data/coolify/source/docker-compose.yml -f /data/coolify/source/docker-compose.prod.yml"
+
+# Check if custom compose file exists
+if [ -f /data/coolify/source/docker-compose.custom.yml ]; then
+ COMPOSE_FILES="$COMPOSE_FILES -f /data/coolify/source/docker-compose.custom.yml"
+ log "Including custom docker-compose.yml in image extraction"
+fi
+
+# Get all unique images from docker compose config
+# LATEST_IMAGE env var is needed for image substitution in compose files
+IMAGES=$(LATEST_IMAGE=${LATEST_IMAGE} docker compose --env-file "$ENV_FILE" $COMPOSE_FILES config --images 2>/dev/null | sort -u)
+
+if [ -z "$IMAGES" ]; then
+ log "ERROR: Failed to extract images from docker-compose files"
+ write_status "error" "Failed to parse docker-compose configuration"
+ echo " ERROR: Failed to parse docker-compose configuration. Aborting upgrade."
+ exit 1
+fi
+
+log "Images to pull:"
+echo "$IMAGES" | while read img; do log " - $img"; done
# Backup existing .env file before making any changes
if [ "$SKIP_BACKUP" != "true" ]; then
if [ -f "$ENV_FILE" ]; then
- echo "Creating backup of existing .env file to .env-$DATE" >>"$LOGFILE"
+ echo " Creating backup of .env file..."
+ log "Creating backup of .env file to .env-$DATE"
cp "$ENV_FILE" "$ENV_FILE-$DATE"
+ log "Backup created: ${ENV_FILE}-${DATE}"
else
- echo "No existing .env file found to backup" >>"$LOGFILE"
+ log "WARNING: No existing .env file found to backup"
fi
fi
-echo "Merging .env.production values into .env" >>"$LOGFILE"
+log_section "Step 2/6: Updating environment configuration"
+write_status "2" "Updating environment configuration"
+echo ""
+echo "2/6 Updating environment configuration..."
+log "Merging .env.production values into .env"
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"
+log "Environment file merged successfully"
update_env_var() {
local key="$1"
@@ -36,73 +110,173 @@ update_env_var() {
# If variable "key=" exists but has no value, update the value of the existing line
if grep -q "^${key}=$" "$ENV_FILE"; then
sed -i "s|^${key}=$|${key}=${value}|" "$ENV_FILE"
- echo " - Updated value of ${key} as the current value was empty" >>"$LOGFILE"
+ log "Updated ${key} (was empty)"
# If variable "key=" doesn't exist, append it to the file with value
elif ! grep -q "^${key}=" "$ENV_FILE"; then
printf '%s=%s\n' "$key" "$value" >>"$ENV_FILE"
- echo " - Added ${key} with default value as the variable was missing" >>"$LOGFILE"
+ log "Added ${key} (was missing)"
fi
}
-echo "Checking and updating environment variables if necessary..." >>"$LOGFILE"
+log "Checking environment variables..."
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)"
+log "Environment variables check complete"
+echo " Done."
# Make sure coolify network exists
# It is created when starting Coolify with docker compose
+log "Checking Docker network 'coolify'..."
if ! docker network inspect coolify >/dev/null 2>&1; then
+ log "Network 'coolify' does not exist, creating..."
if ! docker network create --attachable --ipv6 coolify 2>/dev/null; then
- echo "Failed to create coolify network with ipv6. Trying without ipv6..."
+ log "Failed to create network with IPv6, trying without IPv6..."
docker network create --attachable coolify 2>/dev/null
+ log "Network 'coolify' created without IPv6"
+ else
+ log "Network 'coolify' created with IPv6 support"
fi
+else
+ log "Network 'coolify' already exists"
fi
# Check if Docker config file exists
DOCKER_CONFIG_MOUNT=""
if [ -f /root/.docker/config.json ]; then
DOCKER_CONFIG_MOUNT="-v /root/.docker/config.json:/root/.docker/config.json"
+ log "Docker config mount enabled: /root/.docker/config.json"
+fi
+
+log_section "Step 3/6: Pulling Docker images"
+write_status "3" "Pulling Docker images"
+echo ""
+echo "3/6 Pulling Docker images..."
+echo " This may take a few minutes depending on your connection."
+
+# Also pull the helper image (not in compose files but needed for upgrade)
+HELPER_IMAGE="${REGISTRY_URL:-ghcr.io}/coollabsio/coolify-helper:${LATEST_HELPER_VERSION}"
+echo " - Pulling $HELPER_IMAGE..."
+log "Pulling image: $HELPER_IMAGE"
+if docker pull "$HELPER_IMAGE" >>"$LOGFILE" 2>&1; then
+ log "Successfully pulled $HELPER_IMAGE"
+else
+ log "ERROR: Failed to pull $HELPER_IMAGE"
+ write_status "error" "Failed to pull $HELPER_IMAGE"
+ echo " ERROR: Failed to pull $HELPER_IMAGE. Aborting upgrade."
+ exit 1
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 "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 "All images pulled successfully." >>"$LOGFILE"
-
-# Stop and remove existing Coolify containers to prevent conflicts
-# This handles both old installations (project "source") and new ones (project "coolify")
-# Use nohup to ensure the script continues even if SSH connection is lost
-echo "Starting container restart sequence (detached)..." >>"$LOGFILE"
+# Pull all images from compose config
+# Using a for loop to avoid subshell issues with exit
+for IMAGE in $IMAGES; do
+ if [ -n "$IMAGE" ]; then
+ echo " - Pulling $IMAGE..."
+ log "Pulling image: $IMAGE"
+ if docker pull "$IMAGE" >>"$LOGFILE" 2>&1; then
+ log "Successfully pulled $IMAGE"
+ else
+ log "ERROR: Failed to pull $IMAGE"
+ write_status "error" "Failed to pull $IMAGE"
+ echo " ERROR: Failed to pull $IMAGE. Aborting upgrade."
+ exit 1
+ fi
+ fi
+done
+
+log "All images pulled successfully"
+echo " All images pulled successfully."
+
+log_section "Step 4/6: Stopping and restarting containers"
+write_status "4" "Stopping containers"
+echo ""
+echo "4/6 Stopping containers and starting new ones..."
+echo " This step will restart all Coolify containers."
+echo " Check the log file for details: ${LOGFILE}"
+
+# From this point forward, we need to ensure the script continues even if
+# the SSH connection is lost (which happens when coolify container stops)
+# We use a subshell with nohup to ensure completion
+log "Starting container restart sequence (detached)..."
nohup bash -c "
LOGFILE='$LOGFILE'
+ STATUS_FILE='$STATUS_FILE'
DOCKER_CONFIG_MOUNT='$DOCKER_CONFIG_MOUNT'
REGISTRY_URL='$REGISTRY_URL'
LATEST_HELPER_VERSION='$LATEST_HELPER_VERSION'
LATEST_IMAGE='$LATEST_IMAGE'
+ log() {
+ echo \"[\$(date '+%Y-%m-%d %H:%M:%S')] \$1\" >>\"\$LOGFILE\"
+ }
+
+ write_status() {
+ echo \"\$1|\$2|\$(date -Iseconds)\" > \"\$STATUS_FILE\"
+ }
+
# Stop and remove containers
- echo 'Stopping existing Coolify containers...' >>\"\$LOGFILE\"
for container in coolify coolify-db coolify-redis coolify-realtime; do
if docker ps -a --format '{{.Names}}' | grep -q \"^\${container}\$\"; then
+ log \"Stopping container: \${container}\"
docker stop \"\$container\" >>\"\$LOGFILE\" 2>&1 || true
+ log \"Removing container: \${container}\"
docker rm \"\$container\" >>\"\$LOGFILE\" 2>&1 || true
- echo \" - Removed container: \$container\" >>\"\$LOGFILE\"
+ log \"Container \${container} stopped and removed\"
+ else
+ log \"Container \${container} not found (skipping)\"
fi
done
+ log \"Container cleanup complete\"
# Start new containers
+ echo '' >>\"\$LOGFILE\"
+ echo '============================================================' >>\"\$LOGFILE\"
+ log 'Step 5/6: Starting new containers'
+ echo '============================================================' >>\"\$LOGFILE\"
+ write_status '5' 'Starting new containers'
+
if [ -f /data/coolify/source/docker-compose.custom.yml ]; then
- 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>&1
+ log 'Using custom docker-compose.yml'
+ log 'Running docker compose up with custom configuration...'
+ 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 --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>&1
else
- 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 up -d --remove-orphans --wait --wait-timeout 60\" >>\"\$LOGFILE\" 2>&1
+ log 'Using standard docker-compose configuration'
+ log 'Running docker compose up...'
+ 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 --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>&1
fi
- echo 'Upgrade completed.' >>\"\$LOGFILE\"
+ log 'Docker compose up completed'
+
+ # Final log entry
+ echo '' >>\"\$LOGFILE\"
+ echo '============================================================' >>\"\$LOGFILE\"
+ log 'Step 6/6: Upgrade complete'
+ echo '============================================================' >>\"\$LOGFILE\"
+ write_status '6' 'Upgrade complete'
+ log 'Coolify upgrade completed successfully'
+ log \"Version: \${LATEST_IMAGE}\"
+ echo '' >>\"\$LOGFILE\"
+ echo '============================================================' >>\"\$LOGFILE\"
+ echo \"Upgrade completed: \$(date '+%Y-%m-%d %H:%M:%S')\" >>\"\$LOGFILE\"
+ echo '============================================================' >>\"\$LOGFILE\"
+
+ # Clean up status file after a short delay to allow frontend to read completion
+ sleep 10
+ rm -f \"\$STATUS_FILE\"
+ log 'Status file cleaned up'
" >>"$LOGFILE" 2>&1 &
+
+# Give the background process a moment to start
+sleep 2
+log "Container restart sequence started in background (PID: $!)"
+echo ""
+echo "5/6 Containers are being restarted in the background..."
+echo "6/6 Upgrade process initiated!"
+echo ""
+echo "=========================================="
+echo " Coolify upgrade to ${LATEST_IMAGE} in progress"
+echo "=========================================="
+echo ""
+echo " The upgrade will continue in the background."
+echo " Coolify will be available again shortly."
+echo " Log file: ${LOGFILE}"
diff --git a/other/nightly/versions.json b/other/nightly/versions.json
index 94c23ede4f..fa31114cde 100644
--- a/other/nightly/versions.json
+++ b/other/nightly/versions.json
@@ -1,7 +1,7 @@
{
"coolify": {
"v4": {
- "version": "4.0.0-beta.455"
+ "version": "4.0.0-beta.454"
},
"nightly": {
"version": "4.0.0-beta.456"
@@ -17,13 +17,13 @@
}
},
"traefik": {
- "v3.6": "3.6.1",
+ "v3.6": "3.6.5",
"v3.5": "3.5.6",
"v3.4": "3.4.5",
"v3.3": "3.3.7",
"v3.2": "3.2.5",
"v3.1": "3.1.7",
"v3.0": "3.0.4",
- "v2.11": "2.11.31"
+ "v2.11": "2.11.32"
}
}
\ No newline at end of file
diff --git a/scripts/install.sh b/scripts/install.sh
index c06b26effd..d849509aa0 100755
--- a/scripts/install.sh
+++ b/scripts/install.sh
@@ -29,9 +29,14 @@ if [ $EUID != 0 ]; then
exit
fi
-echo -e "Welcome to Coolify Installer!"
-echo -e "This script will install everything for you. Sit back and relax."
-echo -e "Source code: https://github.com/coollabsio/coolify/blob/v4.x/scripts/install.sh"
+echo ""
+echo "=========================================="
+echo " Coolify Installation - ${DATE}"
+echo "=========================================="
+echo ""
+echo "Welcome to Coolify Installer!"
+echo "This script will install everything for you. Sit back and relax."
+echo "Source code: https://github.com/coollabsio/coolify/blob/v4.x/scripts/install.sh"
# Predefined root user
ROOT_USERNAME=${ROOT_USERNAME:-}
@@ -242,6 +247,29 @@ getAJoke() {
fi
}
+# Helper function to log with timestamp
+log() {
+ echo "[$(date '+%Y-%m-%d %H:%M:%S')] $1"
+}
+
+# Helper function to log section headers
+log_section() {
+ echo ""
+ echo "============================================================"
+ echo "[$(date '+%Y-%m-%d %H:%M:%S')] $1"
+ echo "============================================================"
+}
+
+# Helper function to check if all required packages are installed
+all_packages_installed() {
+ for pkg in curl wget git jq openssl; do
+ if ! command -v "$pkg" >/dev/null 2>&1; then
+ return 1
+ fi
+ done
+ return 0
+}
+
# Check if the OS is manjaro, if so, change it to arch
if [ "$OS_TYPE" = "manjaro" ] || [ "$OS_TYPE" = "manjaro-arm" ]; then
OS_TYPE="arch"
@@ -288,9 +316,11 @@ if [ "$OS_TYPE" = 'amzn' ]; then
dnf install -y findutils >/dev/null
fi
-LATEST_VERSION=$(curl -L --silent $CDN/versions.json | grep -i version | xargs | awk '{print $2}' | tr -d ',')
-LATEST_HELPER_VERSION=$(curl -L --silent $CDN/versions.json | grep -i version | xargs | awk '{print $6}' | tr -d ',')
-LATEST_REALTIME_VERSION=$(curl -L --silent $CDN/versions.json | grep -i version | xargs | awk '{print $8}' | tr -d ',')
+# Fetch versions.json once and parse all values from it
+VERSIONS_JSON=$(curl -L --silent $CDN/versions.json)
+LATEST_VERSION=$(echo "$VERSIONS_JSON" | grep -i version | xargs | awk '{print $2}' | tr -d ',')
+LATEST_HELPER_VERSION=$(echo "$VERSIONS_JSON" | grep -i version | xargs | awk '{print $6}' | tr -d ',')
+LATEST_REALTIME_VERSION=$(echo "$VERSIONS_JSON" | grep -i version | xargs | awk '{print $8}' | tr -d ',')
if [ -z "$LATEST_HELPER_VERSION" ]; then
LATEST_HELPER_VERSION=latest
@@ -315,7 +345,7 @@ if [ "$1" != "" ]; then
LATEST_VERSION="${LATEST_VERSION#v}"
fi
-echo -e "---------------------------------------------"
+echo "---------------------------------------------"
echo "| Operating System | $OS_TYPE $OS_VERSION"
echo "| Docker | $DOCKER_VERSION"
echo "| Coolify | $LATEST_VERSION"
@@ -323,46 +353,61 @@ echo "| Helper | $LATEST_HELPER_VERSION"
echo "| Realtime | $LATEST_REALTIME_VERSION"
echo "| Docker Pool | $DOCKER_ADDRESS_POOL_BASE (size $DOCKER_ADDRESS_POOL_SIZE)"
echo "| Registry URL | $REGISTRY_URL"
-echo -e "---------------------------------------------\n"
-echo -e "1. Installing required packages (curl, wget, git, jq, openssl). "
+echo "---------------------------------------------"
+echo ""
-case "$OS_TYPE" in
-arch)
- pacman -Sy --noconfirm --needed curl wget git jq openssl >/dev/null || true
- ;;
-alpine)
- sed -i '/^#.*\/community/s/^#//' /etc/apk/repositories
- apk update >/dev/null
- apk add curl wget git jq openssl >/dev/null
- ;;
-ubuntu | debian | raspbian)
- apt-get update -y >/dev/null
- apt-get install -y curl wget git jq openssl >/dev/null
- ;;
-centos | fedora | rhel | ol | rocky | almalinux | amzn)
- if [ "$OS_TYPE" = "amzn" ]; then
- dnf install -y wget git jq openssl >/dev/null
- else
- if ! command -v dnf >/dev/null; then
- yum install -y dnf >/dev/null
- fi
- if ! command -v curl >/dev/null; then
- dnf install -y curl >/dev/null
+log_section "Step 1/9: Installing required packages"
+echo "1/9 Installing required packages (curl, wget, git, jq, openssl)..."
+
+# Track if apt-get update was run to avoid redundant calls later
+APT_UPDATED=false
+
+if all_packages_installed; then
+ log "All required packages already installed, skipping installation"
+ echo " - All required packages already installed."
+else
+ case "$OS_TYPE" in
+ arch)
+ pacman -Sy --noconfirm --needed curl wget git jq openssl >/dev/null || true
+ ;;
+ alpine)
+ sed -i '/^#.*\/community/s/^#//' /etc/apk/repositories
+ apk update >/dev/null
+ apk add curl wget git jq openssl >/dev/null
+ ;;
+ ubuntu | debian | raspbian)
+ apt-get update -y >/dev/null
+ APT_UPDATED=true
+ apt-get install -y curl wget git jq openssl >/dev/null
+ ;;
+ centos | fedora | rhel | ol | rocky | almalinux | amzn)
+ if [ "$OS_TYPE" = "amzn" ]; then
+ dnf install -y wget git jq openssl >/dev/null
+ else
+ if ! command -v dnf >/dev/null; then
+ yum install -y dnf >/dev/null
+ fi
+ if ! command -v curl >/dev/null; then
+ dnf install -y curl >/dev/null
+ fi
+ dnf install -y wget git jq openssl >/dev/null
fi
- dnf install -y wget git jq openssl >/dev/null
- fi
- ;;
-sles | opensuse-leap | opensuse-tumbleweed)
- zypper refresh >/dev/null
- zypper install -y curl wget git jq openssl >/dev/null
- ;;
-*)
- echo "This script only supports Debian, Redhat, Arch Linux, or SLES based operating systems for now."
- exit
- ;;
-esac
+ ;;
+ sles | opensuse-leap | opensuse-tumbleweed)
+ zypper refresh >/dev/null
+ zypper install -y curl wget git jq openssl >/dev/null
+ ;;
+ *)
+ echo "This script only supports Debian, Redhat, Arch Linux, or SLES based operating systems for now."
+ exit
+ ;;
+ esac
+ log "Required packages installed successfully"
+fi
+echo " Done."
-echo -e "2. Check OpenSSH server configuration. "
+log_section "Step 2/9: Checking OpenSSH server configuration"
+echo "2/9 Checking OpenSSH server configuration..."
# Detect OpenSSH server
SSH_DETECTED=false
@@ -398,7 +443,10 @@ if [ "$SSH_DETECTED" = "false" ]; then
service sshd start >/dev/null 2>&1
;;
ubuntu | debian | raspbian)
- apt-get update -y >/dev/null
+ if [ "$APT_UPDATED" = false ]; then
+ apt-get update -y >/dev/null
+ APT_UPDATED=true
+ fi
apt-get install -y openssh-server >/dev/null
systemctl enable ssh >/dev/null 2>&1
systemctl start ssh >/dev/null 2>&1
@@ -465,7 +513,10 @@ install_docker() {
install_docker_manually() {
case "$OS_TYPE" in
"ubuntu" | "debian" | "raspbian")
- apt-get update
+ if [ "$APT_UPDATED" = false ]; then
+ apt-get update
+ APT_UPDATED=true
+ fi
apt-get install -y ca-certificates curl
install -m 0755 -d /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/$OS_TYPE/gpg -o /etc/apt/keyrings/docker.asc
@@ -491,7 +542,8 @@ install_docker_manually() {
echo "Docker installed successfully."
fi
}
-echo -e "3. Check Docker Installation. "
+log_section "Step 3/9: Checking Docker installation"
+echo "3/9 Checking Docker installation..."
if ! [ -x "$(command -v docker)" ]; then
echo " - Docker is not installed. Installing Docker. It may take a while."
getAJoke
@@ -575,7 +627,8 @@ else
echo " - Docker is installed."
fi
-echo -e "4. Check Docker Configuration. "
+log_section "Step 4/9: Checking Docker configuration"
+echo "4/9 Checking Docker configuration..."
echo " - Network pool configuration: ${DOCKER_ADDRESS_POOL_BASE}/${DOCKER_ADDRESS_POOL_SIZE}"
echo " - To override existing configuration: DOCKER_POOL_FORCE_OVERRIDE=true"
@@ -704,13 +757,38 @@ else
fi
fi
-echo -e "5. Download required files from CDN. "
-curl -fsSL -L $CDN/docker-compose.yml -o /data/coolify/source/docker-compose.yml
-curl -fsSL -L $CDN/docker-compose.prod.yml -o /data/coolify/source/docker-compose.prod.yml
-curl -fsSL -L $CDN/.env.production -o /data/coolify/source/.env.production
-curl -fsSL -L $CDN/upgrade.sh -o /data/coolify/source/upgrade.sh
+log_section "Step 5/9: Downloading required files from CDN"
+echo "5/9 Downloading required files from CDN..."
+log "Downloading configuration files in parallel..."
+
+# Download files in parallel for faster installation
+curl -fsSL -L $CDN/docker-compose.yml -o /data/coolify/source/docker-compose.yml &
+PID1=$!
+curl -fsSL -L $CDN/docker-compose.prod.yml -o /data/coolify/source/docker-compose.prod.yml &
+PID2=$!
+curl -fsSL -L $CDN/.env.production -o /data/coolify/source/.env.production &
+PID3=$!
+curl -fsSL -L $CDN/upgrade.sh -o /data/coolify/source/upgrade.sh &
+PID4=$!
+
+# Wait for all downloads to complete and check for errors
+DOWNLOAD_FAILED=false
+for PID in $PID1 $PID2 $PID3 $PID4; do
+ if ! wait $PID; then
+ DOWNLOAD_FAILED=true
+ fi
+done
+
+if [ "$DOWNLOAD_FAILED" = true ]; then
+ echo " - ERROR: One or more downloads failed. Please check your network connection."
+ exit 1
+fi
+
+log "All configuration files downloaded successfully"
+echo " Done."
-echo -e "6. Setting up environment variable file"
+log_section "Step 6/9: Setting up environment variable file"
+echo "6/9 Setting up environment variable file..."
if [ -f "$ENV_FILE" ]; then
# If .env exists, create backup
@@ -725,8 +803,11 @@ else
echo " - No .env file found, copying .env.production to .env"
cp "/data/coolify/source/.env.production" "$ENV_FILE"
fi
+log "Environment file setup completed"
+echo " Done."
-echo -e "7. Checking and updating environment variables if necessary..."
+log_section "Step 7/9: Checking and updating environment variables"
+echo "7/9 Checking and updating environment variables..."
update_env_var() {
local key="$1"
@@ -786,8 +867,11 @@ else
update_env_var "DOCKER_ADDRESS_POOL_SIZE" "$DOCKER_ADDRESS_POOL_SIZE"
fi
fi
+log "Environment variables check completed"
+echo " Done."
-echo -e "8. Checking for SSH key for localhost access."
+log_section "Step 8/9: Checking SSH key for localhost access"
+echo "8/9 Checking SSH key for localhost access..."
if [ ! -f ~/.ssh/authorized_keys ]; then
mkdir -p ~/.ssh
chmod 700 ~/.ssh
@@ -812,8 +896,11 @@ fi
chown -R 9999:root /data/coolify
chmod -R 700 /data/coolify
+log "SSH key check completed"
+echo " Done."
-echo -e "9. Installing Coolify ($LATEST_VERSION)"
+log_section "Step 9/9: Installing Coolify"
+echo "9/9 Installing Coolify ($LATEST_VERSION)..."
echo -e " - It could take a while based on your server's performance, network speed, stars, etc."
echo -e " - Please wait."
getAJoke
@@ -824,11 +911,85 @@ else
bash /data/coolify/source/upgrade.sh "${LATEST_VERSION:-latest}" "${LATEST_HELPER_VERSION:-latest}" "${REGISTRY_URL:-ghcr.io}" "true"
fi
echo " - Coolify installed successfully."
+echo " - Waiting for Coolify to be ready..."
+
+# Wait for upgrade.sh background process to complete
+# upgrade.sh writes status to /data/coolify/source/.upgrade-status
+# Status file format: step|message|timestamp
+# Step 6 = "Upgrade complete", file deleted 10 seconds after
+UPGRADE_STATUS_FILE="/data/coolify/source/.upgrade-status"
+MAX_WAIT=180
+WAITED=0
+SEEN_STATUS_FILE=false
+
+while [ $WAITED -lt $MAX_WAIT ]; do
+ if [ -f "$UPGRADE_STATUS_FILE" ]; then
+ SEEN_STATUS_FILE=true
+ STATUS=$(cat "$UPGRADE_STATUS_FILE" 2>/dev/null | cut -d'|' -f1)
+ MESSAGE=$(cat "$UPGRADE_STATUS_FILE" 2>/dev/null | cut -d'|' -f2)
+ if [ "$STATUS" = "6" ]; then
+ log "Upgrade completed: $MESSAGE"
+ echo " - Upgrade complete!"
+ break
+ elif [ "$STATUS" = "error" ]; then
+ echo " - ERROR: Upgrade failed: $MESSAGE"
+ echo " - Please check the upgrade logs: /data/coolify/source/upgrade-*.log"
+ exit 1
+ else
+ if [ $((WAITED % 10)) -eq 0 ]; then
+ echo " - Upgrade in progress: $MESSAGE (${WAITED}s)"
+ fi
+ fi
+ else
+ # Status file doesn't exist
+ if [ "$SEEN_STATUS_FILE" = true ]; then
+ # We saw the file before, now it's gone = upgrade completed and cleaned up
+ log "Upgrade status file cleaned up - upgrade complete"
+ echo " - Upgrade complete!"
+ break
+ fi
+ # Haven't seen status file yet - either very early or upgrade.sh hasn't started
+ if [ $((WAITED % 10)) -eq 0 ] && [ $WAITED -gt 0 ]; then
+ echo " - Waiting for upgrade process to start... (${WAITED}s)"
+ fi
+ fi
+ sleep 2
+ WAITED=$((WAITED + 2))
+done
+
+if [ $WAITED -ge $MAX_WAIT ]; then
+ if [ "$SEEN_STATUS_FILE" = false ]; then
+ # Never saw status file - fallback to old behavior (wait 20s + health check)
+ log "Status file not found, using fallback wait"
+ echo " - Status file not found, waiting 20 seconds..."
+ sleep 20
+ else
+ echo " - ERROR: Upgrade timed out after ${MAX_WAIT}s"
+ echo " - Please check the upgrade logs: /data/coolify/source/upgrade-*.log"
+ exit 1
+ fi
+fi
-echo " - Waiting 20 seconds for Coolify database migrations to complete."
-getAJoke
-
-sleep 20
+# Final health verification - wait for container to be healthy
+echo " - Verifying Coolify is healthy..."
+HEALTH_WAIT=60
+HEALTH_WAITED=0
+while [ $HEALTH_WAITED -lt $HEALTH_WAIT ]; do
+ HEALTH=$(docker inspect --format='{{.State.Health.Status}}' coolify 2>/dev/null || echo "unknown")
+ if [ "$HEALTH" = "healthy" ]; then
+ log "Coolify container is healthy"
+ echo " - Coolify is ready!"
+ break
+ fi
+ sleep 2
+ HEALTH_WAITED=$((HEALTH_WAITED + 2))
+done
+
+if [ "$HEALTH" != "healthy" ]; then
+ echo " - ERROR: Coolify container is not healthy after ${HEALTH_WAIT}s. Status: $HEALTH"
+ echo " - Please check: docker logs coolify"
+ exit 1
+fi
echo -e "\033[0;35m
____ _ _ _ _ _
/ ___|___ _ __ __ _ _ __ __ _| |_ _ _| | __ _| |_(_) ___ _ __ ___| |
@@ -838,8 +999,18 @@ echo -e "\033[0;35m
|___/
\033[0m"
-IPV4_PUBLIC_IP=$(curl -4s https://ifconfig.io || true)
-IPV6_PUBLIC_IP=$(curl -6s https://ifconfig.io || true)
+# Fetch public IPs in parallel for faster completion
+IPV4_TMP=$(mktemp)
+IPV6_TMP=$(mktemp)
+curl -4s --max-time 5 https://ifconfig.io > "$IPV4_TMP" 2>/dev/null &
+IPV4_PID=$!
+curl -6s --max-time 5 https://ifconfig.io > "$IPV6_TMP" 2>/dev/null &
+IPV6_PID=$!
+wait $IPV4_PID 2>/dev/null || true
+wait $IPV6_PID 2>/dev/null || true
+IPV4_PUBLIC_IP=$(cat "$IPV4_TMP" 2>/dev/null || true)
+IPV6_PUBLIC_IP=$(cat "$IPV6_TMP" 2>/dev/null || true)
+rm -f "$IPV4_TMP" "$IPV6_TMP"
echo -e "\nYour instance is ready to use!\n"
if [ -n "$IPV4_PUBLIC_IP" ]; then
@@ -864,3 +1035,8 @@ if [ -n "$PRIVATE_IPS" ]; then
fi
echo -e "\nWARNING: It is highly recommended to backup your Environment variables file (/data/coolify/source/.env) to a safe location, outside of this server (e.g. into a Password Manager).\n"
+
+log_section "Installation Complete"
+log "Coolify installation completed successfully"
+log "Version: ${LATEST_VERSION}"
+log "Log file: ${INSTALLATION_LOG_WITH_DATE}"
diff --git a/versions.json b/versions.json
index 94c23ede4f..276565c50d 100644
--- a/versions.json
+++ b/versions.json
@@ -17,13 +17,13 @@
}
},
"traefik": {
- "v3.6": "3.6.1",
+ "v3.6": "3.6.5",
"v3.5": "3.5.6",
"v3.4": "3.4.5",
"v3.3": "3.3.7",
"v3.2": "3.2.5",
"v3.1": "3.1.7",
"v3.0": "3.0.4",
- "v2.11": "2.11.31"
+ "v2.11": "2.11.32"
}
}
\ No newline at end of file