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

...
profile picture of ghostzero
GhostZero
Software Developer
Published at July 19, 2021

In this article I briefly discuss my latest tool, the Bunny CLI.

Bunny CLI is a CLI tool for Bunny CDN with the goal to deploy files from a static page generator to a storage edge.

You may use Composer to install Bunny CLI to your computer:

composer global require ghostzero/bunny

Next you can use bunny deploy to upload your static pages.

Static site generators becoming more and more popular due its near instant page load times, no flash of unstyled content, improved SEO and more. They allow Single-page applications to be pre-rendered as HTML files before being deployed to the server.

Together with Edge Storage from Bunny CDN, they can automatically replicate your files around the world for the lowest latency and highest throughput possible, no matter where your users are

And the best, you can deploy your dist files directly from your GitHub repository. Just edit, push, and your changes are live.

To getting started with Bunny CLI as GitHub Action, just create a new workflow file that deploys your dist directory. In this example we will create .github/workflows/deploy.yml and configure the edge storage and pull zone:

name: Deploy to Edge Storage
on: [push]
jobs:
  deploy:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@master
      - name: Deploy to Edge Storage
        uses: ghostzero/bunny-action@main
        env:
          BUNNY_API_ACCESS_KEY: ${{ secrets.BUNNY_API_ACCESS_KEY }}
          BUNNY_STORAGE_HOSTNAME: storage.bunnycdn.com
          BUNNY_STORAGE_USERNAME: bunny-app
          BUNNY_STORAGE_PASSWORD: ${{ secrets.BUNNY_STORAGE_PASSWORD }}
          BUNNY_PULL_ZONE_ID: 464290
        with:
          args: deploy --dir=dist

Please note that you also need to generate your dist files. The example assumes that the dist folder already exists in the repository. You can always customize the dist folder with the --dir= paramater. The CLI always uses this directory as root directory.

Follow me!

Related stories

You liked Bunny CLI - Replicate and store your files to the edge!? You may also be interested in these following articles...
...

With SUBtember right around the corner, you might be wondering what all the fuss is about. What's the difference between a subathon and SUBtember? Let's take a closer look.

GhostZero
1 month ago
...

Düsseldorf. 70,000 visitors came to the DoKomi for manga fans and cosplay in Düsseldorf. This means that DoKomi set a new record for visitor numbers and a growth of +27 percent (compared to 2019).

GhostZero
3 months ago
...

Mit YAFS (Yet Another Firmware Selector) ist es nun möglich die Freifunk Ense Firmware für unterstützte Router zu finden und herunterzuladen.

GhostZero
6 months ago
GhostZero is live on Twitch!
Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy.