import {
AbuseState,
JobType,
+ RunnerJobState,
+ UserRegistrationState,
VideoChannelSyncState,
VideoImportState,
VideoPrivacy,
// ---------------------------------------------------------------------------
-const LAST_MIGRATION_VERSION = 745
+const LAST_MIGRATION_VERSION = 770
// ---------------------------------------------------------------------------
WS: '',
HOSTNAME: '',
PORT: 0,
+
RTMP_URL: '',
- RTMPS_URL: ''
+ RTMPS_URL: '',
+
+ RTMP_BASE_LIVE_URL: '',
+ RTMPS_BASE_LIVE_URL: ''
}
// Sortable columns per schema
ACCOUNT_FOLLOWERS: [ 'createdAt' ],
CHANNEL_FOLLOWERS: [ 'createdAt' ],
+ USER_REGISTRATIONS: [ 'createdAt', 'state' ],
+
+ RUNNERS: [ 'createdAt' ],
+ RUNNER_REGISTRATION_TOKENS: [ 'createdAt' ],
+ RUNNER_JOBS: [ 'updatedAt', 'createdAt', 'priority', 'state', 'progress' ],
+
VIDEOS: [ 'name', 'duration', 'createdAt', 'publishedAt', 'originallyPublishedAt', 'views', 'likes', 'trending', 'hot', 'best' ],
// Don't forget to update peertube-search-index with the same values
VIDEO_REDUNDANCIES: [ 'name' ]
}
-const OAUTH_LIFETIME = {
- ACCESS_TOKEN: 3600 * 24, // 1 day, for upload
- REFRESH_TOKEN: 1209600 // 2 weeks
-}
-
const ROUTE_CACHE_LIFETIME = {
FEEDS: '15 minutes',
ROBOTS: '2 hours',
WS: 'wss'
}
+// ---------------------------------------------------------------------------
+
const JOB_ATTEMPTS: { [id in JobType]: number } = {
'activitypub-http-broadcast': 1,
'activitypub-http-broadcast-parallel': 1,
'video-channel-import': 1,
'after-video-channel-import': 1,
'move-to-object-storage': 3,
+ 'transcoding-job-builder': 1,
'notify': 1,
'federate-video': 1
}
const JOB_CONCURRENCY: { [id in Exclude<JobType, 'video-transcoding' | 'video-import'>]: number } = {
'activitypub-http-broadcast': 1,
'activitypub-http-broadcast-parallel': 30,
- 'activitypub-http-unicast': 10,
+ 'activitypub-http-unicast': 30,
'activitypub-http-fetcher': 3,
'activitypub-cleaner': 1,
'activitypub-follow': 1,
'move-to-object-storage': 1,
'video-channel-import': 1,
'after-video-channel-import': 1,
+ 'transcoding-job-builder': 1,
'notify': 5,
'federate-video': 3
}
'move-to-object-storage': 1000 * 60 * 60 * 3, // 3 hours
'video-channel-import': 1000 * 60 * 60 * 4, // 4 hours
'after-video-channel-import': 60000 * 5, // 5 minutes
+ 'transcoding-job-builder': 60000, // 1 minute
'notify': 60000 * 5, // 5 minutes
'federate-video': 60000 * 5 // 5 minutes
}
const REPEAT_JOBS: { [ id in JobType ]?: RepeatOptions } = {
'videos-views-stats': {
- cron: randomInt(1, 20) + ' * * * *' // Between 1-20 minutes past the hour
+ pattern: randomInt(1, 20) + ' * * * *' // Between 1-20 minutes past the hour
},
'activitypub-cleaner': {
- cron: '30 5 * * ' + randomInt(0, 7) // 1 time per week (random day) at 5:30 AM
+ pattern: '30 5 * * ' + randomInt(0, 7) // 1 time per week (random day) at 5:30 AM
}
}
const JOB_PRIORITY = {
- TRANSCODING: 100
+ TRANSCODING: 100,
+ VIDEO_STUDIO: 150
}
+const JOB_REMOVAL_OPTIONS = {
+ COUNT: 10000, // Max jobs to store
+
+ SUCCESS: { // Success jobs
+ 'DEFAULT': parseDurationToMs('2 days'),
+
+ 'activitypub-http-broadcast-parallel': parseDurationToMs('10 minutes'),
+ 'activitypub-http-unicast': parseDurationToMs('1 hour'),
+ 'videos-views-stats': parseDurationToMs('3 hours'),
+ 'activitypub-refresher': parseDurationToMs('10 hours')
+ },
+
+ FAILURE: { // Failed job
+ DEFAULT: parseDurationToMs('7 days')
+ }
+}
+
+const VIDEO_IMPORT_TIMEOUT = Math.floor(JOB_TTL['video-import'] * 0.9)
+
+const RUNNER_JOBS = {
+ MAX_FAILURES: 5,
+ LAST_CONTACT_UPDATE_INTERVAL: 30000
+}
+
+// ---------------------------------------------------------------------------
+
const BROADCAST_CONCURRENCY = 30 // How many requests in parallel we do in activitypub-http-broadcast job
const CRAWL_REQUEST_CONCURRENCY = 1 // How many requests in parallel to fetch remote data (likes, shares...)
REDUNDANCY: JOB_TTL['video-redundancy']
}
-const JOB_COMPLETED_LIFETIME = 60000 * 60 * 24 * 2 // 2 days
-const VIDEO_IMPORT_TIMEOUT = Math.floor(JOB_TTL['video-import'] * 0.9)
-
const SCHEDULER_INTERVALS_MS = {
+ RUNNER_JOB_WATCH_DOG: Math.min(CONFIG.REMOTE_RUNNERS.STALLED_JOBS.VOD, CONFIG.REMOTE_RUNNERS.STALLED_JOBS.LIVE),
ACTOR_FOLLOW_SCORES: 60000 * 60, // 1 hour
REMOVE_OLD_JOBS: 60000 * 60, // 1 hour
UPDATE_VIDEOS: 60000, // 1 minute
ABUSE_MESSAGES: {
MESSAGE: { min: 2, max: 3000 } // Length
},
+ USER_REGISTRATIONS: {
+ REASON_MESSAGE: { min: 2, max: 3000 }, // Length
+ MODERATOR_MESSAGE: { min: 2, max: 3000 } // Length
+ },
VIDEO_BLACKLIST: {
REASON: { min: 2, max: 300 } // Length
},
CLIENT_STACK_TRACE: { min: 1, max: 15000 }, // Length
CLIENT_META: { min: 1, max: 5000 }, // Length
CLIENT_USER_AGENT: { min: 1, max: 200 } // Length
+ },
+ RUNNERS: {
+ TOKEN: { min: 1, max: 1000 }, // Length
+ NAME: { min: 1, max: 100 }, // Length
+ DESCRIPTION: { min: 1, max: 1000 } // Length
+ },
+ RUNNER_JOBS: {
+ TOKEN: { min: 1, max: 1000 }, // Length
+ REASON: { min: 1, max: 5000 }, // Length
+ ERROR_MESSAGE: { min: 1, max: 5000 }, // Length
+ PROGRESS: { min: 0, max: 100 } // Value
}
}
DISLIKE: 'dislike'
}
-const FFMPEG_NICE: { [ id: string ]: number } = {
+const FFMPEG_NICE = {
// parent process defaults to niceness = 0
// reminder: lower = higher priority, max value is 19, lowest is -20
LIVE: 5, // prioritize over VOD and THUMBNAIL
[AbuseState.ACCEPTED]: 'Accepted'
}
+const USER_REGISTRATION_STATES: { [ id in UserRegistrationState ]: string } = {
+ [UserRegistrationState.PENDING]: 'Pending',
+ [UserRegistrationState.REJECTED]: 'Rejected',
+ [UserRegistrationState.ACCEPTED]: 'Accepted'
+}
+
const VIDEO_PLAYLIST_PRIVACIES: { [ id in VideoPlaylistPrivacy ]: string } = {
[VideoPlaylistPrivacy.PUBLIC]: 'Public',
[VideoPlaylistPrivacy.UNLISTED]: 'Unlisted',
[VideoPlaylistType.WATCH_LATER]: 'Watch later'
}
+const RUNNER_JOB_STATES: { [ id in RunnerJobState ]: string } = {
+ [RunnerJobState.PROCESSING]: 'Processing',
+ [RunnerJobState.COMPLETED]: 'Completed',
+ [RunnerJobState.PENDING]: 'Pending',
+ [RunnerJobState.ERRORED]: 'Errored',
+ [RunnerJobState.WAITING_FOR_PARENT_JOB]: 'Waiting for parent job to finish',
+ [RunnerJobState.CANCELLED]: 'Cancelled',
+ [RunnerJobState.PARENT_ERRORED]: 'Parent job failed',
+ [RunnerJobState.PARENT_CANCELLED]: 'Parent job cancelled'
+}
+
const MIMETYPES = {
AUDIO: {
MIMETYPE_EXT: {
MIMETYPE_EXT: {
'application/x-bittorrent': '.torrent'
}
+ },
+ M3U8: {
+ MIMETYPE_EXT: {
+ 'application/vnd.apple.mpegurl': '.m3u8'
+ }
}
}
MIMETYPES.AUDIO.EXT_MIMETYPE = invert(MIMETYPES.AUDIO.MIMETYPE_EXT)
const TWO_FACTOR_AUTH_REQUEST_TOKEN_LIFETIME = 60000 * 10 // 10 minutes
-const USER_EMAIL_VERIFY_LIFETIME = 60000 * 60 // 60 minutes
+const EMAIL_VERIFY_LIFETIME = 60000 * 60 // 60 minutes
const NSFW_POLICY_TYPES: { [ id: string ]: NSFWPolicyType } = {
DO_NOT_LIST: 'do_not_list',
VIDEO_CAPTIONS: '/lazy-static/video-captions/',
TORRENTS: '/lazy-static/torrents/'
}
+const OBJECT_STORAGE_PROXY_PATHS = {
+ PRIVATE_WEBSEED: '/object-storage-proxy/webseed/private/',
+
+ STREAMING_PLAYLISTS: {
+ PRIVATE_HLS: '/object-storage-proxy/streaming-playlists/hls/private/'
+ }
+}
// Cache control
const STATIC_MAX_AGE = {
height: 480,
minWidth: 400
}
-const ACTOR_IMAGES_SIZE: { [key in ActorImageType]: { width: number, height: number }[]} = {
+const ACTOR_IMAGES_SIZE: { [key in ActorImageType]: { width: number, height: number }[] } = {
[ActorImageType.AVATAR]: [
{
width: 120,
VIDEO_TOKENS: {
MAX_SIZE: 100_000,
TTL: parseDurationToMs('8 hours')
+ },
+ TRACKER_IPS: {
+ MAX_SIZE: 100_000
}
}
const MEMOIZE_TTL = {
OVERVIEWS_SAMPLE: 1000 * 3600 * 4, // 4 hours
- INFO_HASH_EXISTS: 1000 * 3600 * 12, // 12 hours
+ INFO_HASH_EXISTS: 1000 * 60, // 1 minute
VIDEO_DURATION: 1000 * 10, // 10 seconds
LIVE_ABLE_TO_UPLOAD: 1000 * 60, // 1 minute
LIVE_CHECK_SOCKET_HEALTH: 1000 * 60, // 1 minute
PROCESS_IMAGE: {
CONCURRENCY: 1,
MAX_THREADS: 5
- },
- SEQUENTIAL_HTTP_BROADCAST: {
- CONCURRENCY: 1,
- MAX_THREADS: 1
- },
- PARALLEL_HTTP_BROADCAST: {
- CONCURRENCY: JOB_CONCURRENCY['activitypub-http-broadcast-parallel'],
- MAX_THREADS: 1
}
}
INTERVAL: 60000 * 5, // 5 minutes
ANNOUNCES_PER_IP_PER_INFOHASH: 15, // maximum announces per torrent in the interval
ANNOUNCES_PER_IP: 30, // maximum announces for all our torrents in the interval
- BLOCK_IP_LIFETIME: 60000 * 3 // 3 minutes
+ BLOCK_IP_LIFETIME: parseDurationToMs('3 minutes')
}
const P2P_MEDIA_LOADER_PEER_VERSION = 2
OVERVIEWS.VIDEOS.SAMPLE_THRESHOLD = 2
PLUGIN_EXTERNAL_AUTH_TOKEN_LIFETIME = 5000
+
+ JOB_REMOVAL_OPTIONS.SUCCESS['videos-views-stats'] = 10000
}
if (isTestInstance()) {
VIDEO_LIVE.SEGMENT_TIME_SECONDS.DEFAULT_LATENCY = 2
VIDEO_LIVE.SEGMENT_TIME_SECONDS.SMALL_LATENCY = 1
VIDEO_LIVE.EDGE_LIVE_DELAY_SEGMENTS_NOTIFICATION = 1
+
+ RUNNER_JOBS.LAST_CONTACT_UPDATE_INTERVAL = 2000
}
}
VIDEO_LIVE,
PEERTUBE_VERSION,
LAZY_STATIC_PATHS,
+ OBJECT_STORAGE_PROXY_PATHS,
SEARCH_INDEX,
DIRECTORIES,
RESUMABLE_UPLOAD_SESSION_LIFETIME,
+ RUNNER_JOB_STATES,
P2P_MEDIA_LOADER_PEER_VERSION,
ACTOR_IMAGES_SIZE,
ACCEPT_HEADERS,
JOB_ATTEMPTS,
AP_CLEANER,
LAST_MIGRATION_VERSION,
- OAUTH_LIFETIME,
CUSTOM_HTML_TAG_COMMENTS,
STATS_TIMESERIE,
BROADCAST_CONCURRENCY,
VIDEO_TRANSCODING_FPS,
FFMPEG_NICE,
ABUSE_STATES,
+ USER_REGISTRATION_STATES,
LRU_CACHE,
REQUEST_TIMEOUTS,
+ RUNNER_JOBS,
MAX_LOCAL_VIEWER_WATCH_SECTIONS,
USER_PASSWORD_RESET_LIFETIME,
USER_PASSWORD_CREATE_LIFETIME,
MEMOIZE_TTL,
- USER_EMAIL_VERIFY_LIFETIME,
+ EMAIL_VERIFY_LIFETIME,
OVERVIEWS,
SCHEDULER_INTERVALS_MS,
REPEAT_JOBS,
CRAWL_REQUEST_CONCURRENCY,
DEFAULT_AUDIO_RESOLUTION,
BINARY_CONTENT_TYPES,
- JOB_COMPLETED_LIFETIME,
+ JOB_REMOVAL_OPTIONS,
HTTP_SIGNATURE,
VIDEO_IMPORT_STATES,
VIDEO_CHANNEL_SYNC_STATE,
const rtmpHostname = CONFIG.LIVE.RTMP.PUBLIC_HOSTNAME || CONFIG.WEBSERVER.HOSTNAME
const rtmpsHostname = CONFIG.LIVE.RTMPS.PUBLIC_HOSTNAME || CONFIG.WEBSERVER.HOSTNAME
- WEBSERVER.RTMP_URL = 'rtmp://' + rtmpHostname + ':' + CONFIG.LIVE.RTMP.PORT + '/' + VIDEO_LIVE.RTMP.BASE_PATH
- WEBSERVER.RTMPS_URL = 'rtmps://' + rtmpsHostname + ':' + CONFIG.LIVE.RTMPS.PORT + '/' + VIDEO_LIVE.RTMP.BASE_PATH
+ WEBSERVER.RTMP_URL = 'rtmp://' + rtmpHostname + ':' + CONFIG.LIVE.RTMP.PORT
+ WEBSERVER.RTMPS_URL = 'rtmps://' + rtmpsHostname + ':' + CONFIG.LIVE.RTMPS.PORT
+
+ WEBSERVER.RTMP_BASE_LIVE_URL = WEBSERVER.RTMP_URL + '/' + VIDEO_LIVE.RTMP.BASE_PATH
+ WEBSERVER.RTMPS_BASE_LIVE_URL = WEBSERVER.RTMPS_URL + '/' + VIDEO_LIVE.RTMP.BASE_PATH
}
function updateWebserverConfig () {
const additionalLanguages = {
sgn: true, // Sign languages (macro language)
ase: true, // American sign language
+ asq: true, // Austrian sign language
sdl: true, // Arabian sign language
bfi: true, // British sign language
bzs: true, // Brazilian sign language