-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdeploy.sh
More file actions
30 lines (25 loc) · 942 Bytes
/
deploy.sh
File metadata and controls
30 lines (25 loc) · 942 Bytes
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
#!/bin/bash
# Define domain and cert path
DOMAIN="hack.joelgarciamartin.com"
CERT_PATH="./data/certbot/conf/live/$DOMAIN/fullchain.pem"
echo "### Pulling latest changes..."
git pull
echo "### Rebuilding containers..."
# This ensures that 'frontend' and 'backend' are rebuilt with the latest code
docker compose up -d
echo "### Check SSL Certificates..."
if [ -f "$CERT_PATH" ]; then
echo "Existing certificate found for $DOMAIN."
echo "Starting services in production mode..."
# -d: Detached mode
# --remove-orphans: Cleanup old containers
# --force-recreate: Ensure we use the new image even if config didn't change
docker compose up -d --remove-orphans --force-recreate
echo "### Deployment Complete! ###"
echo "Your site should be live at https://$DOMAIN"
else
echo "No existing certificate found at $CERT_PATH."
echo "Starting initialization script..."
chmod +x init-letsencrypt.sh
./init-letsencrypt.sh
fi