Deployment
This guide walks you through deploying DAIV using Docker Swarm or Docker Compose. After completing this guide, you'll have a fully functional DAIV instance ready to connect to your codebase.
What You'll Deploy
DAIV requires several core services to function properly. You'll deploy these services using container orchestration:
Required services:
- PostgreSQL — stores application data
- Redis — handles caching
- DAIV Application — main API
- DAIV Worker — background task processor
Optional services:
- DAIV Scheduler — periodic task scheduler
- DAIV Sandbox — isolated environment for running commands (see Sandbox)
- MCP Proxy — proxy for running MCP servers in a container (see MCP Tools)
Docker Swarm (Recommended)
Docker Swarm provides better production deployment capabilities including service discovery, load balancing, and rolling updates. This guide covers single-server deployment, but you can extend it to multiple servers using the Docker Swarm documentation.
Prerequisites
- Docker installed with Swarm enabled
- Internet connection to pull container images
- Basic understanding of Docker Swarm
Step 1: Create Docker Secrets
Before deploying, you must create these Docker secrets. These secrets store sensitive configuration data securely:
Required Secrets:
django_secret_key- Random secret key for Django (generate one here)db_password- Random password for the PostgreSQL databasecodebase_gitlab_auth_token- GitLab personal access token withapiscope (see Platform Setup)codebase_gitlab_webhook_secret- Random secret for GitLab webhook validationdaiv_sandbox_api_key- Random API key for Sandbox service authenticationopenrouter_api_key- OpenRouter API key for LLM accessmcp_proxy_auth_token- Random API key for MCP Proxy service authenticationmcp_config_api_key- DAIV API key for MCP Proxy to fetch its configuration (see below)
Create each secret using this command (see Docker Secrets documentation for more details):
| Bash | |
|---|---|
Additional Secrets May Be Required
These are the minimal secrets for basic DAIV functionality. Check the Environment Variables page for additional secrets needed for specific features or services.
Step 2: Create stack.yml file
Create your deployment configuration file. This YAML file defines all services, networks, and volumes needed for DAIV.
Customize Environment Variables
Replace all annotated values with your own configuration. See the Environment Variables page for complete configuration options.
| YAML | |
|---|---|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 | |
- Replace
your-hostname.comwith your domain name. Don't include the schema (e.g., usedaiv.comnothttps://daiv.com). Keepappand127.0.0.1for internal service communication. - Replace with your full domain URL including schema (e.g.,
https://your-hostname.com) - Set to your GitLab instance URL (e.g.,
https://gitlab.comfor GitLab.com) - Points to the Sandbox service. Use
http://sandbox:8000when deploying Sandbox in the same stack - Recommended: Replace
latestwith a specific version tag for production deployments - See DAIV Sandbox documentation for configuration details
- Required: Sandbox needs Docker socket access to create isolated containers
- Optional: Remove this volume if you don't need private registry access
- MCP Proxy fetches its configuration from the DAIV API. The secret must be a valid DAIV API key (see MCP Proxy API key)
- Scaling: Increase
replicasto handle more concurrent tasks (e.g.,replicas: 3). Each worker processes tasks independently from the shared queue, so adding replicas scales DAIV's throughput with no architecture changes
Step 3: Deploy the stack
Deploy your DAIV stack by running this command from the directory containing your stack.yml file:
| Bash | |
|---|---|
Monitor deployment progress with these commands:
| Bash | |
|---|---|
Deployment Time
Services may take several minutes to become fully healthy, especially during the initial deployment when images are being pulled and databases are being initialized.
Step 4: Next steps
Your DAIV deployment is running. Follow the Reverse Proxy guide below to configure external access, then proceed to Platform Setup to connect your first repository.
Docker Compose
Docker Compose provides simpler deployment suitable for development environments or smaller production setups. This method uses a single configuration file to manage all services.
Prerequisites
- Docker installed with Compose
- Internet connection to pull container images
Step 1: Create docker-compose.yml file
Create your Docker Compose configuration. This file defines all services and their configurations in a single place.
Environment Variable Configuration
Replace all annotated values with your specific configuration. See the Environment Variables page for additional options.
| YAML | |
|---|---|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 | |
- Generate a Django secret key - Use a cryptographically secure random string
- Replace with your domain name - Don't include schema (e.g.,
daiv.com) - Generate a secure random password for the database
- Set your GitLab instance URL (e.g.,
https://gitlab.com) - Create a GitLab personal access token with
apiscope permissions (see Platform Setup) - Generate a random webhook secret for GitLab webhook validation
- Get an OpenRouter API key for LLM model access
- Generate a random API key for Sandbox service authentication
- Use the same password as defined in annotation 3
- Use the same API key as defined in annotation 9
- Include the full URL with schema (e.g.,
https://your-hostname.com) - Generate a random API key for MCP Proxy service authentication
- Add the docker group to the sandbox container (
stat -c '%g' /var/run/docker.sock) - DAIV API key for MCP Proxy to fetch its configuration (see MCP Proxy API key)
- Scaling: Increase
replicasto handle more concurrent tasks (e.g.,replicas: 3). Each worker processes tasks independently from the shared queue, so adding replicas scales DAIV's throughput with no architecture changes
Step 2: Run the compose file
Start all DAIV services by running this command from the directory containing your docker-compose.yml:
| Bash | |
|---|---|
Check service status to ensure everything is running correctly:
| Bash | |
|---|---|
Step 3: Next steps
Your DAIV instance is running. Continue with the Reverse Proxy configuration below, then proceed to Platform Setup to connect your first repository.
Reverse Proxy
Configure a reverse proxy to provide secure external access to your DAIV instance. This setup enables HTTPS access and proper domain routing.
This guide covers Nginx configuration. Basic Nginx knowledge is assumed.
Contributions Welcome
Only Nginx configuration is provided currently. Contributions for Apache, Traefik, and other reverse proxy configurations are welcome!
Prerequisites
- Nginx installed
- Valid SSL certificate for your domain
- Domain name pointing to your server
Step 1: Configure Nginx
Create a new Nginx configuration file at /etc/nginx/conf.d/daiv.conf (path may vary by operating system).
Add this configuration and customize the annotated values:
- Set the internal IP of your DAIV instance. Use
localhostor127.0.0.1if running on the same server - Replace with your domain name (e.g.,
daiv.example.com) - Update the SSL certificate path - Location varies by operating system
- Update the SSL certificate key path - Location varies by operating system
Step 2: Restart Nginx
Apply the configuration changes by restarting Nginx:
| Bash | |
|---|---|
Verify the configuration by accessing your domain in a web browser. You should see the DAIV interface.
MCP Proxy API key
The MCP Proxy fetches its server configuration from the DAIV API at startup. This requires a valid DAIV API key for authentication.
To create one, run the create_api_key management command:
| Bash | |
|---|---|
You can optionally pass --expires-at with an ISO 8601 date (e.g. 2026-12-31T23:59:59) to set an expiration.
Copy the printed key and use it as:
- Docker Swarm:
printf '<key>' | docker secret create mcp_config_api_key - - Docker Compose: set
MCP_CONFIG_API_KEYin the mcp-proxy environment
Then restart the mcp-proxy service.
Next steps
Your DAIV instance is now running and accessible. Continue with:
- Platform Setup — connect DAIV to your GitLab or GitHub repositories
- LLM Providers — configure your LLM provider and API keys
- Repository Config — customize DAIV's behavior per repository