This repository was archived by the owner on Nov 23, 2022. It is now read-only.
File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 8888 "prepare" : " npm-run-all prepare:hooks" ,
8989 "prepare:hooks" : " husky install" ,
9090 "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"
9292 },
9393 "version" : " 0.2.48" ,
9494 "workspaces" : [
Original file line number Diff line number Diff line change @@ -9,19 +9,13 @@ export const bootstrap = async (
99 const query = gql `
1010 query Bootstrap($protocol: Protocol!, $hostname: String!, $port: Int!) {
1111 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)
1813 }
1914 `
2015
2116 const { listen, peers } = await request < {
2217 listen : string [ ] ;
2318 peers : string [ ] ;
24- namespace : string ;
2519 } > (
2620 relay ,
2721 query ,
Original file line number Diff line number Diff line change 1616 "nexus" : " 1.3.0" ,
1717 "prom-client" : " 14.0.1" ,
1818 "redis" : " 4.0.4" ,
19- "socket.io" : " 4.4.1"
19+ "socket.io" : " 4.4.1" ,
20+ "wrtc" : " ^0.4.7"
2021 },
2122 "devDependencies" : {
2223 "@types/lru-cache" : " ^7.6.0" ,
Original file line number Diff line number Diff line change 11import { join } from 'path'
22import { Stack , Storage } from '@dstack-js/lib'
3- // @ts -expect-error: no-types
4- import wrtc from '@dstack-js/wrtc'
53import LRUCache from 'lru-cache'
64import { tmpdir } from 'os'
75import { redis } from './cache'
6+ import { getWRTC } from './wrtc'
87
98export class RedisStorage < T = { value : string ; date : Date } >
109implements Storage < T > {
@@ -62,8 +61,10 @@ export const getStack = async (namespace: string) => {
6261 cache . set ( namespace , 'allocating' )
6362 stack = await Stack . create ( {
6463 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` ,
6768 repo : join ( tmpdir ( ) , '.dstack' , namespace ) ,
6869 storage : new RedisStorage ( namespace )
6970 } )
@@ -78,7 +79,8 @@ export const getStack = async (namespace: string) => {
7879 namespace ,
7980 error
8081 )
81- throw error
82+
83+ return null
8284 }
8385 }
8486
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 11#! /bin/bash
2- yarn build
2+ yarn nx build relay
33cd 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:
27852785 socket.io: 4.4.1
27862786 ts-node: 10.7.0
27872787 tsconfig-paths: 3.14.1
2788+ wrtc: ^0.4.7
27882789 bin:
27892790 dstack-relay: src/index.js
27902791 languageName: unknown
@@ -28279,6 +28280,19 @@ __metadata:
2827928280 languageName: node
2828028281 linkType: hard
2828128282
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+
2828228296"ws@npm:^7.3.1, ws@npm:^7.4.6":
2828328297 version: 7.5.7
2828428298 resolution: "ws@npm:7.5.7"
You can’t perform that action at this time.
0 commit comments