lasthourcloud/scripts/upgrade.sh

44 lines
2.8 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
2023-12-04 20:37:30 +00:00
VERSION="1.0.4"
2024-03-02 03:17:11 +00:00
CDN="https://githaven.org/Shiloh/lasthourcloud/src/branch/main/"
2023-04-27 12:45:45 +00:00
wget -q -O - $CDN/docker-compose.yml -o /data/coolify/source/docker-compose.yml
wget -q -O - $CDN/docker-compose.prod.yml -o /data/coolify/source/docker-compose.prod.yml
wget -q -O - $CDN/.env.production -o /data/coolify/source/.env.production
2023-05-25 13:47:27 +00:00
2024-03-02 02:37:31 +00:00
# echo "Copying required files from Last Hour Cloud git repo..."
# cp /home/lasthour/lasthourcloud/docker-compose.yml /data/coolify/source/docker-compose.yml
# cp /home/lasthour/lasthourcloud/docker-compose.prod.yml /data/coolify/source/docker-compose.prod.yml
# cp /home/lasthour/lasthourcloud/.env.production /data/coolify/source/.env.production
# cp /home/lasthour/lasthourcloud/scripts/upgrade.sh /data/coolify/source/upgrade.sh
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."
2023-12-05 11:13:57 +00:00
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-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 --pull always --remove-orphans --force-recreate"
else
2024-03-02 02:37:31 +00:00
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-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 --pull always --remove-orphans --force-recreate"
2023-12-05 11:13:57 +00:00
fi