Bunny CLI - Replicate and store your files to the edge!

Overview

Bunny CLI - Replicate and store your files to the edge!

What is Bunny CLI?

Bunny CLI is a tool for the console to upload frontend frameworks such as Angular, Vue.js, React, or more recently, Blazor quickly to the Edge Store on Bunny CDN.

With Bunny CDN's Storage Edge, your web applications benefit from replicated storage zones, a global content delivery network that hosts files in 5 different regions worldwide and accelerates everything through a worldwide content delivery network with over 54+ PoPs.

How do I use Bunny CLI?

To install Bunny CLI, you need to be using Composer. For more details about Composer, see the Composer documentation.

composer global require own3d/bunny-cli

Bunny CLI currently only comes with a deploy command. With this command, you can easily synconizise your dist folder with your edge storage.

IMPORTANT: All files in the edge storage that are not in your local dist directory will be deleted.

➜ $ bunny deploy  
- Hashing files...  
✔ Finished hashing 16360 files  
- CDN diffing files...  
✔ CDN requesting 10875 files  
- Synchronizing 10875 files  
 10875/10875 [▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓] 100%  
✔ Finished synchronizing 10875 files  
- Waiting for deploy to go live...  
✔ Deployment is live! (322.96s)

Website URL: https://bunny-cli.b-cdn.net/

How do I integrate Bunny CLI into my GitHub Actions workflow?

We offer you a GitHub Action for Bunny CLI for free. You can easily upload your distributable files to your edge storage during your deployment process with this action. Just put your storage password (BUNNY_STORAGE_PASSWORD) and your API key (BUNNY_API_ACCESS_KEY) in the secrets of your GitHub repository and adjust your workflow as follows.

- name: Deploy to Edge Storage
  uses: own3d/bunny-action@main
  env:
    BUNNY_API_ACCESS_KEY: ${{ secrets.BUNNY_API_ACCESS_KEY }}
    BUNNY_STORAGE_USERNAME: bunny-cli
    BUNNY_STORAGE_PASSWORD: ${{ secrets.BUNNY_STORAGE_PASSWORD }}
    BUNNY_PULL_ZONE_ID: 466588
  with:
    args: deploy --dir=dist

Secure your .well-known/bunny-cli.lock file

Bunny CLI generates a lock file, which by default is located at .well-known/bunny-cli.lock. This file locks the files of your project to a known state. To prevent this from being publicly accessible it is recommended to create a new edge rule in your pull zone. You can use the following example as a template:

Action: Block Request
Condition Matching: Match Any
Condition: If Request URL Match Any */.well-known/bunny-cli.lock

Now the file should no longer be accessible. It can take a few minutes until your Edge Rule is active.

Frequently Asked Questions

Q: Is this a zero-downtime deployment?

A: Depends. Only when the sync of the files is complete, the pull zone cache is cleared. Therefore if the CDN cache is not present because the cache has expired or miss, then an unanticipated event may occur.

We hope that together with Bunny CDN, we can solve this problem.

Q: Is this an official tool of Bunny CDN?

A: No. Bunny CLI is a community-driven tool and is not affiliated with Bunny CDN.

License

Bunny CLI is an open-source software licensed under the Apache 2.0 license.

You might also like...
The Laravel Forge CLI.
The Laravel Forge CLI.

Introduction Laravel Forge is a server management and site deployment service. After connecting to your preferred server provider, Forge will provisio

Email-flooder - A CLI flooder e-mail tool, made in PHP.
Email-flooder - A CLI flooder e-mail tool, made in PHP.

