rybbit/update.sh
2025-05-07 11:21:35 -07:00

42 lines
No EOL
1 KiB
Bash

#!/bin/bash
# Exit immediately if a command exits with a non-zero status.
set -e
echo "Updating to the latest version..."
# Pull latest changes from git repository
echo "Pulling latest code..."
git pull
# Stop running containers
echo "Stopping current services..."
docker compose down
# Check if .env file exists
if [ ! -f .env ]; then
echo "Error: .env file not found. Please run setup.sh first."
echo "Usage: ./setup.sh <domain_name>"
exit 1
fi
# Pull latest Docker images
echo "Pulling latest Docker images..."
docker compose pull
# Rebuild and start containers
echo "Rebuilding and starting updated services..."
# Load environment variables
source .env
if [ "$USE_WEBSERVER" = "false" ]; then
# Start without the caddy service when using --no-webserver
docker compose up -d backend client clickhouse postgres
else
# Start all services including caddy
docker compose up -d
fi
echo "Update complete. Services are running with the latest version."
echo "You can monitor logs with: docker compose logs -f"