Skip to content

Commit eb9e00b

Browse files
committed
feat: added namecheap support for custom-domain
1 parent a66e9be commit eb9e00b

File tree

7 files changed

+681
-60
lines changed

7 files changed

+681
-60
lines changed

custom-domain/dstack-ingress/DNS_PROVIDERS.md

Lines changed: 60 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ This guide explains how to configure dstack-ingress to work with different DNS p
66

77
- **Cloudflare** - The original and default provider
88
- **Linode DNS** - For Linode-hosted domains
9+
- **Namecheap** - For Namecheap-hosted domains
910

1011
## Environment Variables
1112

@@ -15,7 +16,7 @@ This guide explains how to configure dstack-ingress to work with different DNS p
1516
- `GATEWAY_DOMAIN` - dstack gateway domain (e.g., `_.dstack-prod5.phala.network`)
1617
- `CERTBOT_EMAIL` - Email for Let's Encrypt registration
1718
- `TARGET_ENDPOINT` - Backend application endpoint to proxy to
18-
- `DNS_PROVIDER` - DNS provider to use (`cloudflare`, `linode`)
19+
- `DNS_PROVIDER` - DNS provider to use (`cloudflare`, `linode`, `namecheap`)
1920

2021
### Optional Variables
2122

@@ -53,7 +54,30 @@ LINODE_API_TOKEN=your-api-token
5354
- If resolution fails, it falls back to CNAME (but CAA records won't work on that subdomain)
5455
- This is a Linode-specific limitation not present in other providers
5556

56-
## Docker Compose Example
57+
### Namecheap
58+
59+
```bash
60+
DNS_PROVIDER=namecheap
61+
NAMECHEAP_USERNAME=your-username
62+
NAMECHEAP_API_KEY=your-api-key
63+
NAMECHEAP_CLIENT_IP=your-client-ip
64+
```
65+
66+
**Required Credentials:**
67+
- `NAMECHEAP_USERNAME` - Your Namecheap account username
68+
- `NAMECHEAP_API_KEY` - Your Namecheap API key (from https://ap.www.namecheap.com/settings/tools/api-access/)
69+
- `NAMECHEAP_CLIENT_IP` - Your public IP address (required for Namecheap API authentication)
70+
71+
**Important Notes for Namecheap:**
72+
- Namecheap API requires your client IP address for authentication
73+
- You can find your public IP at https://www.whatismyip.com/
74+
- Namecheap doesn't support CAA records through their API currently
75+
- The certbot plugin uses the format `certbot-dns-namecheap` package
76+
- DNS propagation time is set to 120 seconds by default
77+
78+
## Docker Compose Examples
79+
80+
### Linode Example
5781

5882
```yaml
5983
version: '3.8'
@@ -78,6 +102,33 @@ services:
78102
- ./evidences:/evidences
79103
```
80104
105+
### Namecheap Example
106+
107+
```yaml
108+
version: '3.8'
109+
110+
services:
111+
ingress:
112+
image: dstack-ingress:latest
113+
ports:
114+
- "443:443"
115+
environment:
116+
# Common configuration
117+
- DNS_PROVIDER=namecheap
118+
- DOMAIN=app.example.com
119+
- GATEWAY_DOMAIN=_.dstack-prod5.phala.network
120+
121+
- TARGET_ENDPOINT=http://backend:8080
122+
123+
# Namecheap specific
124+
- NAMECHEAP_USERNAME=your-username
125+
- NAMECHEAP_API_KEY=your-api-key
126+
- NAMECHEAP_CLIENT_IP=your-public-ip
127+
volumes:
128+
- ./letsencrypt:/etc/letsencrypt
129+
- ./evidences:/evidences
130+
```
131+
81132
## Migration from Cloudflare-only Setup
82133
83134
If you're currently using the Cloudflare-only version:
@@ -111,4 +162,10 @@ Ensure your API tokens/credentials have the necessary permissions listed above f
111162
### Linode
112163
1. Go to https://cloud.linode.com/profile/tokens
113164
2. Create a Personal Access Token
114-
3. Grant "Domains" Read/Write access
165+
3. Grant "Domains" Read/Write access
166+
167+
### Namecheap
168+
1. Go to https://ap.www.namecheap.com/settings/tools/api-access/
169+
2. Enable API access for your account
170+
3. Note down your API key and username
171+
4. Make sure your IP address is whitelisted in the API settings

custom-domain/dstack-ingress/Dockerfile

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ RUN set -e; \
1818
done && \
1919
apt-get update && \
2020
apt-get install -y --no-install-recommends \
21-
certbot \
2221
openssl \
2322
bash \
2423
python3-pip \
@@ -32,6 +31,17 @@ RUN set -e; \
3231

3332
RUN mkdir -p /etc/letsencrypt /var/www/certbot /usr/share/nginx/html
3433

34+
# Set up Python virtual environment and install certbot
35+
RUN set -e; \
36+
python3 -m venv --system-site-packages /opt/app-venv && \
37+
. /opt/app-venv/bin/activate && \
38+
pip install --upgrade pip && \
39+
pip install certbot requests && \
40+
# Create symlinks for system-wide access
41+
ln -sf /opt/app-venv/bin/certbot /usr/local/bin/certbot && \
42+
# Ensure the virtual environment is always activated for scripts
43+
echo 'source /opt/app-venv/bin/activate' > /etc/profile.d/app-venv.sh
44+
3545
COPY ./scripts /scripts/
3646
RUN chmod +x /scripts/*.sh /scripts/*.py
3747
ENV PATH="/scripts:$PATH"

0 commit comments

Comments
 (0)