Skip to content

Commit deaa6e7

Browse files
authored
Merge pull request #148 from Dstack-TEE/rename-tapp
Replace "tapp" with more descriptive terms
2 parents 0c5aad4 + c1746bb commit deaa6e7

34 files changed

+119
-105
lines changed

Cargo.lock

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

README.md

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -227,35 +227,29 @@ $ curl 'http://0.0.0.0:9190/logs/zk-provider-server?text&timestamps'
227227

228228
## Reverse proxy: TLS Passthrough
229229

230-
The build configuration for TLS Passthrough is:
231-
232-
```bash
233-
GATEWAY_LISTEN_PORT_PASSTHROUGH=9008
234-
```
235-
236-
With this configuration, dstack-gateway listens port `9008` for incoming TLS connections and forwards them to the appropriate Tapp based on `SNI`, where SNI represents your custom domain and the forwarding destination is determined by your DNS records.
230+
dstack-gateway listens for incoming TLS connections and forwards them to the appropriate app based on `SNI`. If the SNI is your custom domain, dstack-gateway queries the TXT DNS record `_dstack-app-address.<custom_domain>` to determine the forwarding destination.
237231

238232
For example, assuming I've deployed an app at `3327603e03f5bd1f830812ca4a789277fc31f577`, as shown below:
239233

240234
![appid](./docs/assets/appid.png)
241235

242-
Now, I want to use my custom domain `tapp-nginx.kvin.wang` to access the Tapp. I need to set up two DNS records with my DNS provider (Cloudflare in my case):
236+
Now, I want to use my custom domain `myapp.kvin.wang` to access the app. I need to set up two DNS records with my DNS provider (Cloudflare in my case):
243237

244238
1. `A` or `CNAME` record to point the domain to the tdx machine:
245239

246-
![tapp-dns-a](./docs/assets/tapp-dns-a.png)
240+
![app-dns-a](./docs/assets/app-dns-a.png)
247241

248-
2. `TXT` record to instruct the dstack-gateway to direct the request to the specified Tapp:
242+
2. `TXT` record to instruct the dstack-gateway to direct the request to the specified app:
249243

250-
![tapp-dns-txt](./docs/assets/tapp-dns-txt.png)
244+
![app-dns-txt](./docs/assets/app-dns-txt.png)
251245

252246
Where
253247

254-
`_tapp-address.tapp-nginx.kvin.wang` means configuring the tapp destination address of domain `tapp-nginx.kvin.wang`.
248+
`_dstack-app-address.myapp.kvin.wang` means configuring the app destination address of domain `myapp.kvin.wang`.
255249

256-
The TXT record value `3327603e03f5bd1f830812ca4a789277fc31f577:8043` means that requests sent to `tapp-nginx.kvin.wang` will be processed by Tapp `3327603e03f5bd1f830812ca4a789277fc31f577` on port `8043`
250+
The TXT record value `3327603e03f5bd1f830812ca4a789277fc31f577:8043` means that requests sent to `myapp.kvin.wang` will be processed by app `3327603e03f5bd1f830812ca4a789277fc31f577` on port `8043`
257251

