lasthourcloud/scripts/upgrade.sh

51 lines
3.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
2023-12-04 20:37:30 +00:00
VERSION="1.0.4"
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
echo "Copying required files from Last Hour 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
2024-02-24 00:22:34 +00:00
cp -R /home/lasthour/lasthourcloud/public/ /data/coolify/
cp -R /home/lasthour/lasthourcloud/app/Notifications /data/coolify/
cp -R /home/lasthour/lasthourcloud/app/Models /data/coolify/
cp -R /home/lasthour/lasthourcloud/app/Livewire /data/coolify/
cp -R /home/lasthour/lasthourcloud/resources/views/auth /data/coolify/
cp /home/lasthour/lasthourcloud/.coolify-logo /data/coolify/.coolify-logo
cp /home/lasthour/lasthourcloud/tailwind.config.js /data/coolify/tailwind/
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-02-29 18:46:20 +00:00
docker run --pull always -v /data/coolify/source:/data/coolify/source -v /var/run/docker.sock:/var/run/docker.sock -v /data/coolify/public -v /data/coolify/Livewire -v /data/coolify/auth -v /data/coolify/Notifications -v /data/coolify/Models --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