This repository was archived by the owner on Aug 21, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 4
Fixed issues with Mediasoup port allocation. #7979
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
6d2eb83
Fixed issues with Mediasoup port allocation.
barankyle ad0dfa7
Merge branch 'dev' into mediasoup-port-refactor
hanzlamateen adc8cd6
Merge branch 'dev' into mediasoup-port-refactor
hanzlamateen ac2a1ce
Merge branch 'dev' into mediasoup-port-refactor
hanzlamateen fd3f20c
Merge branch 'dev' of https://github.com/EtherealEngine/etherealengin…
HexaField 3813d56
Merge branch 'dev' into mediasoup-port-refactor
hanzlamateen 62985ff
Merge branch 'dev' into mediasoup-port-refactor
hanzlamateen File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,48 +1,57 @@ | ||
| /* eslint-disable @typescript-eslint/no-var-requires */ | ||
|
|
||
| import { DeleteObjectsCommand, GetObjectCommand, ListObjectsV2Command } from '@aws-sdk/client-s3' | ||
| import cli from 'cli' | ||
| import { buffer } from 'node:stream/consumers' | ||
|
|
||
| import { | ||
| createDefaultStorageProvider, | ||
| getStorageProvider | ||
| } from '@etherealengine/server-core/src/media/storageprovider/storageprovider' | ||
| import { buffer } from 'node:stream/consumers' | ||
| import { DeleteObjectsCommand, GetObjectCommand, ListObjectsV2Command } from '@aws-sdk/client-s3' | ||
|
|
||
| cli.enable('status'); | ||
| cli.enable('status') | ||
|
|
||
| const options = cli.parse({ | ||
| bucket: [true, 'Name of Bucket', 'string'], | ||
| releaseName: [true, 'Name of release', 'string'] | ||
| }); | ||
| bucket: [true, 'Name of Bucket', 'string'], | ||
| releaseName: [true, 'Name of release', 'string'] | ||
| }) | ||
|
|
||
| cli.main(async () => { | ||
| try { | ||
| await createDefaultStorageProvider() | ||
| const storageProvider = getStorageProvider() | ||
| const s3 = storageProvider.provider | ||
| const listCommand = new ListObjectsV2Command({ | ||
| Bucket: options.bucket, | ||
| Prefix: 'blobs/', | ||
| Delimiter: '/' | ||
| }) | ||
| const result = await s3.send(listCommand) | ||
| const manifestCommand = new GetObjectCommand({ Bucket: options.bucket, Key: `manifests/latest_${options.releaseName}` }) | ||
| const manifestResult = await s3.send(manifestCommand) | ||
| const bufferBody = await buffer(manifestResult.Body) | ||
| const manifest = JSON.parse(bufferBody.toString()) | ||
| const layers = manifest.layers | ||
| const matches = layers.map(layer => layer.blob) | ||
| const layersToRemove = result.Contents.filter(item => matches.indexOf(item.Key.replace('blobs/', '')) < 0).map(item => { return { Key: item.Key }}) | ||
| const deleteCommand = new DeleteObjectsCommand({ | ||
| Bucket: options.bucket, | ||
| Delete: { | ||
| Objects: layersToRemove | ||
| } | ||
| }) | ||
| await s3.send(deleteCommand) | ||
| console.log('Pruned Docker build cache', options) | ||
| process.exit(0) | ||
| } catch(err) { | ||
| console.log('Error in pruning Docker build cache', options); | ||
| console.log(err); | ||
| } | ||
| }); | ||
| try { | ||
| await createDefaultStorageProvider() | ||
| const storageProvider = getStorageProvider() | ||
| const s3 = storageProvider.provider | ||
| const listCommand = new ListObjectsV2Command({ | ||
| Bucket: options.bucket, | ||
| Prefix: 'blobs/', | ||
| Delimiter: '/' | ||
| }) | ||
| const result = await s3.send(listCommand) | ||
| const manifestCommand = new GetObjectCommand({ | ||
| Bucket: options.bucket, | ||
| Key: `manifests/latest_${options.releaseName}` | ||
| }) | ||
| const manifestResult = await s3.send(manifestCommand) | ||
| const bufferBody = await buffer(manifestResult.Body) | ||
| const manifest = JSON.parse(bufferBody.toString()) | ||
| const layers = manifest.layers | ||
| const matches = layers.map((layer) => layer.blob) | ||
| const layersToRemove = result.Contents.filter((item) => matches.indexOf(item.Key.replace('blobs/', '')) < 0).map( | ||
| (item) => { | ||
| return { Key: item.Key } | ||
| } | ||
| ) | ||
| const deleteCommand = new DeleteObjectsCommand({ | ||
| Bucket: options.bucket, | ||
| Delete: { | ||
| Objects: layersToRemove | ||
| } | ||
| }) | ||
| await s3.send(deleteCommand) | ||
| console.log('Pruned Docker build cache', options) | ||
| process.exit(0) | ||
| } catch (err) { | ||
| console.log('Error in pruning Docker build cache', options) | ||
| console.log(err) | ||
| } | ||
| }) |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.