From 6efe7d6bd47e8cd099665351c7c8c6de645b1539 Mon Sep 17 00:00:00 2001
From: Sabiha Khan <87858386+chewwbaka@users.noreply.github.com>
Date: Thu, 20 Nov 2025 21:33:05 +0530
Subject: [PATCH] feat: enable remote server deployment for OSS deployment
(#57)
---
README.md | 4 +
docker-compose.yaml | 15 +++
docs/deployment/custom-domain.mdx | 33 +++++
docs/deployment/docker.mdx | 192 ++++++++++++++++++++++++++++++
docs/deployment/heroku.mdx | 44 +++++++
docs/docs.json | 8 ++
ui/Dockerfile | 1 -
ui/src/lib/apiClient.ts | 12 +-
8 files changed, 305 insertions(+), 4 deletions(-)
create mode 100644 docs/deployment/custom-domain.mdx
create mode 100644 docs/deployment/docker.mdx
create mode 100644 docs/deployment/heroku.mdx
diff --git a/README.md b/README.md
index 6a68b6e..c068946 100644
--- a/README.md
+++ b/README.md
@@ -102,6 +102,10 @@ Architecture diagram _(coming soon)_
Refer [prerequisites](https://docs.dograh.com/getting-started/prerequisites) and [first steps](#-get-started)
+### Self-Hosted Deployment
+
+For detailed deployment instructions including remote server setup with HTTPS, see our [Docker Deployment Guide](https://docs.dograh.com/deployment/docker).
+
### Production (Self-Hosted)
Production guide coming soon. [Drop in a message](https://join.slack.com/t/dograh-community/shared_invite/zt-3czr47sw5-MSg1J0kJ7IMPOCHF~03auQ) for assistance.
diff --git a/docker-compose.yaml b/docker-compose.yaml
index 247b3b4..ca1e2c9 100644
--- a/docker-compose.yaml
+++ b/docker-compose.yaml
@@ -59,6 +59,21 @@ services:
networks:
- app-network
+ nginx:
+ image: nginx:alpine
+ container_name: nginx_https
+ profiles: ["remote"]
+ depends_on:
+ - ui
+ ports:
+ - "80:80"
+ - "443:443"
+ volumes:
+ - ./nginx.conf:/etc/nginx/conf.d/default.conf:ro
+ - ./certs:/etc/nginx/certs:ro
+ networks:
+ - app-network
+
api:
image: ${REGISTRY:-dograhai}/dograh-api:latest
volumes:
diff --git a/docs/deployment/custom-domain.mdx b/docs/deployment/custom-domain.mdx
new file mode 100644
index 0000000..5109c32
--- /dev/null
+++ b/docs/deployment/custom-domain.mdx
@@ -0,0 +1,33 @@
+---
+title: "Custom Domain (Coming Soon)"
+description: "Deploy Dograh AI with custom domain names and proper SSL certificates"
+---
+
+Deploy Dograh AI with your own custom domain name for a professional production setup.
+
+## What is Custom Domain Deployment?
+
+Custom domain deployment allows you to run Dograh AI with a personalized domain name (like `voice.yourcompany.com`) instead of using IP addresses. This setup includes:
+
+- **Custom Domain**: Access your application via a memorable domain name
+- **Automatic SSL**: Proper SSL certificates from Let's Encrypt or similar providers
+- **Professional Setup**: Production-ready configuration for business use
+- **Easy Sharing**: Share a clean URL with your team and customers
+
+## Benefits
+
+- **Better User Experience**: Clean, memorable URLs for your voice AI applications
+- **SSL Security**: Proper HTTPS certificates that browsers trust
+- **Professional Image**: Custom domains enhance your brand presence
+- **Easy Management**: Simplified access and sharing across your organization
+
+## Coming Soon
+
+Detailed documentation for custom domain deployment will be available soon. This will include:
+
+- Step-by-step domain configuration
+- Automated SSL certificate setup
+- Production deployment best practices
+- Custom domain routing configuration
+
+For early access or assistance with custom domain deployment, please [join our Slack community](https://join.slack.com/t/dograh-community/shared_invite/zt-3czr47sw5-MSg1J0kJ7IMPOCHF~03auQ) and let us know about your use case.
\ No newline at end of file
diff --git a/docs/deployment/docker.mdx b/docs/deployment/docker.mdx
new file mode 100644
index 0000000..9a13695
--- /dev/null
+++ b/docs/deployment/docker.mdx
@@ -0,0 +1,192 @@
+---
+title: "Docker"
+description: "Deploy Dograh AI using Docker for local development and remote server environments"
+---
+
+Dograh AI can be deployed using Docker in two main configurations. Choose the option that best fits your needs:
+
+- **Option 1**: For local development and testing on your own machine
+- **Option 2**: For remote server deployment with HTTPS (using IP address)
+
+## Option 1: Local Docker Deployment
+
+For local development and testing, you can run Dograh AI directly on your machine using Docker with a single command.
+
+### Quick Start
+
+Run this single command to download and start Dograh AI:
+
+```bash
+curl -o docker-compose.yaml https://raw.githubusercontent.com/dograh-hq/dograh/main/docker-compose.yaml && REGISTRY=ghcr.io/dograh-hq ENABLE_TELEMETRY=true docker compose up --pull always
+```
+
+This command:
+- Downloads the latest docker-compose.yaml
+- Starts all required services including PostgreSQL, Redis, MinIO, API, and UI
+- Pulls the latest images automatically
+
+### Access the Application
+
+Once running (first startup takes 2-3 minutes), open:
+```
+http://localhost:3010
+```
+
+
+You can disable telemetry by setting `ENABLE_TELEMETRY=false` in the command above.
+
+
+## Option 2: Remote Server Deployment
+
+Deploy Dograh AI on a remote server to make it accessible from anywhere using your server's IP address. This setup includes HTTPS support via nginx reverse proxy with self-signed certificates.
+
+### Prerequisites
+
+- A server with Docker and Docker Compose installed
+- Public IP address for your server
+- Ports 80 and 443 accessible from the internet
+
+### Step 1: Create Project Directory
+
+Open your terminal and create a directory for Dograh:
+
+```bash
+mkdir dograh
+cd dograh
+```
+
+### Step 2: Download Docker Compose File
+
+Download the docker-compose.yaml file:
+
+```bash
+curl -o docker-compose.yaml https://raw.githubusercontent.com/dograh-hq/dograh/main/docker-compose.yaml
+```
+
+### Step 3: Generate SSL Certificates
+
+Create a script to generate self-signed certificates for HTTPS:
+
+```bash
+nano generate_certificate.sh
+```
+
+Copy the following content into the file:
+
+```bash
+mkdir -p certs
+openssl req -x509 -nodes -newkey rsa:2048 \
+ -keyout certs/local.key \
+ -out certs/local.crt \
+ -days 365 \
+ -subj "/CN=YOUR_SERVER_IP"
+```
+
+
+Replace `YOUR_SERVER_IP` with your server's public IP address.
+
+
+Make the script executable and run it:
+
+```bash
+chmod +x generate_certificate.sh
+./generate_certificate.sh
+```
+
+### Step 4: Configure nginx
+
+Create an nginx configuration file:
+
+```bash
+nano nginx.conf
+```
+
+Copy the following content into the file:
+
+```nginx
+server {
+ listen 80;
+ server_name YOUR_SERVER_IP;
+
+ # Optional: redirect all HTTP to HTTPS
+ return 301 https://$host$request_uri;
+}
+
+server {
+ listen 443 ssl;
+ server_name YOUR_SERVER_IP;
+
+ ssl_certificate /etc/nginx/certs/local.crt;
+ ssl_certificate_key /etc/nginx/certs/local.key;
+
+ # Basic TLS settings for dev
+ ssl_protocols TLSv1.2 TLSv1.3;
+ ssl_prefer_server_ciphers on;
+
+ location / {
+ proxy_pass http://ui:3010;
+ proxy_http_version 1.1;
+
+ # Important for WebSockets / hot reload etc.
+ proxy_set_header Upgrade $http_upgrade;
+ proxy_set_header Connection "upgrade";
+
+ proxy_set_header Host $host;
+ proxy_set_header X-Real-IP $remote_addr;
+ proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
+ proxy_set_header X-Forwarded-Proto https;
+
+ # Rewrite localhost MinIO URLs in API responses to use current domain
+ sub_filter 'http://localhost:9000/voice-audio/' 'https://$host/voice-audio/';
+ sub_filter_once off;
+ sub_filter_types application/json text/html;
+ }
+
+ location /voice-audio/ {
+ proxy_pass http://minio:9000/voice-audio/;
+
+ proxy_http_version 1.1;
+
+ # Headers for file downloads from MinIO
+ proxy_set_header Host $host;
+ proxy_set_header X-Real-IP $remote_addr;
+ proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
+ proxy_set_header X-Forwarded-Proto https;
+
+ # Allow large file downloads
+ proxy_buffering off;
+ client_max_body_size 100M;
+ }
+}
+```
+
+
+Replace `YOUR_SERVER_IP` with your server's public IP address in both locations (lines 3 and 11).
+
+
+### Step 5: Deploy with Remote Profile
+
+Start the application with the remote profile to include nginx:
+
+```bash
+docker compose --profile remote up -d
+```
+
+This command starts all services including the nginx reverse proxy with HTTPS support.
+
+### Step 6: Access Your Application
+
+Your application will be available at:
+```
+https://YOUR_SERVER_IP
+```
+
+Replace `YOUR_SERVER_IP` with your actual server IP address.
+
+### Configuration Notes
+
+- The remote deployment includes an nginx reverse proxy for HTTPS termination
+- File downloads (transcripts, recordings) are automatically routed through nginx
+- WebSocket connections for real-time features are properly proxied
+- The setup uses self-signed certificates - browsers will show a security warning that you can safely accept for testing
+- For production deployments with proper SSL and domain names, see the [Custom Domain](custom-domain) documentation
diff --git a/docs/deployment/heroku.mdx b/docs/deployment/heroku.mdx
new file mode 100644
index 0000000..063e75d
--- /dev/null
+++ b/docs/deployment/heroku.mdx
@@ -0,0 +1,44 @@
+---
+title: "Heroku (Coming Soon)"
+description: "One-click deployment of Dograh AI to Heroku cloud platform"
+---
+
+Deploy Dograh AI to Heroku with a single click for instant cloud hosting.
+
+## What is Heroku Deployment?
+
+Heroku deployment provides a one-click solution to deploy Dograh AI to the cloud without managing servers or infrastructure. Perfect for:
+
+- **Quick Testing**: Get a cloud instance running in minutes
+- **Small Teams**: Cost-effective solution for lightweight usage
+- **Proof of Concept**: Demonstrate Dograh AI to stakeholders quickly
+- **No DevOps**: Deploy without server management knowledge
+
+## Benefits
+
+- **One-Click Setup**: Deploy instantly with minimal configuration
+- **Automatic Scaling**: Heroku handles infrastructure scaling
+- **Built-in Monitoring**: Access logs and performance metrics
+- **Easy Sharing**: Get a public URL immediately
+- **Cost-Effective**: Pay-as-you-use pricing model
+
+## What You'll Get
+
+Once available, the Heroku deployment will include:
+
+- Pre-configured Dograh AI application
+- PostgreSQL database setup
+- Redis cache configuration
+- Public HTTPS URL
+- Environment variable management
+
+## Coming Soon
+
+One-click Heroku deployment is in development. This will include:
+
+- **Deploy to Heroku** button in the README
+- Automatic provisioning of required add-ons
+- Environment variable configuration guide
+- Scaling and monitoring instructions
+
+For updates on Heroku deployment availability, please [join our Slack community](https://join.slack.com/t/dograh-community/shared_invite/zt-3czr47sw5-MSg1J0kJ7IMPOCHF~03auQ) or watch our GitHub repository for announcements.
\ No newline at end of file
diff --git a/docs/docs.json b/docs/docs.json
index 4393074..2d99170 100644
--- a/docs/docs.json
+++ b/docs/docs.json
@@ -32,6 +32,14 @@
"configurations/inference-providers"
]
},
+ {
+ "group": "Deployment",
+ "pages": [
+ "deployment/docker",
+ "deployment/custom-domain",
+ "deployment/heroku"
+ ]
+ },
{
"group": "Features",
"pages": [
diff --git a/ui/Dockerfile b/ui/Dockerfile
index afa7d69..18914a8 100644
--- a/ui/Dockerfile
+++ b/ui/Dockerfile
@@ -39,7 +39,6 @@ COPY ui/src ./src
ENV NEXT_PUBLIC_NODE_ENV="oss"
ENV NEXT_PUBLIC_AUTH_PROVIDER="local"
ENV NEXT_PUBLIC_DEPLOYMENT_MODE="oss"
-ENV NEXT_PUBLIC_BACKEND_URL="http://localhost:8000"
ENV BACKEND_URL="http://api:8000"
ENV NEXT_TELEMETRY_DISABLED="1"
ENV NEXT_PUBLIC_CHATWOOT_URL="https://chat.dograh.com"
diff --git a/ui/src/lib/apiClient.ts b/ui/src/lib/apiClient.ts
index 4f5b7c1..7605ef1 100644
--- a/ui/src/lib/apiClient.ts
+++ b/ui/src/lib/apiClient.ts
@@ -3,9 +3,15 @@ import type { CreateClientConfig } from '@/client/client.gen';
export const createClientConfig: CreateClientConfig = (config) => {
// Use different URLs for server-side vs client-side
const isServer = typeof window === 'undefined';
- const baseUrl = isServer
- ? process.env.BACKEND_URL || process.env.NEXT_PUBLIC_BACKEND_URL
- : process.env.NEXT_PUBLIC_BACKEND_URL;
+ let baseUrl: string;
+
+ if (isServer) {
+ // for server-side rendering, still use environment variable as fallback
+ baseUrl = process.env.BACKEND_URL || 'http://api:8000';
+ } else {
+ // for client-side, use the current browser URL's origin
+ baseUrl = process.env.NEXT_PUBLIC_BACKEND_URL || window.location.origin;
+ }
return {
...config,