-
-
Notifications
You must be signed in to change notification settings - Fork 636
Expand file tree
/
Copy pathupdate.sh
More file actions
46 lines (35 loc) · 1.11 KB
/
update.sh
File metadata and controls
46 lines (35 loc) · 1.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#!/bin/bash
# Exit immediately if a command exits with a non-zero status.
set -e
echo "Updating to the latest version..."
# Stash any local changes
echo "Stashing local changes, if any..."
git stash
# 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 --force-recreate
else
# Start all services including caddy
docker compose --profile with-webserver up -d --force-recreate
fi
echo "Update complete. Services are running with the latest version."
echo "You can monitor logs with: docker compose logs -f"