Skip to content

Commit 2e4d2ee

Browse files
CopilotBreadGenie
andauthored
fix(deploy): use explicit Compose project name to fix predictable volume names
Agent-Logs-Url: https://github.com/frappe/meet/sessions/ee38fd96-8926-4ce3-9679-cfdc01cde9b8 Co-authored-by: BreadGenie <63963181+BreadGenie@users.noreply.github.com>
1 parent efb1059 commit 2e4d2ee

2 files changed

Lines changed: 15 additions & 5 deletions

File tree

sfu-server/deploy/deploy.sh

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,11 @@ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
2121
COMPOSE_FILE="$SCRIPT_DIR/docker-compose.yml"
2222
ENV_FILE="$SCRIPT_DIR/.env"
2323

24+
# ── Project name ──────────────────────────────────────────────────────────────
25+
# Use a fixed project name so Docker volume names are predictable regardless of
26+
# the directory the stack is installed into (e.g., /opt/meet-sfu vs ./deploy).
27+
COMPOSE_PROJECT="meet-sfu"
28+
2429
# ── Colors ────────────────────────────────────────────────────────────────────
2530
RED='\033[0;31m'
2631
GREEN='\033[0;32m'
@@ -41,7 +46,7 @@ compose() {
4146
if [ "${DISABLE_SSL:-false}" != "true" ]; then
4247
profiles+=(--profile ssl)
4348
fi
44-
docker compose -f "$COMPOSE_FILE" --env-file "$ENV_FILE" "${profiles[@]}" "$@"
49+
docker compose -f "$COMPOSE_FILE" -p "$COMPOSE_PROJECT" --env-file "$ENV_FILE" "${profiles[@]}" "$@"
4550
}
4651

4752
# ── Preflight checks ────────────────────────────────────────────────────────
@@ -147,7 +152,7 @@ cmd_setup() {
147152
if [ "${DISABLE_SSL:-false}" != "true" ]; then
148153
header "SSL Certificate"
149154
# Check if certs already exist inside the Docker volume
150-
if docker run --rm -v deploy_certbot-certs:/certs alpine \
155+
if docker run --rm -v "${COMPOSE_PROJECT}_certbot-certs:/certs" alpine \
151156
test -f "/certs/live/${DOMAIN:-}/fullchain.pem" 2>/dev/null; then
152157
info "SSL certificate already exists. Skipping provisioning."
153158
info "To re-provision, run: ./deploy.sh ssl-init"

sfu-server/deploy/nginx/certbot-init.sh

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,11 @@ set -euo pipefail
1515
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
1616
DEPLOY_DIR="$(cd "$SCRIPT_DIR/.." && pwd)"
1717

18+
# Use the same fixed project name as deploy.sh so Docker volume names are
19+
# consistent regardless of the installation directory.
20+
COMPOSE_PROJECT="meet-sfu"
21+
COMPOSE_CMD="docker compose -f $DEPLOY_DIR/docker-compose.yml -p $COMPOSE_PROJECT --env-file $DEPLOY_DIR/.env"
22+
1823
# Load environment
1924
if [ ! -f "$DEPLOY_DIR/.env" ]; then
2025
echo "[-] .env file not found. Run: cp .env.example .env && edit .env"
@@ -76,7 +81,7 @@ NGINX
7681

7782
# Step 2: Start nginx with the ACME-only config
7883
echo "▶ Starting nginx for ACME challenge..."
79-
docker compose -f "$DEPLOY_DIR/docker-compose.yml" --env-file "$DEPLOY_DIR/.env" up -d nginx
84+
$COMPOSE_CMD up -d nginx
8085
sleep 3
8186

8287
# Verify nginx is actually running
@@ -87,7 +92,7 @@ fi
8792

8893
# Step 3: Request the certificate
8994
echo "▶ Requesting certificate from Let's Encrypt..."
90-
docker compose -f "$DEPLOY_DIR/docker-compose.yml" --env-file "$DEPLOY_DIR/.env" \
95+
$COMPOSE_CMD \
9196
run --rm --entrypoint certbot certbot \
9297
certonly \
9398
--webroot \
@@ -109,7 +114,7 @@ if [ $CERT_EXIT -eq 0 ]; then
109114
echo ""
110115
echo "[+] SSL certificate provisioned successfully!"
111116
echo "[>] Restarting nginx with full SSL configuration..."
112-
docker compose -f "$DEPLOY_DIR/docker-compose.yml" --env-file "$DEPLOY_DIR/.env" up -d --force-recreate nginx
117+
$COMPOSE_CMD up -d --force-recreate nginx
113118
echo "[+] Done! Your SFU is now available at https://$DOMAIN"
114119
else
115120
echo ""

0 commit comments

Comments
 (0)