Skip to content

Scheduling infrastructure for absolutely everyone.

feat: store cal video recording on s3 (#17050)

Udit Takkar0e5a0bfa7bc6
diff --git a/.env.example b/.env.example
index f7535e36e20..17d925407d0 100644
--- a/.env.example
+++ b/.env.example
@@ -17,6 +17,7 @@
#
# To enable enterprise-only features please add your environment variable to the .env file then make your way to /auth/setup to select your license and follow instructions.
+
CALCOM_LICENSE_KEY=
# Signature token for the Cal.com License API (used for self-hosted integrations)
# We will give you a token when we provide you with a license key this ensure you and only you can communicate with the Cal.com License API for your license key
@@ -405,6 +406,11 @@ NEXT_PUBLIC_WEBSITE_TERMS_URL=
# [0: silly & upwards, 1: trace & upwards, 2: debug & upwards, 3: info & upwards, 4: warn & upwards, 5: error & fatal, 6: fatal]
NEXT_PUBLIC_LOGGER_LEVEL=
+# For storing Daily Video recordings on S3 Bucket
+CAL_VIDEO_BUCKET_NAME=
+CAL_VIDEO_BUCKET_REGION=
+CAL_VIDEO_ASSUME_ROLE_ARN=
+
# Used to use Replexica SDK, a tool for real-time AI-powered localization
REPLEXICA_API_KEY=
diff --git a/packages/app-store/dailyvideo/lib/VideoApiAdapter.ts b/packages/app-store/dailyvideo/lib/VideoApiAdapter.ts
index 37276b3e40a..47279135ad1 100644
--- a/packages/app-store/dailyvideo/lib/VideoApiAdapter.ts
+++ b/packages/app-store/dailyvideo/lib/VideoApiAdapter.ts
@@ -42,6 +42,11 @@ export interface DailyVideoCallData {
url: string;
}
+const isS3StorageEnabled =
+ process.env.CAL_VIDEO_BUCKET_NAME &&
+ process.env.CAL_VIDEO_BUCKET_REGION &&
+ process.env.CAL_VIDEO_ASSUME_ROLE_ARN;
+
/** @deprecated use metadata on index file */
export const FAKE_DAILY_CREDENTIAL: CredentialForCalendarService & { invalid: boolean } = {
id: 0,
@@ -233,6 +238,9 @@ const DailyVideoApiAdapter = (): VideoApiAdapter => {
},
});
+ const enableRecording = scalePlan === "true" && !!hasTeamPlan === true ? "cloud" : undefined;
+ const isTranscriptionEnabled = !!hasTeamPlan;
+
return {
privacy: "public",
properties: {
@@ -242,13 +250,32 @@ const DailyVideoApiAdapter = (): VideoApiAdapter => {
enable_chat: true,
enable_pip_ui: true,
exp: exp,
- enable_recording: scalePlan === "true" && !!hasTeamPlan === true ? "cloud" : undefined,
- enable_transcription_storage: !!hasTeamPlan,
- ...(!!hasTeamPlan && {
+ enable_recording: enableRecording,
+ ...(!!enableRecording &&
+ isS3StorageEnabled && {
+ recordings_bucket: {
+ bucket_name: process.env.CAL_VIDEO_BUCKET_NAME,
+ bucket_region: process.env.CAL_VIDEO_BUCKET_REGION,
+ assume_role_arn: process.env.CAL_VIDEO_ASSUME_ROLE_ARN,
+ allow_api_access: true,
+ allow_streaming_from_bucket: true,
+ },
+ }),
+ enable_transcription_storage: isTranscriptionEnabled,
+ ...(isTranscriptionEnabled && {
permissions: {
canAdmin: ["transcription"],
},
}),
+ ...(isTranscriptionEnabled &&
+ isS3StorageEnabled && {
+ transcription_bucket: {
+ bucket_name: process.env.CAL_VIDEO_BUCKET_NAME,
+ bucket_region: process.env.CAL_VIDEO_BUCKET_REGION,
+ assume_role_arn: process.env.CAL_VIDEO_ASSUME_ROLE_ARN,
+ allow_api_access: true,
+ },
+ }),
},
};
};
@@ -260,6 +287,8 @@ const DailyVideoApiAdapter = (): VideoApiAdapter => {
const isScalePlanTrue = scalePlan === "true";
+ const enableRecording = isScalePlanTrue ? "cloud" : undefined;
+
const body = {
privacy: "public",
properties: {
@@ -269,14 +298,31 @@ const DailyVideoApiAdapter = (): VideoApiAdapter => {
enable_chat: true,
enable_pip_ui: true,
exp: exp,
- enable_recording: isScalePlanTrue ? "cloud" : undefined,
+ enable_recording: enableRecording,
+ ...(!!enableRecording &&
+ isS3StorageEnabled && {
+ recordings_bucket: {
+ bucket_name: process.env.CAL_VIDEO_BUCKET_NAME,
+ bucket_region: process.env.CAL_VIDEO_BUCKET_REGION,
+ assume_role_arn: process.env.CAL_VIDEO_ASSUME_ROLE_ARN,
+ allow_api_access: true,
+ allow_streaming_from_bucket: true,
+ },
+ }),
start_video_off: true,
enable_transcription_storage: isScalePlanTrue,
- ...(!!isScalePlanTrue && {
- permissions: {
- canAdmin: ["transcription"],
- },
- }),
+ ...(isScalePlanTrue &&
+ isS3StorageEnabled && {
+ permissions: {
+ canAdmin: ["transcription"],
+ },
+ transcription_bucket: {
+ bucket_name: process.env.CAL_VIDEO_BUCKET_NAME,
+ bucket_region: process.env.CAL_VIDEO_BUCKET_REGION,
+ assume_role_arn: process.env.CAL_VIDEO_ASSUME_ROLE_ARN,
+ allow_api_access: true,
+ },
+ }),
},
};
diff --git a/turbo.json b/turbo.json
index 6e1f478c3f7..09cb06cd781 100644
--- a/turbo.json
+++ b/turbo.json
@@ -454,6 +454,10 @@
"NEXT_PUBLIC_ORG_SELF_SERVE_ENABLED",
"NEXT_PUBLIC_API_V2_ROOT_URL",
"NEXT_PUBLIC_VAPID_PUBLIC_KEY",
+ "VAPID_PRIVATE_KEY",
+ "CAL_VIDEO_BUCKET_NAME",
+ "CAL_VIDEO_BUCKET_REGION",
+ "CAL_VIDEO_ASSUME_ROLE_ARN",
"NEXT_PUBLIC_POSTHOG_KEY",
"NEXT_PUBLIC_POSTHOG_HOST",
"VAPID_PRIVATE_KEY",