Skip to content

Commit 38d18ee

Browse files
Merge pull request #2445 from oasisprotocol/uniyalabhishek/docs/rofl-appd-tcp-endpoint
docs: document rofl-appd TCP endpoint on localnet
2 parents d84e1a5 + 66a2239 commit 38d18ee

1 file changed

Lines changed: 46 additions & 3 deletions

File tree

Lines changed: 46 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
import Tabs from '@theme/Tabs';
2+
import TabItem from '@theme/TabItem';
3+
14
# Test
25

36
Testing of your ROFL-powered applications and services depends on the [ROFL
@@ -30,17 +33,57 @@ Simply spin up the [`sapphire-localnet`] Docker image and bind-mount the folder
3033
that contains your `rofl.yaml`:
3134

3235
```shell
33-
docker run -it -p8544-8548:8544-8548 -v .:/rofls ghcr.io/oasisprotocol/sapphire-localnet
36+
docker run -it -p8544-8549:8544-8549 -v .:/rofls ghcr.io/oasisprotocol/sapphire-localnet
3437
```
3538

3639
In a few moments you should see an output like
3740

3841
```
39-
* TDX ROFL detected. Localnet appd service will be accessible on the host via rofl-appd.sock in the shared volume
42+
* TDX ROFL detected. Localnet appd service will be accessible via UNIX socket and TCP port
4043
```
4144

4245
which means `rofl-appd.sock` will appear in the bind-mounted folder on your host
43-
when the Localnet spins up.
46+
when the Localnet spins up. The appd service is also exposed via TCP on port
47+
`8549`, if you cannot use the UNIX socket on your host (e.g. macOS):
48+
49+
<Tabs>
50+
<TabItem value="UNIX socket (Linux)">
51+
```shell title="Shell"
52+
curl --unix-socket ./rofl-appd.sock http://localhost/rofl/v1/app/id
53+
```
54+
55+
[ROFL clients] can connect to the UNIX socket as follows:
56+
57+
```python title="Python"
58+
from oasis_rofl_client import RoflClient
59+
client = RoflClient(url="./rofl-appd.sock")
60+
```
61+
62+
```typescript title="TypeScript"
63+
import { RoflClient } from '@oasisprotocol/rofl-client';
64+
const client = new RoflClient({ url: './rofl-appd.sock' });
65+
```
66+
</TabItem>
67+
<TabItem value="TCP port (macOS, Linux)">
68+
```shell title="Shell"
69+
curl http://localhost:8549/rofl/v1/app/id
70+
```
71+
72+
[ROFL clients] can connect to the TCP port as follows:
73+
74+
```python title="Python"
75+
from oasis_rofl_client import RoflClient
76+
client = RoflClient(url="http://localhost:8549")
77+
```
78+
79+
```typescript title="TypeScript"
80+
import { RoflClient } from '@oasisprotocol/rofl-client';
81+
const client = new RoflClient({ url: 'http://localhost:8549' });
82+
```
83+
</TabItem>
84+
</Tabs>
85+
86+
[ROFL clients]: ../features/appd.md#rofl-clients
4487

4588
Next, it's time to spin up your services and run tests. If you use the same
4689
`compose.yaml` for production and testing, the following one-liner may come

0 commit comments

Comments
 (0)