You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: custom-domain/dstack-ingress/README.md
+30-12Lines changed: 30 additions & 12 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,13 +1,14 @@
1
1
# Custom Domain Setup for dstack Applications
2
2
3
-
This repository provides a solution for setting up custom domains with automatic SSL certificate management for dstack applications using Cloudflare DNS and Let's Encrypt.
3
+
This repository provides a solution for setting up custom domains with automatic SSL certificate management for dstack applications using various DNS providers and Let's Encrypt.
4
4
5
5
## Overview
6
6
7
7
This project enables you to run dstack applications with your own custom domain, complete with:
8
8
9
9
- Automatic SSL certificate provisioning and renewal via Let's Encrypt
10
-
- Cloudflare DNS configuration for CNAME, TXT, and CAA records
10
+
- Multi-provider DNS support (Cloudflare, Linode DNS, more to come)
11
+
- Automatic DNS configuration for CNAME, TXT, and CAA records
11
12
- Nginx reverse proxy to route traffic to your application
12
13
- Certificate evidence generation for verification
13
14
- Strong SSL/TLS configuration with modern cipher suites (AES-GCM and ChaCha20-Poly1305)
@@ -17,16 +18,20 @@ This project enables you to run dstack applications with your own custom domain,
17
18
The dstack-ingress system provides a seamless way to set up custom domains for dstack applications with automatic SSL certificate management. Here's how it works:
18
19
19
20
1.**Initial Setup**:
21
+
20
22
- When first deployed, the container automatically obtains SSL certificates from Let's Encrypt using DNS validation
21
-
- It configures Cloudflare DNS by creating necessary CNAME, TXT, and optional CAA records
23
+
- It configures your DNS provider by creating necessary CNAME, TXT, and optional CAA records
22
24
- Nginx is configured to use the obtained certificates and proxy requests to your application
23
25
24
26
2.**DNS Configuration**:
27
+
25
28
- A CNAME record is created to point your custom domain to the dstack gateway domain
26
29
- A TXT record is added with application identification information to help dstack-gateway to route traffic to your application
27
30
- If enabled, CAA records are set to restrict which Certificate Authorities can issue certificates for your domain
31
+
- The system automatically detects your DNS provider based on environment variables
28
32
29
33
3.**Certificate Management**:
34
+
30
35
- SSL certificates are automatically obtained during initial setup
31
36
- A scheduled task runs twice daily to check for certificate renewal
32
37
- When certificates are renewed, Nginx is automatically reloaded to use the new certificates
@@ -40,7 +45,8 @@ The dstack-ingress system provides a seamless way to set up custom domains for d
40
45
41
46
### Prerequisites
42
47
43
-
- Host your domain on Cloudflare and have access to the Cloudflare account with API token
48
+
- Host your domain on one of the supported DNS providers
49
+
- Have appropriate API credentials for your DNS provider (see [DNS Provider Configuration](DNS_PROVIDERS.md) for details)
44
50
45
51
### Deployment
46
52
@@ -57,7 +63,13 @@ services:
57
63
ports:
58
64
- "443:443"
59
65
environment:
66
+
# DNS Provider
67
+
- DNS_PROVIDER=cloudflare
68
+
69
+
# Cloudflare example
60
70
- CLOUDFLARE_API_TOKEN=${CLOUDFLARE_API_TOKEN}
71
+
72
+
# Common configuration
61
73
- DOMAIN=${DOMAIN}
62
74
- GATEWAY_DOMAIN=${GATEWAY_DOMAIN}
63
75
- CERTBOT_EMAIL=${CERTBOT_EMAIL}
@@ -68,21 +80,23 @@ services:
68
80
- cert-data:/etc/letsencrypt
69
81
restart: unless-stopped
70
82
app:
71
-
image: nginx # Replace with your application image
83
+
image: nginx # Replace with your application image
72
84
restart: unless-stopped
73
85
volumes:
74
-
cert-data: # Persistent volume for certificates
86
+
cert-data: # Persistent volume for certificates
75
87
```
76
88
77
-
Explanation of environment variables:
89
+
**Core Environment Variables:**
78
90
79
-
- `CLOUDFLARE_API_TOKEN`: Your Cloudflare API token
91
+
- `DNS_PROVIDER`: DNS provider to use (cloudflare, linode)
80
92
- `DOMAIN`: Your custom domain
81
-
- `GATEWAY_DOMAIN`: The dstack gateway domain. (e.g. `_.dstack-prod5.phala.network` for Phala Cloud)
93
+
- `GATEWAY_DOMAIN`: The dstack gateway domain (e.g. `_.dstack-prod5.phala.network` for Phala Cloud)
82
94
- `CERTBOT_EMAIL`: Your email address used in Let's Encrypt certificate requests
83
95
- `TARGET_ENDPOINT`: The plain HTTP endpoint of your dstack application
84
96
- `SET_CAA`: Set to `true` to enable CAA record setup
85
97
98
+
For provider-specific configuration details, see [DNS Provider Configuration](DNS_PROVIDERS.md).
99
+
86
100
#### Option 2: Build Your Own Image
87
101
88
102
If you prefer to build the image yourself:
@@ -95,6 +109,7 @@ If you prefer to build the image yourself:
95
109
```
96
110
97
111
**Important**: You must use the `build-image.sh` script to build the image. This script ensures reproducible builds with:
0 commit comments