bunnyup
v0.2.0
Published
CLI tool for managing sites deployed with Bunny.net
Readme
bunnyup
CLI tool for deploying static sites to Bunny.net CDN.
Note: This CLI is in beta and I am using it on personal projects. Further CDN configuration is up to you, by default all assets are cached except html, json, xml -- this should be fine for modern frameworks.
Note: This tool is not affiliated with bunny.net
Installation
Requires the Bun runtime installed. Installing & running using npm, pnpm, etc. will fail!
bun add -g bunnyupQuick Start
# 1. Authenticate
bn login
# 2. Set up your project
bn new
# 3. Commit Files (bn new creates a config file, bn deploy expects a clean repository)
git add . && git commit -m "setup bunnyup"
# 4. Build and deploy
npm run build && bn deployConcept
Bunnyup simplifies the deployment of statically built sites to bunny.net. It follows the following deployment process:
- Upload files to a new storage zone (i.e. bucket), identified by the git commit hash.
- Activate that deployment by pointing the pull zone (i.e. CDN configuration) at the new storage zone
- Prune deployments older than x days
Old deployments remain available until pruned and can be rolled back to at any time via bn activate.
The Pull Zone the CLI creates is long-lived and only reconfigured afterwards. By default, html, json, xml is uncached. Other assets are cached infinitely on the CDN and for 1 hour on browsers. Known, framework assets (_next, _astro, _nuxt, _app/immutable) are cached with "public, max-age=31536000, immutable" on the browser.
You may want to visit the Bunny.net dashboard after running bn new to make any applicable adjustments for your setup.
Commands
| Command | Description |
| ----------------------- | --------------------------------------------------------------------------------------------------------------------------------- |
| bn login | Save your Bunny.net API key (this is stored securely in your OS Keychain via Bun.secrets) |
| bn new | Configure a new site |
| bn deploy | Upload → activate → prune |
| bn upload | Upload files to a new version |
| bn activate [version] | Switch to a git ref/hash (default: HEAD) |
| bn prune | Delete old deployments |
Options
--no-prune- Skip pruning old versions (deploy)-f, --force- Upload with uncommitted git changes (upload, deploy)-y, --yes- Skip confirmation prompts (prune)
Requires clean git working directory by default. Use --force to override.
Configuration
bn new creates a bunnyup.json file:
{
"name": "my-site",
"outputFolder": "dist",
"pruneAfter": "30",
"pullZoneId": 123456
}pruneAfteris the number of days after which old deployments are deleted
CI/CD
Set the BUNNY_API_KEY environment variable. See examples/github-deploy.yml for a GitHub Actions example.
API Key
Get your API key from: https://dash.bunny.net/account/api-key
