-
Notifications
You must be signed in to change notification settings - Fork 70
feat(cloudflare): add optional R2 batch uploads via rclone for cache population #925
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
krzysztof-palka-monogo
wants to merge
10
commits into
opennextjs:main
Choose a base branch
from
krzysztof-palka-monogo:batch-cache-files-upload-using-rclone
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+437
−3
Open
Changes from 7 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
d8171c5
feat: add --rcloneBatch flag for faster R2 cache uploads using rclone
krzysztof-palka-monogo 5aefc21
fix(test): remove useless test
krzysztof-palka-monogo c79d18d
test: add tests for populateCache with R2 cache
krzysztof-palka-monogo d0c5606
commit to trigger pkg-pr-new action
krzysztof-palka-monogo 15a874f
refactor: not expose rclone to user and use batch upload based on env…
krzysztof-palka-monogo 0d53eac
test: update populateCache tests after implementation changes
krzysztof-palka-monogo 3d181e5
fix: enhance error handling in populateCache for rclone uploads
krzysztof-palka-monogo 32dc294
docs: add links for creating R2 access API tokens in README
krzysztof-palka-monogo a473d6e
fix: update environment variable references from R2_ACCOUNT_ID to CLO…
krzysztof-palka-monogo fe8f553
feat: add support for loading environment variables from .env file
krzysztof-palka-monogo 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
--- | ||
"@opennextjs/cloudflare": minor | ||
--- | ||
|
||
feature: optional batch upload for faster R2 cache population | ||
|
||
This update adds optional batch upload support for R2 cache population, significantly improving upload performance for large caches when enabled via environment variables. | ||
|
||
**Key Changes:** | ||
|
||
1. **Optional Batch Upload**: Configure R2 credentials via environment variables to enable faster batch uploads: | ||
|
||
- `R2_ACCESS_KEY_ID` | ||
- `R2_SECRET_ACCESS_KEY` | ||
- `R2_ACCOUNT_ID` | ||
|
||
2. **Automatic Detection**: When credentials are detected, batch upload is automatically used for better performance | ||
|
||
3. **Smart Fallback**: If credentials are not configured, the CLI falls back to standard Wrangler uploads with a helpful message about enabling batch upload for better performance | ||
|
||
**All deployment commands support batch upload:** | ||
|
||
- `populateCache` - Explicit cache population | ||
- `deploy` - Deploy with cache population | ||
- `upload` - Upload version with cache population | ||
- `preview` - Preview with cache population | ||
|
||
**Performance Benefits (when batch upload is enabled):** | ||
|
||
- Parallel transfer capabilities (32 concurrent transfers) | ||
- Significantly faster for large caches | ||
- Reduced API calls to Cloudflare | ||
|
||
**Usage:** | ||
|
||
```bash | ||
# Enable batch upload by setting environment variables (recommended for large caches) | ||
export R2_ACCESS_KEY_ID=your_key | ||
export R2_SECRET_ACCESS_KEY=your_secret | ||
export R2_ACCOUNT_ID=your_account | ||
opennextjs-cloudflare deploy # batch upload automatically used | ||
``` |
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
Oops, something went wrong.
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.