258-
Given the config `GATEWAY_LISTEN_PORT_PASSTHROUGH=9008`, now we can go to [`https://tapp-nginx.kvin.wang:9008`](https://tapp-nginx.kvin.wang:9008) and the request will be handled by the service listening on `8043` in Tapp `3327603e03f5bd1f830812ca4a789277fc31f577`.
252+
Now we can go to [`https://myapp.kvin.wang`](https://myapp.kvin.wang) and the request will be handled by the service listening on `8043` in app `3327603e03f5bd1f830812ca4a789277fc31f577`.
259253

260254
## Upgrade an App
261255

basefiles/app-compose.service

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ After=docker.service tboot.service dstack-guest-agent.service
66
[Service]
77
Type=oneshot
88
RemainAfterExit=true
9-
EnvironmentFile=-/tapp/.host-shared/.decrypted-env
10-
WorkingDirectory=/tapp
9+
EnvironmentFile=-/dstack/.host-shared/.decrypted-env
10+
WorkingDirectory=/dstack
1111
ExecStart=/bin/app-compose.sh
1212
ExecStop=/bin/docker compose stop
1313
StandardOutput=journal+console

basefiles/dstack-guest-agent.service

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ After=network.target tboot.service
44

55
[Service]
66
OOMScoreAdjust=-1000
7-
ExecStart=/bin/dstack-guest-agent --watchdog -c /tapp/agent.json
7+
ExecStart=/bin/dstack-guest-agent --watchdog -c /dstack/agent.json
88
Restart=always
99
User=root
1010
Group=root

docs/assets/app-dns-a.png

27.6 KB
Loading

docs/assets/app-dns-txt.png

58.5 KB
Loading

docs/assets/tapp-dns-a.png

-60.4 KB
Binary file not shown.

docs/assets/tapp-dns-txt.png

-72 KB
Binary file not shown.

docs/deployment.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -78,10 +78,10 @@ Transaction hash: 0xd413d01a0640b6193048b0e98afb7c173abe58c74d9cf01f368166bc53f4
7878
```
7979

8080
## Deploy KMS into CVM
81-
The dstack-vmm is running now. Open another terminal and go to the `kms/tapp/` directory and run the following command:
81+
The dstack-vmm is running now. Open another terminal and go to the `kms/dstack-app/` directory and run the following command:
8282

8383
```bash
84-
cd dstack/kms/tapp/
84+
cd dstack/kms/dstack-app/
8585
./deploy-to-vmm.sh
8686
```
8787
It will create a template `.env` file. Edit the `.env` file and set the required variables.
@@ -118,7 +118,7 @@ tail -f run/vm/f5299298-bf4f-43c0-839c-88c755391f3c/serial.log
118118
Wait until the KMS CVM is ready:
119119
```
120120
br-1df48b1c448a: port 2(veth36ab5cb) entered forwarding state
121-
app-compose.sh[882]: Container tapp-kms-1 Started
121+
app-compose.sh[882]: Container dstack-kms-1 Started
122122
app-compose.sh[688]: Pruning unused images
123123
app-compose.sh[8347]: Total reclaimed space: 0B
124124
app-compose.sh[688]: Pruning unused volumes
@@ -144,7 +144,7 @@ The KMS info should be then set to the kms-auth-contract [here for this example]
144144
The KMS instance is now ready to use.
145145

146146
## Deploy dstack-gateway in CVM
147-
dstack-gateway can be deployed as a Tapp in the same host as the KMS or in a different host.
147+
dstack-gateway can be deployed as a dstack app in the same host as the KMS or in a different host.
148148

149149
### Add base image MRs to the KMS whitelist
150150
In order to run user workloads that use the KMS, the OS image MRs must be added to the KMS whitelist.
@@ -161,7 +161,7 @@ npx hardhat kms:add-system --network phala --mr <mr-value>
161161
```
162162

163163
### Register dstack-gateway in KMS
164-
As a normal Tapp, it requires the app to be registered in the KmsAuth contract first.
164+
As a normal dstack app, it requires the app to be registered in the KmsAuth contract first.
165165

166166
```bash
167167
cd dstack/kms/auth-eth
@@ -182,9 +182,9 @@ App registered in KMS successfully
182182
Registered AppId: 0x31884c4b7775affe4c99735f6c2aff7d7bc6cfcd
183183
```
184184

185-
Now go to the `gateway/tapp/` directory and run the following command:
185+
Now go to the `gateway/dstack-app/` directory and run the following command:
186186
```bash
187-
cd ../../gateway/tapp/
187+
cd ../../gateway/dstack-app/
188188
./deploy-to-vmm.sh
189189
```
190190

dstack-types/src/lib.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,3 +133,12 @@ impl KeyProviderInfo {
133133
}
134134

135135
pub mod shared_filenames;
136+
137+
/// Get the address of the dstack agent
138+
pub fn dstack_agent_address() -> String {
139+
// Check env DSTACK_AGENT_ADDRESS
140+
if let Ok(address) = std::env::var("DSTACK_AGENT_ADDRESS") {
141+
return address;
142+
}
143+
"unix:/var/run/dstack.sock".into()
144+
}

0 commit comments

Comments
 (0)