Skip to content

Commit 7f3face

Browse files
authored
Merge pull request #52 from Dstack-TEE/feat-custom-domain-dstack-sock
ingress: added dstack v0.5.x support
2 parents f8e9cae + fd9ea9a commit 7f3face

File tree

4 files changed

+16
-2
lines changed

4 files changed

+16
-2
lines changed

custom-domain/dstack-ingress/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ services:
7676
- SET_CAA=true
7777
- TARGET_ENDPOINT=http://app:80
7878
volumes:
79+
- /var/run/dstack.sock:/var/run/dstack.sock
7980
- /var/run/tappd.sock:/var/run/tappd.sock
8081
- cert-data:/etc/letsencrypt
8182
restart: unless-stopped
@@ -146,6 +147,7 @@ services:
146147
- SET_CAA=true
147148
- TARGET_ENDPOINT=grpc://app:50051
148149
volumes:
150+
- /var/run/dstack.sock:/var/run/dstack.sock
149151
- /var/run/tappd.sock:/var/run/tappd.sock
150152
- cert-data:/etc/letsencrypt
151153
restart: unless-stopped

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ services:
1111
- SET_CAA=true
1212
- TARGET_ENDPOINT=http://app:80
1313
volumes:
14+
- /var/run/dstack.sock:/var/run/dstack.sock
1415
- /var/run/tappd.sock:/var/run/tappd.sock
1516
- cert-data:/etc/letsencrypt
1617
restart: unless-stopped

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

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,14 @@ set_txt_record() {
103103
local APP_ID
104104

105105
# Generate a unique app ID if not provided
106-
APP_ID=${APP_ID:-$(curl -s --unix-socket /var/run/tappd.sock http://localhost/prpc/Tappd.Info | jq -j '.app_id')}
106+
if [[ -e /var/run/dstack.sock ]]; then
107+
DSTACK_APP_ID=$(curl -s --unix-socket /var/run/dstack.sock http://localhost/Info | jq -j .app_id)
108+
export DSTACK_APP_ID
109+
else
110+
DSTACK_APP_ID=$(curl -s --unix-socket /var/run/tappd.sock http://localhost/prpc/Tappd.Info | jq -j .app_id)
111+
export DSTACK_APP_ID
112+
fi
113+
APP_ID=${APP_ID:-"$DSTACK_APP_ID"}
107114

108115
# Use the unified DNS manager to set the TXT record
109116
source /opt/app-venv/bin/activate

custom-domain/dstack-ingress/scripts/generate-evidences.sh

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,11 @@ while [ ${#PADDED_HASH} -lt 128 ]; do
1919
done
2020
QUOTED_HASH="${PADDED_HASH}"
2121

22-
curl -s --unix-socket /var/run/tappd.sock "http://localhost/prpc/Tappd.RawQuote?report_data=${QUOTED_HASH}" > quote.json
22+
if [[ -e /var/run/dstack.sock ]]; then
23+
curl -s --unix-socket /var/run/dstack.sock "http://localhost/prpc/GetQuote?report_data=${QUOTED_HASH}" > quote.json
24+
else
25+
curl -s --unix-socket /var/run/tappd.sock "http://localhost/prpc/Tappd.RawQuote?report_data=${QUOTED_HASH}" > quote.json
26+
fi
2327
if [ $? -ne 0 ]; then
2428
echo "Error: Failed to generate evidences"
2529
exit 1

0 commit comments

Comments
 (0)