Skip to content
This repository was archived by the owner on Nov 23, 2022. It is now read-only.

Commit 63e957b

Browse files
committed
chore(docs): update relay and lib
1 parent c1ed10b commit 63e957b

File tree

4 files changed

+33
-68
lines changed

4 files changed

+33
-68
lines changed

docs/docs/deploy-relay.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ title: Deploy Relay
33
sidebar_position: 1
44
---
55

6-
Relay provides DStack peer with [`libp2p-webrtc-star`](https://github.com/libp2p/js-libp2p-webrtc-star) compatible signaling server written with multi-tenancy support using redis
6+
Relay provides DStack peer with `@dstack-js/transport` compatible signaling server written with multi-tenancy support using redis
77

88
## Public Relay
99

docs/docs/intro.mdx

Lines changed: 12 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
title: Quick Look
33
sidebar_position: 1
44
---
5-
6-
import Flowchart from '../src/components/Flowchart';
5+
import Tabs from '@theme/Tabs';
6+
import TabItem from '@theme/TabItem';
77

88
_DStack is under heavy development, currently some docs is not finished yet_
99

@@ -21,87 +21,37 @@ For example, you can create a collaborative real-time WYSIWYG editor with file p
2121

2222
![Demo](https://i.imgur.com/cKjBrge.gif)
2323

24-
### Architecture
25-
26-
<Flowchart
27-
snapToGrid={true}
28-
elements={[
29-
{
30-
id: 'ipfs',
31-
type: 'input',
32-
data: { label: 'IPFS' },
33-
position: { x: 400, y: 25 },
34-
},
35-
{
36-
id: 'stack',
37-
data: { label: 'Stack' },
38-
position: { x: 400, y: 100 },
39-
},
40-
{
41-
id: 'pubsub',
42-
type: 'output',
43-
data: { label: 'PubSub' },
44-
style: { borderColor: '#000' },
45-
position: { x: 200, y: 300 },
46-
},
47-
{
48-
id: 'store',
49-
data: { label: 'Store' },
50-
position: { x: 500, y: 250 },
51-
},
52-
{
53-
id: 'shard',
54-
type: 'output',
55-
style: { borderColor: '#000' },
56-
data: { label: 'Shard' },
57-
position: { x: 500, y: 350 },
58-
},
59-
// animated edge
60-
{ id: 'e1-2', source: 'ipfs', target: 'stack', animated: true },
61-
{ id: 'e2-3', source: 'stack', target: 'pubsub' },
62-
{ id: 'e3-4', source: 'stack', target: 'store' },
63-
{
64-
id: 'e4-5',
65-
source: 'store',
66-
target: 'shard',
67-
animated: true,
68-
},
69-
]}
70-
/>
71-
7224
## Play with DStack in browser console
7325

7426
https://explorer.dstack.dev/
7527

7628
## Add DStack to your project
7729

78-
Using Yarn:
30+
<Tabs>
31+
<TabItem value="yarn" label="Yarn">
7932

8033
```shell
8134
yarn add @dstack-js/lib
8235
```
8336

84-
Using NPM:
37+
</TabItem>
38+
<TabItem value="npm" label="NPM">
8539

8640
```shell
8741
npm i -S @dstack-js/lib
8842
```
8943

90-
You also need IPFS, can use `@dstack-js/ipfs` or `ipfs-core@^0.13.0`, `@dstack-js/ipfs` provides zero configuration package for DStack.
44+
</TabItem>
45+
</Tabs>
9146

9247
### Initialize Stack
9348

9449
```javascript
95-
import { create } from '@dstack-js/ipfs';
9650
import { Stack } from '@dstack-js/lib';
97-
98-
// Browser:
99-
const ipfs = await create();
100-
// In Node.js environment you need to provide WebRTC implementation
101-
// const wrtc = require('@dstack-js/wrtc');
102-
// const ipfs = await create({}, wrtc);
103-
104-
const stack = await Stack.create('namespace', ipfs);
51+
// In non-browser environment you need to provide WebRTC implementation
52+
// import wrtc from '@dstack-js/wrtc';
53+
// const stack = await Stack.create({ namespace: 'namespace', wrtc });
54+
const stack = await Stack.create({ namespace: 'namespace' });
10555

10656
console.log('My Peer ID is:', stack.id);
10757
```

docs/docs/relay.mdx

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ sidebar_position: 1
66
import Tabs from '@theme/Tabs';
77
import TabItem from '@theme/TabItem';
88

9-
Relay provides [`libp2p-webrtc-star`](https://github.com/libp2p/js-libp2p-webrtc-star) compatible scalable signaling server and GraphQL API
9+
Relay provides `@dstack-js/transport` compatible scalable signaling server and GraphQL API
1010

1111
## Public Relay
1212

@@ -20,6 +20,23 @@ You can check status and uptime here: https://status.dstack.dev
2020

2121
## Getting Bootstrap data
2222

23+
As of version v0.2.46 no need to bootstrap
24+
25+
you can provide an GraphQL endpoint to your relay directly in `@dstack-js/lib`
26+
27+
```javascript
28+
import { Stack } from '@dstack-js/lib';
29+
30+
const stack = await Stack.create({
31+
namespace: 'namespace',
32+
relay: 'https://relay.dstack.dev:443/graphql'
33+
});
34+
```
35+
36+
<details>
37+
38+
<summary> How to get bootstrap data </summary>
39+
2340
Relay provides necessary GraphQL resolvers for initializing the [Stack instance](./stack.md)
2441

2542
<Tabs>
@@ -87,16 +104,14 @@ export const createStack = async () => {
87104
Bootstrap: peers
88105
}
89106
});
90-
91-
const stack = await Stack.create('namespace', ipfs);
92107
};
93108
```
94109

95110
</TabItem>
96111
</Tabs>
97112

98113

99-
114+
</details>
100115

101116
## Endpoints
102117

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@
7070
"yaml-crypt": "0.7.6",
7171
"zx": "6.0.7"
7272
},
73-
"license": "GPl-3.0",
73+
"license": "GPL-3.0",
7474
"lint-staged": {
7575
"*.{yaml,json,md}": "prettier --write",
7676
"*.{js,jsx,tsx,ts,css}": [

0 commit comments

Comments
 (0)