Skip to content

Commit 1427400

Browse files
committed
ingress: Support for gRPC proxy
1 parent 6c8e0d9 commit 1427400

File tree

4 files changed

+45
-9
lines changed

4 files changed

+45
-9
lines changed

custom-domain/dstack-ingress/README.md

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ The fastest way to get started is to use our pre-built image. Simply use the fol
5353
```yaml
5454
services:
5555
dstack-ingress:
56-
image: kvin/dstack-ingress@sha256:0f9d97aee13764895f967a00874418330a56e20cf4b0a4c2700934c5755b3350
56+
image: kvin/dstack-ingress@sha256:b61d50360c7a4e5ab7d22f5ce87677714f3f64a65db34ee5eebcc54683950c89
5757
ports:
5858
- "443:443"
5959
environment:
@@ -110,6 +110,37 @@ docker push yourusername/dstack-ingress:tag
110110

111111
4. Update the docker-compose.yaml file with your image name and deploy
112112

113+
114+
#### gRPC Support
115+
116+
If your dstack application uses gRPC, you can set `TARGET_ENDPOINT` to `grpc://app:50051`.
117+
118+
example:
119+
120+
```yaml
121+
services:
122+
dstack-ingress:
123+
image: kvin/dstack-ingress@sha256:b61d50360c7a4e5ab7d22f5ce87677714f3f64a65db34ee5eebcc54683950c89
124+
ports:
125+
- "443:443"
126+
environment:
127+
- CLOUDFLARE_API_TOKEN=${CLOUDFLARE_API_TOKEN}
128+
- DOMAIN=${DOMAIN}
129+
- GATEWAY_DOMAIN=${GATEWAY_DOMAIN}
130+
- CERTBOT_EMAIL=${CERTBOT_EMAIL}
131+
- SET_CAA=true
132+
- TARGET_ENDPOINT=grpc://app:50051
133+
volumes:
134+
- /var/run/tappd.sock:/var/run/tappd.sock
135+
- cert-data:/etc/letsencrypt
136+
restart: unless-stopped
137+
app:
138+
image: your-grpc-app
139+
restart: unless-stopped
140+
volumes:
141+
cert-data:
142+
```
143+
113144
## Domain Attestation and Verification
114145

115146
The dstack-ingress system provides mechanisms to verify and attest that your custom domain endpoint is secure and properly configured. This comprehensive verification approach ensures the integrity and authenticity of your application.

custom-domain/dstack-ingress/docker-compose.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
services:
22
dstack-ingress:
3-
image: kvin/dstack-ingress@sha256:0f9d97aee13764895f967a00874418330a56e20cf4b0a4c2700934c5755b3350
3+
image: kvin/dstack-ingress@sha256:b61d50360c7a4e5ab7d22f5ce87677714f3f64a65db34ee5eebcc54683950c89
44
ports:
55
- "443:443"
66
environment:

custom-domain/dstack-ingress/scripts/entrypoint.sh

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,11 @@ setup_py_env() {
1212
pip install certbot-dns-cloudflare==4.0.0
1313
}
1414

15+
PROXY_CMD="proxy"
16+
if [[ "${TARGET_ENDPOINT}" == grpc://* ]]; then
17+
PROXY_CMD="grpc"
18+
fi
19+
1520
setup_nginx_conf() {
1621
cat <<EOF > /etc/nginx/conf.d/default.conf
1722
server {
@@ -54,11 +59,11 @@ server {
5459
ssl_early_data off;
5560
5661
location / {
57-
proxy_pass ${TARGET_ENDPOINT};
58-
proxy_set_header Host \$host;
59-
proxy_set_header X-Real-IP \$remote_addr;
60-
proxy_set_header X-Forwarded-For \$proxy_add_x_forwarded_for;
61-
proxy_set_header X-Forwarded-Proto \$scheme;
62+
${PROXY_CMD}_pass ${TARGET_ENDPOINT};
63+
${PROXY_CMD}_set_header Host \$host;
64+
${PROXY_CMD}_set_header X-Real-IP \$remote_addr;
65+
${PROXY_CMD}_set_header X-Forwarded-For \$proxy_add_x_forwarded_for;
66+
${PROXY_CMD}_set_header X-Forwarded-Proto \$scheme;
6267
}
6368
6469
location /evidences/ {

launcher/build-image.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,6 @@ if ! docker buildx inspect buildkit_20 &>/dev/null; then
1010
fi
1111
touch pinned-packages.txt
1212
git rev-parse HEAD > .GIT_REV
13-
docker buildx build --builder buildkit_20 --no-cache --build-arg SOURCE_DATE_EPOCH="0" --output type=docker,name=$NAME,rewrite-timestamp=true .
13+
docker buildx build --platform linux/amd64 --builder buildkit_20 --no-cache --build-arg SOURCE_DATE_EPOCH="0" --output type=docker,name=$NAME,rewrite-timestamp=true .
1414
docker run --rm --entrypoint bash $NAME -c "dpkg -l | grep '^ii' |awk '{print \$2\"=\"\$3}' | sort" > pinned-packages.txt
15-
rm .GIT_REV
15+
rm .GIT_REV

0 commit comments

Comments
 (0)