fix(infra): guard chown calls to make setup_server.sh fully idempotent

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Deeman
2026-02-24 02:53:50 +01:00
parent 619d1570ef
commit 7f3bde56b6

View File

@@ -33,7 +33,9 @@ echo "Added $SERVICE_USER to docker group"
# Create app directory owned by service user
mkdir -p "$APP_DIR"
chown "$SERVICE_USER:$SERVICE_USER" "$APP_DIR"
if [ "$(stat -c '%U' "$APP_DIR")" != "$SERVICE_USER" ]; then
chown "$SERVICE_USER:$SERVICE_USER" "$APP_DIR"
fi
echo "Created $APP_DIR"
# Generate deploy key as service user if not present
@@ -71,7 +73,9 @@ fi
# Create data directories owned by service user
mkdir -p /data/padelnomics/landing
chown -R "$SERVICE_USER:$SERVICE_USER" /data/padelnomics
if [ "$(stat -c '%U' /data/padelnomics)" != "$SERVICE_USER" ]; then
chown -R "$SERVICE_USER:$SERVICE_USER" /data/padelnomics
fi
echo "Created /data/padelnomics/landing"
# Install and enable systemd services