Add config to disable storing lives in s3
This commit is contained in:
parent
c2c2cd4121
commit
68d006b6fc
|
@ -222,6 +222,12 @@ object_storage:
|
||||||
# Useful when you want to use a CDN/external proxy
|
# Useful when you want to use a CDN/external proxy
|
||||||
base_url: '' # Example: 'https://mirror.example.com'
|
base_url: '' # Example: 'https://mirror.example.com'
|
||||||
|
|
||||||
|
# PeerTube makes many small requests to the object storage provider to upload/delete/update live chunks
|
||||||
|
# which can be a problem depending on your object storage provider
|
||||||
|
# You can also choose to disable this feature to reduce live streams latency
|
||||||
|
# Live stream replays are not affected by this setting, so they are uploaded in object storage as regular VOD videos
|
||||||
|
store_live_streams: true
|
||||||
|
|
||||||
web_videos:
|
web_videos:
|
||||||
bucket_name: 'web-videos'
|
bucket_name: 'web-videos'
|
||||||
prefix: ''
|
prefix: ''
|
||||||
|
|
|
@ -220,6 +220,12 @@ object_storage:
|
||||||
# Useful when you want to use a CDN/external proxy
|
# Useful when you want to use a CDN/external proxy
|
||||||
base_url: '' # Example: 'https://mirror.example.com'
|
base_url: '' # Example: 'https://mirror.example.com'
|
||||||
|
|
||||||
|
# PeerTube makes many small requests to the object storage provider to upload/delete/update live chunks
|
||||||
|
# which can be a problem depending on your object storage provider
|
||||||
|
# You can also choose to disable this feature to reduce live streams latency
|
||||||
|
# Live stream replays are not affected by this setting, so they are uploaded in object storage as regular VOD videos
|
||||||
|
store_live_streams: true
|
||||||
|
|
||||||
web_videos:
|
web_videos:
|
||||||
bucket_name: 'web-videos'
|
bucket_name: 'web-videos'
|
||||||
prefix: ''
|
prefix: ''
|
||||||
|
|
|
@ -29,7 +29,11 @@ export class ObjectStorageCommand {
|
||||||
return 'us-east-1'
|
return 'us-east-1'
|
||||||
}
|
}
|
||||||
|
|
||||||
getDefaultMockConfig () {
|
getDefaultMockConfig (options: {
|
||||||
|
storeLiveStreams?: boolean // default true
|
||||||
|
} = {}) {
|
||||||
|
const { storeLiveStreams = true } = options
|
||||||
|
|
||||||
return {
|
return {
|
||||||
object_storage: {
|
object_storage: {
|
||||||
enabled: true,
|
enabled: true,
|
||||||
|
@ -39,7 +43,9 @@ export class ObjectStorageCommand {
|
||||||
credentials: ObjectStorageCommand.getMockCredentialsConfig(),
|
credentials: ObjectStorageCommand.getMockCredentialsConfig(),
|
||||||
|
|
||||||
streaming_playlists: {
|
streaming_playlists: {
|
||||||
bucket_name: this.getMockStreamingPlaylistsBucketName()
|
bucket_name: this.getMockStreamingPlaylistsBucketName(),
|
||||||
|
|
||||||
|
store_live_streams: storeLiveStreams
|
||||||
},
|
},
|
||||||
|
|
||||||
web_videos: {
|
web_videos: {
|
||||||
|
|
|
@ -305,6 +305,49 @@ describe('Object storage for lives', function () {
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
describe('With live stream to object storage disabled', function () {
|
||||||
|
let videoUUID: string
|
||||||
|
|
||||||
|
before(async function () {
|
||||||
|
await servers[0].kill()
|
||||||
|
await servers[0].run(objectStorage.getDefaultMockConfig({ storeLiveStreams: false }))
|
||||||
|
await servers[0].config.enableLive({ transcoding: false })
|
||||||
|
|
||||||
|
videoUUID = await createLive(servers[0], false)
|
||||||
|
})
|
||||||
|
|
||||||
|
it('Should create a live and keep it on file system', async function () {
|
||||||
|
this.timeout(220000)
|
||||||
|
|
||||||
|
const ffmpegCommand = await servers[0].live.sendRTMPStreamInVideo({ videoId: videoUUID })
|
||||||
|
await waitUntilLivePublishedOnAllServers(servers, videoUUID)
|
||||||
|
|
||||||
|
await testLiveVideoResolutions({
|
||||||
|
originServer: servers[0],
|
||||||
|
sqlCommand: sqlCommandServer1,
|
||||||
|
servers,
|
||||||
|
liveVideoId: videoUUID,
|
||||||
|
resolutions: [ 720 ],
|
||||||
|
transcoded: false,
|
||||||
|
objectStorage: undefined
|
||||||
|
})
|
||||||
|
|
||||||
|
// Should not have files on object storage
|
||||||
|
await checkFilesCleanup({ server: servers[0], videoUUID, resolutions: [ 720 ], objectStorage })
|
||||||
|
|
||||||
|
await stopFfmpeg(ffmpegCommand)
|
||||||
|
})
|
||||||
|
|
||||||
|
it('Should have saved the replay on object storage', async function () {
|
||||||
|
this.timeout(220000)
|
||||||
|
|
||||||
|
await waitUntilLiveReplacedByReplayOnAllServers(servers, videoUUID)
|
||||||
|
await waitJobs(servers)
|
||||||
|
|
||||||
|
await checkFilesExist({ servers, videoUUID, numberOfFiles: 1, objectStorage })
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
after(async function () {
|
after(async function () {
|
||||||
await sqlCommandServer1.cleanup()
|
await sqlCommandServer1.cleanup()
|
||||||
await objectStorage.cleanupMock()
|
await objectStorage.cleanupMock()
|
||||||
|
|
|
@ -152,7 +152,8 @@ const CONFIG = {
|
||||||
STREAMING_PLAYLISTS: {
|
STREAMING_PLAYLISTS: {
|
||||||
BUCKET_NAME: config.get<string>('object_storage.streaming_playlists.bucket_name'),
|
BUCKET_NAME: config.get<string>('object_storage.streaming_playlists.bucket_name'),
|
||||||
PREFIX: config.get<string>('object_storage.streaming_playlists.prefix'),
|
PREFIX: config.get<string>('object_storage.streaming_playlists.prefix'),
|
||||||
BASE_URL: config.get<string>('object_storage.streaming_playlists.base_url')
|
BASE_URL: config.get<string>('object_storage.streaming_playlists.base_url'),
|
||||||
|
STORE_LIVE_STREAMS: config.get<string>('object_storage.streaming_playlists.store_live_streams')
|
||||||
},
|
},
|
||||||
USER_EXPORTS: {
|
USER_EXPORTS: {
|
||||||
BUCKET_NAME: config.get<string>('object_storage.user_exports.bucket_name'),
|
BUCKET_NAME: config.get<string>('object_storage.user_exports.bucket_name'),
|
||||||
|
|
|
@ -463,7 +463,7 @@ class MuxingSession extends EventEmitter {
|
||||||
playlist.p2pMediaLoaderPeerVersion = P2P_MEDIA_LOADER_PEER_VERSION
|
playlist.p2pMediaLoaderPeerVersion = P2P_MEDIA_LOADER_PEER_VERSION
|
||||||
playlist.type = VideoStreamingPlaylistType.HLS
|
playlist.type = VideoStreamingPlaylistType.HLS
|
||||||
|
|
||||||
playlist.storage = CONFIG.OBJECT_STORAGE.ENABLED
|
playlist.storage = CONFIG.OBJECT_STORAGE.ENABLED && CONFIG.OBJECT_STORAGE.STREAMING_PLAYLISTS.STORE_LIVE_STREAMS
|
||||||
? FileStorage.OBJECT_STORAGE
|
? FileStorage.OBJECT_STORAGE
|
||||||
: FileStorage.FILE_SYSTEM
|
: FileStorage.FILE_SYSTEM
|
||||||
|
|
||||||
|
@ -475,7 +475,7 @@ class MuxingSession extends EventEmitter {
|
||||||
videoUUID: this.videoLive.Video.uuid,
|
videoUUID: this.videoLive.Video.uuid,
|
||||||
sha256Path: join(this.outDirectory, this.streamingPlaylist.segmentsSha256Filename),
|
sha256Path: join(this.outDirectory, this.streamingPlaylist.segmentsSha256Filename),
|
||||||
streamingPlaylist: this.streamingPlaylist,
|
streamingPlaylist: this.streamingPlaylist,
|
||||||
sendToObjectStorage: CONFIG.OBJECT_STORAGE.ENABLED
|
sendToObjectStorage: this.streamingPlaylist.storage === FileStorage.OBJECT_STORAGE
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue