rybbit/update.sh
Bill Yang 7efb818c3d Refactor environment variable configuration and enhance setup script
- Updated `.env.example` to use HOST_BACKEND_PORT and HOST_CLIENT_PORT for clearer port mapping.
- Modified `docker-compose.yml` to reflect changes in environment variable names for backend and client services.
- Enhanced `setup.sh` to support custom port options and improved error handling for missing `.env` file.
- Updated documentation in `self-hosting.mdx` to include new setup script options and examples for custom port configurations.
2025-05-06 11:27:21 -07:00

38 lines
No EOL
958 B
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
# 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 --build -d backend client clickhouse postgres
else
# Start all services including caddy
docker compose up --build -d
fi
echo "Update complete. Services are running with the latest version."
echo "You can monitor logs with: docker compose logs -f"