fix: fix remote deployment method (#145)

* fix: disable file logging for docker compose mode

* fix: wait for processes in Docker compose mode

* fix: add default turn server conf for remote mode

* remove sentence transformers

* make turn detection configurable
This commit is contained in:
Abhishek 2026-02-05 13:10:33 +05:30 committed by GitHub
parent 7d1e22d53c
commit 87fc64d55c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
19 changed files with 290 additions and 573 deletions

View file

@ -245,8 +245,21 @@ server {
NGINX_EOF
echo -e "${GREEN}✓ nginx.conf updated${NC}"
# Update .env file with domain name
echo -e "${BLUE}[6/8] Updating environment variables...${NC}"
if [[ -f ".env" ]]; then
# Update BACKEND_API_ENDPOINT to use domain
sed -i.bak "s|^BACKEND_API_ENDPOINT=.*|BACKEND_API_ENDPOINT=https://$DOMAIN_NAME|" .env
# Update TURN_HOST to use domain
sed -i.bak "s|^TURN_HOST=.*|TURN_HOST=$DOMAIN_NAME|" .env
rm -f .env.bak
echo -e "${GREEN}✓ .env updated with domain name${NC}"
else
echo -e "${YELLOW}⚠ .env file not found - skipping environment update${NC}"
fi
# Setup auto-renewal
echo -e "${BLUE}[6/7] Setting up automatic certificate renewal...${NC}"
echo -e "${BLUE}[7/8] Setting up automatic certificate renewal...${NC}"
DOGRAH_PATH=$(pwd)
# Create renewal hook script that copies new certificates and restarts nginx
@ -268,7 +281,7 @@ certbot renew --dry-run --quiet && echo -e "${GREEN}✓ Auto-renewal configured
# Start Dograh services
echo ""
echo -e "${BLUE}[7/7] Starting Dograh services...${NC}"
echo -e "${BLUE}[8/8] Starting Dograh services...${NC}"
docker compose --profile remote up -d --pull always
echo ""
@ -287,6 +300,7 @@ echo -e " Auto-renewal: Enabled (certificates renew automatically)"
echo ""
echo -e "${YELLOW}Files modified:${NC}"
echo " - dograh/nginx.conf (updated with domain name)"
echo " - dograh/.env (BACKEND_API_ENDPOINT and TURN_HOST updated)"
echo " - dograh/certs/local.crt (SSL certificate)"
echo " - dograh/certs/local.key (SSL private key)"
echo " - /etc/letsencrypt/renewal-hooks/deploy/dograh-reload.sh (renewal hook)"

View file

@ -133,8 +133,44 @@ echo -e "${BLUE}[4/5] Generating SSL certificates...${NC}"
./generate_certificate.sh
echo -e "${GREEN}✓ SSL certificates generated${NC}"
echo -e "${BLUE}[5/5] Creating environment file...${NC}"
echo -e "${BLUE}[5/6] Creating TURN server configuration...${NC}"
cat > turnserver.conf << TURN_EOF
# Coturn TURN Server - Docker Configuration
# Auto-generated by setup_remote.sh
# Listener ports
listening-port=3478
tls-listening-port=5349
# Relay port range
min-port=49152
max-port=49200
# Network - external IP for NAT traversal
external-ip=$SERVER_IP
# Realm
realm=dograh.com
# Authentication (TURN REST API with time-limited credentials)
use-auth-secret
static-auth-secret=$TURN_SECRET
# Security
fingerprint
no-cli
no-multicast-peers
# Logging
log-file=stdout
TURN_EOF
echo -e "${GREEN}✓ turnserver.conf created${NC}"
echo -e "${BLUE}[6/6] Creating environment file...${NC}"
cat > .env << ENV_EOF
# Backend API endpoint (for remote deployment)
BACKEND_API_ENDPOINT=https://$SERVER_IP
# TURN Server Configuration (time-limited credentials via TURN REST API)
TURN_HOST=$SERVER_IP
TURN_SECRET=$TURN_SECRET
@ -152,6 +188,7 @@ echo ""
echo -e "Files created in ${BLUE}$(pwd)${NC}:"
echo " - docker-compose.yaml"
echo " - nginx.conf"
echo " - turnserver.conf"
echo " - generate_certificate.sh"
echo " - certs/local.crt"
echo " - certs/local.key"

View file

@ -54,6 +54,8 @@ LATEST_LINK="$BASE_LOG_DIR/latest" # Symlink to latest logs
VENV_PATH="$BASE_DIR/venv"
ARQ_WORKERS=${ARQ_WORKERS:-1}
LOG_TO_FILE=${LOG_TO_FILE:-true} # Set to false in Docker to use stdout
WAIT_FOR_PROCESSES=${WAIT_FOR_PROCESSES:-false} # Set to true in Docker to keep container alive
# Log startup
cd "$BASE_DIR"
@ -239,8 +241,13 @@ for i in "${!SERVICE_NAMES[@]}"; do
(
cd "$BASE_DIR"
export LOG_FILE_PATH="$LOG_DIR/$name.log"
exec $cmd >>"$LOG_DIR/$name.log" 2>&1
if [[ "$LOG_TO_FILE" == "true" ]]; then
export LOG_FILE_PATH="$LOG_DIR/$name.log"
exec $cmd >>"$LOG_DIR/$name.log" 2>&1
else
# Log to stdout/stderr for Docker
exec $cmd
fi
) &
pid=$!
@ -276,3 +283,8 @@ echo "Logs: tail -f $LOG_DIR/*.log"
echo "Rotated logs: ls $LOG_DIR/*.log.*"
echo "To stop: ./scripts/stop_services.sh"
echo "──────────────────────────────────────────────────"
# In Docker mode, wait for all background processes to keep container alive
if [[ "$WAIT_FOR_PROCESSES" == "true" ]]; then
wait
fi