E-mail flooder (PHP 8.0.13) You can send emails to any server, however the request must come from Gmail. (Remember to enable less secure apps to be ab

This project uses dflydev/dot-access-data to provide simple output filtering for cli applications.

FilterViaDotAccessData This project uses dflydev/dot-access-data to provide simple output filtering for applications built with annotated-command / Ro

Blacksmith is a code generation tool which automates the creation of common files that you'd typically create for each entity in your application.
Blacksmith is a code generation tool which automates the creation of common files that you'd typically create for each entity in your application.

Blacksmith is a code generation tool which automates the creation of common files that you'd typically create for each entity in your application.

This package provides a Logs page that allows you to view your Laravel log files in a simple UI
This package provides a Logs page that allows you to view your Laravel log files in a simple UI

A simplistics log viewer for your Filament apps. This package provides a Logs page that allows you to view your Laravel log files in a simple UI. Inst

Load files and classes as lazy collections in Laravel.

Lody Load files and classes as lazy collections in Laravel. Installation composer require lorisleiva/lody Usage Lody enables you to fetch all exist

Package to parse DNA kit files, and import them into Laravel

Package to parse DNA kit files, and import them into Laravel

Package for Laravel that gives artisan commands to setup and edit environment files.
Package for Laravel that gives artisan commands to setup and edit environment files.

Setup and work with .env files in Laravel from the command line NOTE: This doesn't work with Laravel 5 since .env files were changed. This is for Lara

Laravel 5 package for reading and writing CSV files.

CSV Laravel 5 package for reading and writing CSV files. Warning The package has been updated to PHP 7. If you can't update to PHP 7 use version 0.6.x

Comments
  • Uploading to the non Main Storage Region succeeds

    Uploading to the non Main Storage Region succeeds

    This may be more of a Bunny.net issue but manifests as a false positive.

    Steps to Reproduce

    • Configure a Storage Zone with a Main Storage Region of Europe (Falkensteen)
    • Use the CLI to upload to la.storage.bunnycdn.com
    • CLI will show a successful upload https://i.imgur.com/ujaaVp1.png

    Expected

    An error?

    Actual

    No error and no files in the Storage Zone.

    opened by tehnorm 0
  • Exception trying to upload

    Exception trying to upload

    Although things worked a few weeks ago, it's failing with an exception today.

    PHP:

    $ php --version
    PHP 8.1.2 (cli) (built: Jan 19 2022 17:12:32) (NTS)
    Copyright (c) The PHP Group
    Zend Engine v4.1.2, Copyright (c) Zend Technologies
    

    Command used to upload:

    bunny deploy --dir=public
    

    Exception reported by the command above:

    HP Fatal error:  During inheritance of ArrayAccess: Uncaught ErrorException: Return type of Illuminate\Support\Collection::offsetExists($key) should either be compatible with ArrayAccess::offsetExists(mixed $offset): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in phar:///home/jansorg/.config/composer/vendor/own3d/bunny-cli/builds/bunny/vendor/illuminate/collections/Collection.php:1459
    Stack trace:
    #0 phar:///home/jansorg/.config/composer/vendor/own3d/bunny-cli/builds/bunny/vendor/illuminate/collections/Collection.php(13): Illuminate\Foundation\Bootstrap\HandleExceptions->handleError()
    #1 phar:///home/jansorg/.config/composer/vendor/own3d/bunny-cli/builds/bunny/.box/vendor/composer/ClassLoader.php(478): include('...')
    #2 phar:///home/jansorg/.config/composer/vendor/own3d/bunny-cli/builds/bunny/.box/vendor/composer/ClassLoader.php(346): Composer\Autoload\includeFile()
    #3 phar:///home/jansorg/.config/composer/vendor/own3d/bunny-cli/builds/bunny/vendor/illuminate/collections/helpers.php(15): Composer\Autoload\ClassLoader->loadClass()
    #4 phar:///home/jansorg/.config/composer/vendor/own3d/bunny-cli/builds/bunny/vendor/laravel-zero/foundation/src/Illuminate/Foundation/PackageManifest.php(89): collect()
    #5 phar:///home/jansorg/.config/composer/vendor/own3d/bunny-cli/builds/bunny/vendor/laravel-zero/foundation/src/Illuminate/Foundation/PackageManifest.php(78): Illuminate\Foundation\PackageManifest->config()
    #6 phar:///home/jansorg/.config/composer/vendor/own3d/bunny-cli/builds/bunny/vendor/laravel-zero/foundation/src/Illuminate/Foundation/Bootstrap/RegisterFacades.php(26): Illuminate\Foundation\PackageManifest->aliases()
    #7 phar:///home/jansorg/.config/composer/vendor/own3d/bunny-cli/builds/bunny/vendor/laravel-zero/framework/src/Bootstrap/RegisterFacades.php(71): Illuminate\Foundation\Bootstrap\RegisterFacades->bootstrap()
    #8 phar:///home/jansorg/.config/composer/vendor/own3d/bunny-cli/builds/bunny/vendor/laravel-zero/foundation/src/Illuminate/Foundation/Application.php(243): LaravelZero\Framework\Bootstrap\RegisterFacades->bootstrap()
    #9 phar:///home/jansorg/.config/composer/vendor/own3d/bunny-cli/builds/bunny/vendor/laravel-zero/foundation/src/Illuminate/Foundation/Console/Kernel.php(310): Illuminate\Foundation\Application->bootstrapWith()
    #10 phar:///home/jansorg/.config/composer/vendor/own3d/bunny-cli/builds/bunny/vendor/laravel-zero/framework/src/Kernel.php(130): Illuminate\Foundation\Console\Kernel->bootstrap()
    #11 phar:///home/jansorg/.config/composer/vendor/own3d/bunny-cli/builds/bunny/vendor/laravel-zero/framework/src/Kernel.php(102): LaravelZero\Framework\Kernel->bootstrap()
    #12 phar:///home/jansorg/.config/composer/vendor/own3d/bunny-cli/builds/bunny/vendor/laravel-zero/framework/src/Kernel.php(89): LaravelZero\Framework\Kernel->ensureDefaultCommand()
    #13 phar:///home/jansorg/.config/composer/vendor/own3d/bunny-cli/builds/bunny/bunny(36): LaravelZero\Framework\Kernel->handle()
    #14 /home/jansorg/.config/composer/vendor/own3d/bunny-cli/builds/bunny(14): require('...')
    #15 /home/jansorg/.config/composer/vendor/bin/bunny(117): include('...')
    #16 {main} in phar:///home/jansorg/.config/composer/vendor/own3d/bunny-cli/builds/bunny/vendor/illuminate/collections/Collection.php on line 13
    
    
    opened by jansorg 0
  • When run on Windows 10 I get SSL certificate error for api.bunny.net

    When run on Windows 10 I get SSL certificate error for api.bunny.net

    On Windows 10 when I run this bunny init get this:

    In CurlFactory.php line 211:
    
      cURL error 60: SSL certificate problem: self signed certificate in certificate chain (see https://curl.haxx.se/libc
      url/c/libcurl-errors.html) for https://api.bunny.net/storagezone
    
    opened by PH4NTOMiki 1
  • possibility to specify target folder

    possibility to specify target folder

    Thank you for the cli and the github-action.

    I'd like to build preview-builds on to bunny.net whenever a PR is being added.

    It would be great to have an option to specify a target folder. Is there an option?

    opened by tinect 1
Releases(0.1.2)
  • 0.1.2(Jul 24, 2021)

    • Added bunny init command. Setup the bunny cli within seconds.
    • Added env:list, env:set, env:backup, env:restore. Now you can manage your .env file directly in the cli.
    • Fixed environment for Windows. You can find your environment in %appdata%/.bunny-cli on Windows and in $HOME/.bunny-cli on Linux.
    • Fixed bunny deploy command for new filesystem and added a lock file to cache the current state. You can skip this with the new added options --no-lock-verification and --no-lock-generation.
    • Optimize deployment.
    Source code(tar.gz)
    Source code(zip)
Owner
own3d media GmbH
Hey there, we're a Start-up from Austria/Germany giving streamers everything they need to create the best possible experiences for fans.
own3d media GmbH
If you are beginner in WordPress plugin development or if you want to develop your own store product plugin you use this plugin

hirwa-products-plugin If you are beginner in WordPress plugin development or if you want to develop your own store product plugin you use this plugin

NIYIBIZI HIRWA 1 Aug 23, 2022
Store your Laravel application settings in an on-disk JSON file

Store your Laravel application settings in an on-disk JSON file. This package provides a simple SettingsRepository class that can be used to store you

Ryan Chandler 24 Nov 16, 2022
A laravel package to generate class files from stub files.

Laravel Stub Generator A php laravel package to generate useable php files from given stub files . Installation Require the package using composer: co

Touhidur Rahman 31 Dec 29, 2022
A Laravel package that allows you to use multiple ".env" files in a precedent manner. Use ".env" files per domain (multi-tentant)!

Laravel Multi ENVs Use multiple .envs files and have a chain of precedence for the environment variables in these different .envs files. Use the .env

Allyson Silva 48 Dec 29, 2022
An easy way to add colors in your CLI scripts.

COLORS Here is a preview of what you can achieve with the library: Installation Installation via composer is highly recommended. { "require": {

Kevin Le Brun 335 Dec 4, 2022
ProcessWire Fieldtype for collecting and store oembed data

FieldtypeOembed What it does Store, collect and update oembed data from external sources. It used the great PHP Library Essence by Félix Girault and a

Neue Rituale 4 May 9, 2022
Store and retrieve settings generally or for model objects in Laravel.

Store and retrieve settings generally or for model objects in Laravel. Documentation You can find the detailed documentation here in Laravel Settings

Pharaonic 7 Dec 19, 2022
Laravel application project as Sheina Online Store backend to be built with Laravel and VueJS

About Laravel Laravel is a web application framework with expressive, elegant syntax. We believe development must be an enjoyable and creative experie

Boas Aditya Christian 1 Jan 11, 2022
A Simple Store Front Web Application using Laravel and Bootstrap.

About Laravel Laravel is a web application framework with expressive, elegant syntax. We believe development must be an enjoyable and creative experie

Basil Basaif 1 Nov 28, 2021
A nice GUI for Laravel Artisan, ready out of the box, configurable and handy for non-CLI experienced developers.

Artisan UI A nice GUI for Laravel Artisan, ready out of the box, configurable and handy for non-CLI experienced developers. Supported commands must be

Pablo Leone 1 Dec 3, 2021