@twick/cloud-export-video 0.14.14 → 0.14.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +79 -1
- package/package.json +8 -8
package/README.md
CHANGED
|
@@ -37,8 +37,86 @@ npx twick-export-video ecr-login us-east-1 123456789012
|
|
|
37
37
|
npx twick-export-video push twick-export-video:latest us-east-1 123456789012
|
|
38
38
|
```
|
|
39
39
|
|
|
40
|
-
### AWS Lambda (container)
|
|
40
|
+
### AWS Lambda (container) usage
|
|
41
41
|
|
|
42
|
+
This package ships with an AWS Lambda container template (Dockerfile + handler).
|
|
43
|
+
|
|
44
|
+
#### Build image
|
|
45
|
+
|
|
46
|
+
In the `packages/cloud-functions/export-video` directory:
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
docker buildx build --platform linux/amd64 -t twick-export-video:latest -f platform/aws/Dockerfile .
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
#### Push image to AWS ECR
|
|
53
|
+
|
|
54
|
+
To deploy the container image to AWS Elastic Container Registry (ECR) for use with Lambda:
|
|
55
|
+
|
|
56
|
+
**Prerequisites:**
|
|
57
|
+
- AWS CLI configured with appropriate credentials
|
|
58
|
+
- Docker installed and running
|
|
59
|
+
|
|
60
|
+
**Steps:**
|
|
61
|
+
|
|
62
|
+
1. **Get your AWS Account ID:**
|
|
63
|
+
```bash
|
|
64
|
+
AWS_ACCOUNT_ID=$(aws sts get-caller-identity --query Account --output text)
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
2. **Set your AWS region and repository name:**
|
|
68
|
+
```bash
|
|
69
|
+
AWS_REGION="your-aws-region" # e.g., ap-south-1, us-east-1
|
|
70
|
+
REPOSITORY_NAME="twick-export-video"
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
3. **Login to ECR:**
|
|
74
|
+
```bash
|
|
75
|
+
aws ecr get-login-password --region $AWS_REGION | docker login --username AWS --password-stdin $AWS_ACCOUNT_ID.dkr.ecr.$AWS_REGION.amazonaws.com
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
4. **Create ECR repository (if it doesn't exist):**
|
|
79
|
+
```bash
|
|
80
|
+
aws ecr create-repository \
|
|
81
|
+
--repository-name $REPOSITORY_NAME \
|
|
82
|
+
--image-scanning-configuration scanOnPush=true \
|
|
83
|
+
--region $AWS_REGION
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
5. **Tag the image:**
|
|
87
|
+
```bash
|
|
88
|
+
docker tag twick-export-video:latest $AWS_ACCOUNT_ID.dkr.ecr.$AWS_REGION.amazonaws.com/$REPOSITORY_NAME:latest
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
6. **Push the image:**
|
|
92
|
+
```bash
|
|
93
|
+
docker push $AWS_ACCOUNT_ID.dkr.ecr.$AWS_REGION.amazonaws.com/$REPOSITORY_NAME:latest
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
**Complete example script:**
|
|
97
|
+
```bash
|
|
98
|
+
#!/bin/bash
|
|
99
|
+
AWS_REGION="ap-south-1"
|
|
100
|
+
REPOSITORY_NAME="twick-export-video"
|
|
101
|
+
AWS_ACCOUNT_ID=$(aws sts get-caller-identity --query Account --output text)
|
|
102
|
+
|
|
103
|
+
# Build the image
|
|
104
|
+
docker buildx build --platform linux/amd64 -t twick-export-video:latest -f platform/aws/Dockerfile .
|
|
105
|
+
|
|
106
|
+
# Login to ECR
|
|
107
|
+
aws ecr get-login-password --region $AWS_REGION | docker login --username AWS --password-stdin $AWS_ACCOUNT_ID.dkr.ecr.$AWS_REGION.amazonaws.com
|
|
108
|
+
|
|
109
|
+
# Create repository if it doesn't exist
|
|
110
|
+
aws ecr create-repository --repository-name $REPOSITORY_NAME --image-scanning-configuration scanOnPush=true --region $AWS_REGION 2>/dev/null || true
|
|
111
|
+
|
|
112
|
+
# Tag and push
|
|
113
|
+
docker tag twick-export-video:latest $AWS_ACCOUNT_ID.dkr.ecr.$AWS_REGION.amazonaws.com/$REPOSITORY_NAME:latest
|
|
114
|
+
docker push $AWS_ACCOUNT_ID.dkr.ecr.$AWS_REGION.amazonaws.com/$REPOSITORY_NAME:latest
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
After pushing, you can use the ECR image URI (`$AWS_ACCOUNT_ID.dkr.ecr.$AWS_REGION.amazonaws.com/$REPOSITORY_NAME:latest`) when creating or updating your Lambda function.
|
|
118
|
+
|
|
119
|
+
**Notes:**
|
|
42
120
|
- The Dockerfile is based on `revideo/aws-lambda-base-image` and prepares Chromium and ffmpeg for headless rendering.
|
|
43
121
|
- The handler expects an `event.arguments.input` payload with `{ project, mediaFiles? }`.
|
|
44
122
|
- The response is a `video/mp4` base64 body, or a text file on error.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@twick/cloud-export-video",
|
|
3
|
-
"version": "0.14.
|
|
3
|
+
"version": "0.14.15",
|
|
4
4
|
"description": "Twick cloud function for exporting video with platform-specific templates (AWS Lambda container)",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "core/renderer.js",
|
|
@@ -43,13 +43,13 @@
|
|
|
43
43
|
},
|
|
44
44
|
"dependencies": {
|
|
45
45
|
"@sparticuz/chromium": "^129.0.0",
|
|
46
|
-
"@twick/2d": "0.14.
|
|
47
|
-
"@twick/core": "0.14.
|
|
48
|
-
"@twick/ffmpeg": "0.14.
|
|
49
|
-
"@twick/renderer": "0.14.
|
|
50
|
-
"@twick/ui": "0.14.
|
|
51
|
-
"@twick/vite-plugin": "0.14.
|
|
52
|
-
"@twick/visualizer": "0.14.
|
|
46
|
+
"@twick/2d": "0.14.15",
|
|
47
|
+
"@twick/core": "0.14.15",
|
|
48
|
+
"@twick/ffmpeg": "0.14.15",
|
|
49
|
+
"@twick/renderer": "0.14.15",
|
|
50
|
+
"@twick/ui": "0.14.15",
|
|
51
|
+
"@twick/vite-plugin": "0.14.15",
|
|
52
|
+
"@twick/visualizer": "0.14.15",
|
|
53
53
|
"@aws-sdk/client-s3": "^3.620.0",
|
|
54
54
|
"ffmpeg-static": "^5.2.0",
|
|
55
55
|
"fluent-ffmpeg": "^2.1.3"
|