This repository was archived by the owner on Nov 23, 2022. It is now read-only.
File tree Expand file tree Collapse file tree 7 files changed +34
-17
lines changed Expand file tree Collapse file tree 7 files changed +34
-17
lines changed Original file line number Diff line number Diff line change 88
88
"prepare" : " npm-run-all prepare:hooks" ,
89
89
"prepare:hooks" : " husky install" ,
90
90
"release" : " standard-version --bumpFiles package.json packages/lib/package.json packages/ipfs/package.json packages/relay/package.json packages/transport/package.json && scripts/publish" ,
91
- "serve" : " nx run-many --all --target=serve"
91
+ "serve" : " nx run-many --all --verbose -- target=serve"
92
92
},
93
93
"version" : " 0.2.48" ,
94
94
"workspaces" : [
Original file line number Diff line number Diff line change @@ -9,19 +9,13 @@ export const bootstrap = async (
9
9
const query = gql `
10
10
query Bootstrap($protocol: Protocol!, $hostname: String!, $port: Int!) {
11
11
listen(protocol: $protocol, hostname: $hostname, port: $port)
12
- peers(
13
- randomize: true
14
- protocol: $protocol
15
- hostname: $hostname
16
- port: $port
17
- )
12
+ peers(randomize: true)
18
13
}
19
14
`
20
15
21
16
const { listen, peers } = await request < {
22
17
listen : string [ ] ;
23
18
peers : string [ ] ;
24
- namespace : string ;
25
19
} > (
26
20
relay ,
27
21
query ,
Original file line number Diff line number Diff line change 16
16
"nexus" : " 1.3.0" ,
17
17
"prom-client" : " 14.0.1" ,
18
18
"redis" : " 4.0.4" ,
19
- "socket.io" : " 4.4.1"
19
+ "socket.io" : " 4.4.1" ,
20
+ "wrtc" : " ^0.4.7"
20
21
},
21
22
"devDependencies" : {
22
23
"@types/lru-cache" : " ^7.6.0" ,
Original file line number Diff line number Diff line change 1
1
import { join } from 'path'
2
2
import { Stack , Storage } from '@dstack-js/lib'
3
- // @ts -expect-error: no-types
4
- import wrtc from '@dstack-js/wrtc'
5
3
import LRUCache from 'lru-cache'
6
4
import { tmpdir } from 'os'
7
5
import { redis } from './cache'
6
+ import { getWRTC } from './wrtc'
8
7
9
8
export class RedisStorage < T = { value : string ; date : Date } >
10
9
implements Storage < T > {
@@ -62,8 +61,10 @@ export const getStack = async (namespace: string) => {
62
61
cache . set ( namespace , 'allocating' )
63
62
stack = await Stack . create ( {
64
63
namespace,
65
- wrtc,
66
- relay : `http://127.0.0.1:${ process . env [ 'PORT' ] || 13579 } /graphql` ,
64
+ wrtc : getWRTC ( ) ,
65
+ relay :
66
+ process . env [ 'RELAY_URL' ] ||
67
+ `http://127.0.0.1:${ process . env [ 'PORT' ] || 13579 } /graphql` ,
67
68
repo : join ( tmpdir ( ) , '.dstack' , namespace ) ,
68
69
storage : new RedisStorage ( namespace )
69
70
} )
@@ -78,7 +79,8 @@ export const getStack = async (namespace: string) => {
78
79
namespace ,
79
80
error
80
81
)
81
- throw error
82
+
83
+ return null
82
84
}
83
85
}
84
86
Original file line number Diff line number Diff line change
1
+ export const getWRTC = ( ) => {
2
+ try {
3
+ return require ( 'wrtc' )
4
+ } catch ( error ) {
5
+ return require ( '@dstack-js/wrtc' )
6
+ }
7
+ }
Original file line number Diff line number Diff line change 1
1
#! /bin/bash
2
- yarn build
2
+ yarn nx build relay
3
3
cd dist/packages/relay
4
- heroku container:push web -a dstack-relay
5
- heroku container:release web -a dstack-relay
4
+ fly deploy --remote-only
Original file line number Diff line number Diff line change @@ -2785,6 +2785,7 @@ __metadata:
2785
2785
socket.io: 4.4.1
2786
2786
ts-node: 10.7.0
2787
2787
tsconfig-paths: 3.14.1
2788
+ wrtc: ^0.4.7
2788
2789
bin:
2789
2790
dstack-relay: src/index.js
2790
2791
languageName: unknown
@@ -28279,6 +28280,19 @@ __metadata:
28279
28280
languageName: node
28280
28281
linkType: hard
28281
28282
28283
+ "wrtc@npm:^0.4.7":
28284
+ version: 0.4.7
28285
+ resolution: "wrtc@npm:0.4.7"
28286
+ dependencies:
28287
+ domexception: ^1.0.1
28288
+ node-pre-gyp: ^0.13.0
28289
+ dependenciesMeta:
28290
+ domexception:
28291
+ optional: true
28292
+ checksum: 2a2ce03ee15e8ee1737a9b8d0937ededc135f06c8e58bb8c3c0d7028e29ef0b75708616d2ce2a1792c08fab24b2f4c51a8f0d52fe3b296d5d7ac31a8d6eeab5c
28293
+ languageName: node
28294
+ linkType: hard
28295
+
28282
28296
"ws@npm:^7.3.1, ws@npm:^7.4.6":
28283
28297
version: 7.5.7
28284
28298
resolution: "ws@npm:7.5.7"
You can’t perform that action at this time.
0 commit comments