diff --git a/scripts/install.sh b/scripts/install.sh index f3da68f3e..dd03bcac7 100644 --- a/scripts/install.sh +++ b/scripts/install.sh @@ -12,6 +12,7 @@ CDN="https://cdn.coollabs.io/coolify" OS_TYPE=$(cat /etc/os-release | grep -w "ID" | cut -d "=" -f 2 | tr -d '"') OS_VERSION=$(cat /etc/os-release | grep -w "VERSION_ID" | cut -d "=" -f 2 | tr -d '"') LATEST_VERSION=$(curl --silent $CDN/versions.json | grep -i version | sed -n '2p' | xargs | awk '{print $2}' | tr -d ',') +DATE=$(date +"%Y%m%d-%H%M%S") if [ $EUID != 0 ]; then echo "Please run as root" @@ -43,10 +44,10 @@ if ! [ -x "$(command -v docker)" ]; then echo "Docker installed successfully" fi echo -e "-------------" -echo -e "Configuring Docker..." +echo -e "Check Docker Configuration..." mkdir -p /etc/docker -test -s /etc/docker/daemon.json && cp /etc/docker/daemon.json /etc/docker/daemon.json.original-$(date +"%Y%m%d-%H%M%S") || cat >/etc/docker/daemon.json </etc/docker/daemon.json </etc/docker/daemon.json.coolify </etc/docker/daemon.json.coolify cat <<<$(jq -s '.[0] * .[1]' /etc/docker/daemon.json /etc/docker/daemon.json.coolify) >/etc/docker/daemon.json -systemctl restart docker +DIFF=$(diff <(jq --sort-keys . /etc/docker/daemon.json) <(jq --sort-keys . /etc/docker/daemon.json.original-$DATE)) +if [ "$DIFF" != "" ]; then + echo "Docker configuration updated, restart docker daemon..." + systemctl restart docker +else + echo "Docker configuration is up to date." +fi + echo -e "-------------" mkdir -p /data/coolify/deployments diff --git a/scripts/upgrade.sh b/scripts/upgrade.sh index 2dc7f9ae4..97874c20c 100644 --- a/scripts/upgrade.sh +++ b/scripts/upgrade.sh @@ -15,4 +15,4 @@ curl -fsSL $CDN/.env.production -o /data/coolify/source/.env.production # Merge .env and .env.production. New values will be added to .env sort -u -t '=' -k 1,1 /data/coolify/source/.env /data/coolify/source/.env.production | sed '/^$/d' > /data/coolify/source/.env.temp && mv /data/coolify/source/.env.temp /data/coolify/source/.env -docker run --pull always -v /data/coolify/source:/data/coolify/source -v /var/run/docker.sock:/var/run/docker.sock --rm ghcr.io/coollabsio/coolify-builder bash -c "LATEST_IMAGE=${1:-} 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 --pull always --force-recreate" \ No newline at end of file +docker run --pull always -v /data/coolify/source:/data/coolify/source -v /var/run/docker.sock:/var/run/docker.sock --rm ghcr.io/coollabsio/coolify-builder bash -c "LATEST_IMAGE=${1:-} 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 --pull always --remove-orphans --force-recreate" \ No newline at end of file