lasthourcloud/scripts/upgrade.sh

38 lines
2.5 KiB
Bash
Raw Permalink 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
VERSION="1.1"
CDN="https://cdn.lasthourhosting.org/lasthourcloudprod"
LATEST_IMAGE=${1:-latest}
LATEST_HELPER_VERSION=${2:-latest}
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
awk -F '=' '!seen[$1]++' /data/coolify/source/.env /data/coolify/source/.env.production > /data/coolify/source/.env.tmp && mv /data/coolify/source/.env.tmp /data/coolify/source/.env
2023-12-04 20:37:30 +00:00
# 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 Last Hour Cloud network exists
# It is created when starting Last Hour Cloud with docker compose
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."
docker run -v /data/coolify/source:/data/coolify/source -v /var/run/docker.sock:/var/run/docker.sock --rm ghcr.io/coollabsio/coolify-helper:${LATEST_HELPER_VERSION:-latest} 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 --wait --wait-timeout 60"
2023-12-05 11:13:57 +00:00
else
docker run -v /data/coolify/source:/data/coolify/source -v /var/run/docker.sock:/var/run/docker.sock --rm ghcr.io/coollabsio/coolify-helper:${LATEST_HELPER_VERSION:-latest} 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 --wait --wait-timeout 60"
fi