lasthourcloud/scripts/upgrade.sh

37 lines
2.3 KiB
Bash
Raw Normal View History

2023-04-27 10:52:13 +00:00
#!/bin/bash
## Do not modify this file. You will lose the ability to autoupdate!
2023-04-28 12:39:14 +00:00
2024-06-04 19:57:00 +00:00
VERSION="1.0.5"
2023-06-06 07:22:48 +00:00
CDN="https://cdn.coollabs.io/coolify"
2023-04-27 12:45:45 +00:00
# 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
2023-05-25 13:47:27 +00:00
2023-06-12 12:48:21 +00:00
# Merge .env and .env.production. New values will be added to .env
2023-12-04 20:37:30 +00:00
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
# Check if PUSHER_APP_ID or PUSHER_APP_KEY or PUSHER_APP_SECRET is empty in /data/coolify/source/.env
2023-12-05 12:56:11 +00:00
if grep -q "PUSHER_APP_ID=$" /data/coolify/source/.env; then
sed -i "s|PUSHER_APP_ID=.*|PUSHER_APP_ID=$(openssl rand -hex 32)|g" /data/coolify/source/.env
fi
2023-12-05 10:17:52 +00:00
2023-12-05 12:56:11 +00:00
if grep -q "PUSHER_APP_KEY=$" /data/coolify/source/.env; then
sed -i "s|PUSHER_APP_KEY=.*|PUSHER_APP_KEY=$(openssl rand -hex 32)|g" /data/coolify/source/.env
fi
2023-12-05 10:17:52 +00:00
2023-12-05 12:56:11 +00:00
if grep -q "PUSHER_APP_SECRET=$" /data/coolify/source/.env; then
sed -i "s|PUSHER_APP_SECRET=.*|PUSHER_APP_SECRET=$(openssl rand -hex 32)|g" /data/coolify/source/.env
fi
2023-06-12 12:48:21 +00:00
# Make sure coolify network exists
2023-11-29 09:06:52 +00:00
docker network create --attachable coolify 2>/dev/null
# docker network create --attachable --driver=overlay coolify-overlay 2>/dev/null
2023-12-05 11:13:57 +00:00
if [ -f /data/coolify/source/docker-compose.custom.yml ]; then
2023-12-05 13:18:44 +00:00
echo "docker-compose.custom.yml detected."
2024-06-04 19:57:00 +00:00
docker run -v /data/coolify/source:/data/coolify/source -v /var/run/docker.sock:/var/run/docker.sock --rm ghcr.io/coollabsio/coolify-helper 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 -f /data/coolify/source/docker-compose.custom.yml up -d --remove-orphans --force-recreate"
2023-12-05 11:13:57 +00:00
else
2024-06-04 19:57:00 +00:00
docker run -v /data/coolify/source:/data/coolify/source -v /var/run/docker.sock:/var/run/docker.sock --rm ghcr.io/coollabsio/coolify-helper 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 --remove-orphans --force-recreate"
2023-12-05 11:13:57 +00:00
fi