Skip to content

Commit f8e9cae

Browse files
authored
Merge pull request #50 from Dstack-TEE/feat-namecheap-supports
ingress: added namecheap support
2 parents 7c5c4f2 + 3311679 commit f8e9cae

File tree

10 files changed

+677
-62
lines changed

10 files changed

+677
-62
lines changed

custom-domain/dstack-ingress/DNS_PROVIDERS.md

Lines changed: 58 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,28 @@ 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/apiaccess/)
69+
- `NAMECHEAP_CLIENT_IP` - The IP address of the node (required for Namecheap API authentication)
70+
71+
**Important Notes for Namecheap:**
72+
- Namecheap API requires node IP address for authentication, and you need add it to whitelist IP first.
73+
- Namecheap doesn't support CAA records through their API currently
74+
- The certbot plugin uses the format `certbot-dns-namecheap` package
75+
76+
## Docker Compose Examples
77+
78+
### Linode Example
5779

5880
```yaml
5981
version: '3.8'
@@ -78,6 +100,33 @@ services:
78100
- ./evidences:/evidences
79101
```
80102
103+
### Namecheap Example
104+
105+
```yaml
106+
version: '3.8'
107+
108+
services:
109+
ingress:
110+
image: dstack-ingress:latest
111+
ports:
112+
- "443:443"
113+
environment:
114+
# Common configuration
115+
- DNS_PROVIDER=namecheap
116+
- DOMAIN=app.example.com
117+
- GATEWAY_DOMAIN=_.dstack-prod5.phala.network
118+
119+
- TARGET_ENDPOINT=http://backend:8080
120+
121+
# Namecheap specific
122+
- NAMECHEAP_USERNAME=your-username
123+
- NAMECHEAP_API_KEY=your-api-key
124+
- NAMECHEAP_CLIENT_IP=your-public-ip
125+
volumes:
126+
- ./letsencrypt:/etc/letsencrypt
127+
- ./evidences:/evidences
128+
```
129+
81130
## Migration from Cloudflare-only Setup
82131
83132
If you're currently using the Cloudflare-only version:
@@ -111,4 +160,10 @@ Ensure your API tokens/credentials have the necessary permissions listed above f
111160
### Linode
112161
1. Go to https://cloud.linode.com/profile/tokens
113162
2. Create a Personal Access Token
114-
3. Grant "Domains" Read/Write access
163+
3. Grant "Domains" Read/Write access
164+
165+
### Namecheap
166+
1. Go to https://ap.www.namecheap.com/settings/tools/api-access/
167+
2. Enable API access for your account
168+
3. Note down your API key and username
169+
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)