diff --git a/docs/deployment/docker.mdx b/docs/deployment/docker.mdx
index 6f3d1de..b4f3aae 100644
--- a/docs/deployment/docker.mdx
+++ b/docs/deployment/docker.mdx
@@ -177,7 +177,7 @@ The setup script creates the following files in the `dograh/` directory:
| `docker-compose.override.yaml` | Build directives for `api` and `ui` (**build mode only**) |
| `remote_up.sh` | Validated startup wrapper for the remote stack |
| `scripts/run_dograh_init.sh` | One-shot init renderer/validator used by Docker Compose |
-| `scripts/lib/remote_common.sh` | Shared deployment helper library |
+| `scripts/lib/setup_common.sh` | Shared deployment helper library |
| `deploy/templates/` | nginx and coturn runtime config templates |
| `generate_certificate.sh` | Script to regenerate SSL certificates |
| `certs/local.crt` | Self-signed SSL certificate |
diff --git a/docs/deployment/update.mdx b/docs/deployment/update.mdx
index 6ddc0c4..091288a 100644
--- a/docs/deployment/update.mdx
+++ b/docs/deployment/update.mdx
@@ -62,7 +62,7 @@ After the script finishes, apply the update through the validated startup wrappe
```
-The script overwrites `docker-compose.yaml` and the remote helper bundle (`remote_up.sh`, `scripts/run_dograh_init.sh`, `scripts/lib/remote_common.sh`, and `deploy/templates/*`) from the shared upstream deployment bundle. If you've made local edits to any of these, check the `.bak.` files after the update and re-apply your edits.
+The script overwrites `docker-compose.yaml` and the remote helper bundle (`remote_up.sh`, `scripts/run_dograh_init.sh`, `scripts/lib/setup_common.sh`, and `deploy/templates/*`) from the shared upstream deployment bundle. If you've made local edits to any of these, check the `.bak.` files after the update and re-apply your edits.
## Local deployment
@@ -99,7 +99,7 @@ curl http://localhost:8000/api/v1/health # local
```bash
cd dograh
-for f in docker-compose.yaml nginx.conf turnserver.conf .env remote_up.sh scripts/run_dograh_init.sh scripts/lib/remote_common.sh deploy/templates/nginx.remote.conf.template deploy/templates/turnserver.remote.conf.template; do
+for f in docker-compose.yaml nginx.conf turnserver.conf .env remote_up.sh scripts/run_dograh_init.sh scripts/lib/setup_common.sh deploy/templates/nginx.remote.conf.template deploy/templates/turnserver.remote.conf.template; do
[[ -f "$f.bak." ]] && cp "$f.bak." "$f"
done
./remote_up.sh
diff --git a/remote_up.sh b/remote_up.sh
index 90bb027..1b01ef1 100755
--- a/remote_up.sh
+++ b/remote_up.sh
@@ -3,12 +3,12 @@
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
-LIB_PATH="$SCRIPT_DIR/scripts/lib/remote_common.sh"
+LIB_PATH="$SCRIPT_DIR/scripts/lib/setup_common.sh"
BOOTSTRAP_LIB=""
if [[ ! -f "$LIB_PATH" ]]; then
BOOTSTRAP_LIB="$(mktemp)"
- curl -fsSL -o "$BOOTSTRAP_LIB" "https://raw.githubusercontent.com/dograh-hq/dograh/main/scripts/lib/remote_common.sh"
+ curl -fsSL -o "$BOOTSTRAP_LIB" "https://raw.githubusercontent.com/dograh-hq/dograh/main/scripts/lib/setup_common.sh"
LIB_PATH="$BOOTSTRAP_LIB"
fi
@@ -22,7 +22,7 @@ trap cleanup EXIT
# shellcheck disable=SC1090
. "$LIB_PATH"
-DOGRAH_REMOTE_PROJECT_DIR="$SCRIPT_DIR"
+DOGRAH_DEPLOY_PROJECT_DIR="$SCRIPT_DIR"
VALIDATE_ONLY=0
MODE="pull"
diff --git a/scripts/lib/remote_common.sh b/scripts/lib/setup_common.sh
similarity index 96%
rename from scripts/lib/remote_common.sh
rename to scripts/lib/setup_common.sh
index aa48063..e22b9ee 100644
--- a/scripts/lib/remote_common.sh
+++ b/scripts/lib/setup_common.sh
@@ -1,9 +1,7 @@
#!/usr/bin/env bash
-set -euo pipefail
-
-DOGRAH_REMOTE_LIB_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
-DOGRAH_REMOTE_REPO_ROOT="$(cd "$DOGRAH_REMOTE_LIB_DIR/../.." 2>/dev/null && pwd || true)"
+DOGRAH_DEPLOY_LIB_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
+DOGRAH_DEPLOY_REPO_ROOT="$(cd "$DOGRAH_DEPLOY_LIB_DIR/../.." 2>/dev/null && pwd || true)"
: "${RED:=\033[0;31m}"
: "${GREEN:=\033[0;32m}"
@@ -29,8 +27,8 @@ dograh_fail() {
}
dograh_project_dir() {
- if [[ -n "${DOGRAH_REMOTE_PROJECT_DIR:-}" ]]; then
- printf '%s\n' "$DOGRAH_REMOTE_PROJECT_DIR"
+ if [[ -n "${DOGRAH_DEPLOY_PROJECT_DIR:-}" ]]; then
+ printf '%s\n' "$DOGRAH_DEPLOY_PROJECT_DIR"
else
pwd
fi
@@ -45,7 +43,7 @@ dograh_template_path() {
for candidate in \
"$project_dir/deploy/templates/$template_name" \
- "$DOGRAH_REMOTE_REPO_ROOT/deploy/templates/$template_name"
+ "$DOGRAH_DEPLOY_REPO_ROOT/deploy/templates/$template_name"
do
if [[ -f "$candidate" ]]; then
printf '%s\n' "$candidate"
@@ -64,7 +62,7 @@ dograh_init_script_path() {
for candidate in \
"$project_dir/scripts/run_dograh_init.sh" \
- "$DOGRAH_REMOTE_REPO_ROOT/scripts/run_dograh_init.sh"
+ "$DOGRAH_DEPLOY_REPO_ROOT/scripts/run_dograh_init.sh"
do
if [[ -f "$candidate" ]]; then
printf '%s\n' "$candidate"
@@ -410,7 +408,7 @@ dograh_download_init_support_bundle() {
mkdir -p "$project_dir/scripts/lib" "$project_dir/deploy/templates"
mkdir -p "$project_dir/scripts"
- dograh_download_bundle_file_for_ref "$project_dir/scripts/lib/remote_common.sh" "scripts/lib/remote_common.sh" "$ref"
+ dograh_download_bundle_file_for_ref "$project_dir/scripts/lib/setup_common.sh" "scripts/lib/setup_common.sh" "$ref"
dograh_download_bundle_file_for_ref "$project_dir/scripts/run_dograh_init.sh" "scripts/run_dograh_init.sh" "$ref"
chmod +x "$project_dir/scripts/run_dograh_init.sh"
dograh_download_bundle_file_for_ref "$project_dir/deploy/templates/nginx.remote.conf.template" "deploy/templates/nginx.remote.conf.template" "$ref"
diff --git a/scripts/run_dograh_init.sh b/scripts/run_dograh_init.sh
index 803375e..3637f86 100755
--- a/scripts/run_dograh_init.sh
+++ b/scripts/run_dograh_init.sh
@@ -10,9 +10,9 @@ COTURN_OUTPUT_DIR="$OUTPUT_ROOT/coturn"
CERTS_DIR="${DOGRAH_INIT_CERTS_DIR:-/certs}"
# shellcheck disable=SC1091
-. "$SCRIPT_DIR/lib/remote_common.sh"
+. "$SCRIPT_DIR/lib/setup_common.sh"
-DOGRAH_REMOTE_PROJECT_DIR="$WORKSPACE_DIR"
+DOGRAH_DEPLOY_PROJECT_DIR="$WORKSPACE_DIR"
mkdir -p "$NGINX_OUTPUT_DIR" "$COTURN_OUTPUT_DIR"
diff --git a/scripts/setup_custom_domain.sh b/scripts/setup_custom_domain.sh
index 2d3ddab..d3d3c78 100755
--- a/scripts/setup_custom_domain.sh
+++ b/scripts/setup_custom_domain.sh
@@ -9,12 +9,12 @@ BLUE='\033[0;34m'
NC='\033[0m' # No Color
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
-LIB_PATH="$SCRIPT_DIR/lib/remote_common.sh"
+LIB_PATH="$SCRIPT_DIR/lib/setup_common.sh"
BOOTSTRAP_LIB=""
if [[ ! -f "$LIB_PATH" ]]; then
BOOTSTRAP_LIB="$(mktemp)"
- curl -fsSL -o "$BOOTSTRAP_LIB" "https://raw.githubusercontent.com/dograh-hq/dograh/main/scripts/lib/remote_common.sh"
+ curl -fsSL -o "$BOOTSTRAP_LIB" "https://raw.githubusercontent.com/dograh-hq/dograh/main/scripts/lib/setup_common.sh"
LIB_PATH="$BOOTSTRAP_LIB"
fi
@@ -99,9 +99,9 @@ echo -e "${GREEN}✓ Certbot installed${NC}"
echo -e "${BLUE}[3/7] Stopping Dograh services...${NC}"
cd dograh
-DOGRAH_REMOTE_PROJECT_DIR="$(pwd)"
+DOGRAH_DEPLOY_PROJECT_DIR="$(pwd)"
-if [[ ! -f remote_up.sh || ! -f scripts/lib/remote_common.sh ]]; then
+if [[ ! -f remote_up.sh || ! -f scripts/lib/setup_common.sh ]]; then
dograh_download_remote_support_bundle "$(pwd)" "main"
fi
diff --git a/scripts/setup_local.sh b/scripts/setup_local.sh
index 6ed3ec4..be31384 100755
--- a/scripts/setup_local.sh
+++ b/scripts/setup_local.sh
@@ -9,12 +9,12 @@ BLUE='\033[0;34m'
NC='\033[0m' # No Color
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
-LIB_PATH="$SCRIPT_DIR/lib/remote_common.sh"
+LIB_PATH="$SCRIPT_DIR/lib/setup_common.sh"
BOOTSTRAP_LIB=""
if [[ ! -f "$LIB_PATH" ]]; then
BOOTSTRAP_LIB="$(mktemp)"
- curl -fsSL -o "$BOOTSTRAP_LIB" "https://raw.githubusercontent.com/dograh-hq/dograh/main/scripts/lib/remote_common.sh"
+ curl -fsSL -o "$BOOTSTRAP_LIB" "https://raw.githubusercontent.com/dograh-hq/dograh/main/scripts/lib/setup_common.sh"
LIB_PATH="$BOOTSTRAP_LIB"
fi
@@ -36,7 +36,7 @@ echo "╚═══════════════════════
echo -e "${NC}"
# Ask whether to enable coturn (skip prompt if ENABLE_COTURN is already set)
-if [[ -z "$ENABLE_COTURN" ]]; then
+if [[ -z "${ENABLE_COTURN:-}" ]]; then
echo -e "${YELLOW}Enable coturn (TURN server) for WebRTC NAT traversal? [y/N]:${NC}"
read -p "> " ENABLE_COTURN_INPUT
if [[ "$ENABLE_COTURN_INPUT" =~ ^[Yy] ]]; then
@@ -46,7 +46,7 @@ if [[ -z "$ENABLE_COTURN" ]]; then
fi
fi
-if [[ "$ENABLE_COTURN" == "true" ]]; then
+if [[ "${ENABLE_COTURN:-false}" == "true" ]]; then
# Pick a TURN_HOST that's reachable from BOTH the browser (running on the
# host) and the API container (running in docker). 127.0.0.1 is tempting
# but doesn't work for the api container — its own loopback isn't where
@@ -74,7 +74,7 @@ if [[ "$ENABLE_COTURN" == "true" ]]; then
DEFAULT_TURN_HOST="${DEFAULT_TURN_HOST:-127.0.0.1}"
# Get the host browsers/peers will use to reach the TURN server
- if [[ -z "$TURN_HOST" ]]; then
+ if [[ -z "${TURN_HOST:-}" ]]; then
echo -e "${YELLOW}Enter the host browsers AND the API container will use to reach TURN${NC}"
echo -e "${YELLOW}(press Enter for ${DEFAULT_TURN_HOST}):${NC}"
read -p "> " TURN_HOST
@@ -88,13 +88,13 @@ if [[ "$ENABLE_COTURN" == "true" ]]; then
fi
# Get the TURN secret (skip prompt if TURN_SECRET is already set)
- if [[ -z "$TURN_SECRET" ]]; then
+ if [[ -z "${TURN_SECRET:-}" ]]; then
echo -e "${YELLOW}Enter a shared secret for the TURN server (press Enter to generate a random one):${NC}"
read -sp "> " TURN_SECRET
echo ""
fi
- if [[ -z "$TURN_SECRET" ]]; then
+ if [[ -z "${TURN_SECRET:-}" ]]; then
TURN_SECRET=$(openssl rand -hex 32)
echo -e "${BLUE}Generated random TURN secret${NC}"
fi
@@ -108,8 +108,8 @@ REGISTRY="${REGISTRY:-ghcr.io/dograh-hq}"
echo ""
echo -e "${GREEN}Configuration:${NC}"
-echo -e " Coturn: ${BLUE}$ENABLE_COTURN${NC}"
-if [[ "$ENABLE_COTURN" == "true" ]]; then
+echo -e " Coturn: ${BLUE}${ENABLE_COTURN:-false}${NC}"
+if [[ "${ENABLE_COTURN:-false}" == "true" ]]; then
echo -e " TURN Host: ${BLUE}$TURN_HOST${NC}"
echo -e " TURN Secret: ${BLUE}********${NC}"
fi
@@ -120,14 +120,14 @@ echo ""
# Download compose file (skip when DOGRAH_SKIP_DOWNLOAD=1 — e.g. local repo testing).
TOTAL_STEPS=2
-if [[ "$DOGRAH_SKIP_DOWNLOAD" != "1" ]]; then
- if [[ "$ENABLE_COTURN" == "true" ]]; then
+if [[ "${DOGRAH_SKIP_DOWNLOAD:-}" != "1" ]]; then
+ if [[ "${ENABLE_COTURN:-false}" == "true" ]]; then
echo -e "${BLUE}[1/$TOTAL_STEPS] Downloading docker-compose.yaml and TURN helper bundle...${NC}"
else
echo -e "${BLUE}[1/$TOTAL_STEPS] Downloading docker-compose.yaml...${NC}"
fi
curl -sS -o docker-compose.yaml https://raw.githubusercontent.com/dograh-hq/dograh/main/docker-compose.yaml
- if [[ "$ENABLE_COTURN" == "true" ]]; then
+ if [[ "${ENABLE_COTURN:-false}" == "true" ]]; then
dograh_download_init_support_bundle "$(pwd)" "main"
fi
echo -e "${GREEN}✓ Deployment files downloaded${NC}"
@@ -135,9 +135,9 @@ else
echo -e "${BLUE}[1/$TOTAL_STEPS] Using docker-compose.yaml in current directory${NC}"
fi
-if [[ "$ENABLE_COTURN" == "true" ]]; then
+if [[ "${ENABLE_COTURN:-false}" == "true" ]]; then
[[ -f scripts/run_dograh_init.sh ]] || dograh_fail "scripts/run_dograh_init.sh not found. Re-run setup_local.sh without DOGRAH_SKIP_DOWNLOAD=1, or use a full repo checkout."
- [[ -f scripts/lib/remote_common.sh ]] || dograh_fail "scripts/lib/remote_common.sh not found. Re-run setup_local.sh without DOGRAH_SKIP_DOWNLOAD=1, or use a full repo checkout."
+ [[ -f scripts/lib/setup_common.sh ]] || dograh_fail "scripts/lib/setup_common.sh not found. Re-run setup_local.sh without DOGRAH_SKIP_DOWNLOAD=1, or use a full repo checkout."
[[ -f deploy/templates/turnserver.remote.conf.template ]] || dograh_fail "deploy/templates/turnserver.remote.conf.template not found. Re-run setup_local.sh without DOGRAH_SKIP_DOWNLOAD=1, or use a full repo checkout."
fi
@@ -157,7 +157,7 @@ OSS_JWT_SECRET=$OSS_JWT_SECRET
ENABLE_TELEMETRY=$ENABLE_TELEMETRY
ENV_EOF
-if [[ "$ENABLE_COTURN" == "true" ]]; then
+if [[ "${ENABLE_COTURN:-false}" == "true" ]]; then
cat >> .env << ENV_EOF
# TURN Server Configuration (time-limited credentials via TURN REST API)
@@ -175,13 +175,13 @@ echo ""
echo -e "Files created in ${BLUE}$(pwd)${NC}:"
echo " - docker-compose.yaml"
echo " - .env"
-if [[ "$ENABLE_COTURN" == "true" ]]; then
+if [[ "${ENABLE_COTURN:-false}" == "true" ]]; then
echo " - scripts/run_dograh_init.sh"
- echo " - scripts/lib/remote_common.sh"
+ echo " - scripts/lib/setup_common.sh"
echo " - deploy/templates/"
fi
echo ""
-if [[ "$ENABLE_COTURN" == "true" ]]; then
+if [[ "${ENABLE_COTURN:-false}" == "true" ]]; then
echo -e "${YELLOW}To start Dograh with TURN, run:${NC}"
echo ""
echo -e " ${BLUE}docker compose --profile local-turn up --pull always${NC}"
diff --git a/scripts/setup_remote.sh b/scripts/setup_remote.sh
index b1474a9..cd01f7f 100755
--- a/scripts/setup_remote.sh
+++ b/scripts/setup_remote.sh
@@ -9,12 +9,12 @@ BLUE='\033[0;34m'
NC='\033[0m' # No Color
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
-LIB_PATH="$SCRIPT_DIR/lib/remote_common.sh"
+LIB_PATH="$SCRIPT_DIR/lib/setup_common.sh"
BOOTSTRAP_LIB=""
if [[ ! -f "$LIB_PATH" ]]; then
BOOTSTRAP_LIB="$(mktemp)"
- curl -fsSL -o "$BOOTSTRAP_LIB" "https://raw.githubusercontent.com/dograh-hq/dograh/main/scripts/lib/remote_common.sh"
+ curl -fsSL -o "$BOOTSTRAP_LIB" "https://raw.githubusercontent.com/dograh-hq/dograh/main/scripts/lib/setup_common.sh"
LIB_PATH="$BOOTSTRAP_LIB"
fi
@@ -223,7 +223,7 @@ else
fi
fi
-DOGRAH_REMOTE_PROJECT_DIR="$(pwd)"
+DOGRAH_DEPLOY_PROJECT_DIR="$(pwd)"
if [[ "$DEPLOY_MODE" != "prebuilt" ]]; then
chmod +x remote_up.sh
diff --git a/scripts/update_remote.sh b/scripts/update_remote.sh
index 6d9451a..119439b 100755
--- a/scripts/update_remote.sh
+++ b/scripts/update_remote.sh
@@ -9,12 +9,12 @@ BLUE='\033[0;34m'
NC='\033[0m' # No Color
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
-LIB_PATH="$SCRIPT_DIR/lib/remote_common.sh"
+LIB_PATH="$SCRIPT_DIR/lib/setup_common.sh"
BOOTSTRAP_LIB=""
if [[ ! -f "$LIB_PATH" ]]; then
BOOTSTRAP_LIB="$(mktemp)"
- curl -fsSL -o "$BOOTSTRAP_LIB" "https://raw.githubusercontent.com/dograh-hq/dograh/main/scripts/lib/remote_common.sh"
+ curl -fsSL -o "$BOOTSTRAP_LIB" "https://raw.githubusercontent.com/dograh-hq/dograh/main/scripts/lib/setup_common.sh"
LIB_PATH="$BOOTSTRAP_LIB"
fi
@@ -58,7 +58,7 @@ fi
_caller_FASTAPI_WORKERS="${FASTAPI_WORKERS:-}"
_caller_TARGET_VERSION="${TARGET_VERSION:-}"
-DOGRAH_REMOTE_PROJECT_DIR="$(pwd)"
+DOGRAH_DEPLOY_PROJECT_DIR="$(pwd)"
dograh_load_env_file .env
[[ -n "${TURN_SECRET:-}" ]] || dograh_fail "TURN_SECRET not found in .env"
@@ -170,7 +170,7 @@ echo -e "${YELLOW}Files that will be replaced (backups saved with suffix .bak.$T
echo " - docker-compose.yaml (pulled from GitHub at $TARGET_VERSION)"
echo " - remote_up.sh (startup wrapper / preflight)"
echo " - scripts/run_dograh_init.sh"
-echo " - scripts/lib/remote_common.sh"
+echo " - scripts/lib/setup_common.sh"
echo " - deploy/templates/*.template"
echo " - .env (canonical remote keys synchronized)"
echo " - legacy nginx.conf / turnserver.conf backups will be kept if those files still exist"
@@ -193,7 +193,7 @@ for f in \
.env \
remote_up.sh \
scripts/run_dograh_init.sh \
- scripts/lib/remote_common.sh \
+ scripts/lib/setup_common.sh \
deploy/templates/nginx.remote.conf.template \
deploy/templates/turnserver.remote.conf.template
do
@@ -236,7 +236,7 @@ echo -e " ${BLUE}./remote_up.sh${NC}"
echo ""
echo -e "${YELLOW}To roll back, restore the backups and re-run the wrapper:${NC}"
echo ""
-echo -e " ${BLUE}for f in docker-compose.yaml nginx.conf turnserver.conf .env remote_up.sh scripts/run_dograh_init.sh scripts/lib/remote_common.sh deploy/templates/nginx.remote.conf.template deploy/templates/turnserver.remote.conf.template; do${NC}"
+echo -e " ${BLUE}for f in docker-compose.yaml nginx.conf turnserver.conf .env remote_up.sh scripts/run_dograh_init.sh scripts/lib/setup_common.sh deploy/templates/nginx.remote.conf.template deploy/templates/turnserver.remote.conf.template; do${NC}"
echo -e " ${BLUE} [[ -f \"\$f.bak.$TIMESTAMP\" ]] && cp \"\$f.bak.$TIMESTAMP\" \"\$f\"${NC}"
echo -e " ${BLUE}done${NC}"
echo -e " ${BLUE}./remote_up.sh${NC}"