Skip to content

Commit fd9ea9a

Browse files
committed
imp: try dstack.sock first and failback to tappd.sock
1 parent a66e9be commit fd9ea9a

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
@@ -107,7 +107,14 @@ set_txt_record() {
107107
local APP_ID
108108

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

112119
# Use the unified DNS manager to set the TXT record
113120
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)