DEV Community

Alan Schio
Alan Schio

Posted on

Deploy to Fly.io with bitbucket-pipelines

It is easy to find integrations for Github or GitLab, but i spent a couple of minutes trying to make it work, so why no sharing?

Create Fly Token

First go to your Fly.io App and create a Deploy Token (https://fly.io/apps/your-app/tokens)

Fly.io Create Deploy Token dialog

Let the Expiration if you want it to never expires

Token Generated

Add a Repository Variable

Now go to your bitbucket repository settings, under Pipeline side menu, at Repository Variables (https://bitbucket.org/YOURORG/YOURPROJECT/YOURREPO/pipelines/repository-variables).
And create a new variable with the name FLY_API_TOKEN.

Bitbucket add variable

Create the pipeline file

Now create your bitbucket-pipelines.yml file and use the golang image so you can install the flyctl and deploy your app.

image: golang:1.15
pipelines:
  default:
    - step:
        name: Deploy to Fly.io
        deployment: production
        script:
          - apt-get update -qq && apt-get install -y curl
          - curl -L https://fly.io/install.sh | sh
          - export FLYCTL_INSTALL="/root/.fly"
          - export PATH="$FLYCTL_INSTALL/bin:$PATH"
          - flyctl deploy

Enter fullscreen mode Exit fullscreen mode

Billboard image

The fastest way to detect downtimes

Join Vercel, CrowdStrike, and thousands of other teams that trust Checkly to streamline monitoring.

Get started now

Top comments (0)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs

👋 Kindness is contagious

Immerse yourself in a wealth of knowledge with this piece, supported by the inclusive DEV Community—every developer, no matter where they are in their journey, is invited to contribute to our collective wisdom.

A simple “thank you” goes a long way—express your gratitude below in the comments!

Gathering insights enriches our journey on DEV and fortifies our community ties. Did you find this article valuable? Taking a moment to thank the author can have a significant impact.

Okay