Deploy to Fly.io automatically with Tangled pipelines#
Deploying to Fly.io via a Tangled pipeline is incredibly easy.
Step 1: get started with Fly.io (optional)#
The first step is launching your Fly app. I'll defer to the Fly.io docs for this: Quickstart: Launch your app
Step 2: create a deploy token#
On the dashboard, select the application you just created. On the sidebar, select "Tokens". Create a new one called "Tangled" or something else that fits your needs. Once you've done that, go back to your Tangled repository and go to the "Settings" page and and select the "pipelines" tab. In the "Secrets" section, click "add secret". The name of the secret will be FLY_API_TOKEN and the content will be the deploy token you just made. Save it, and you're good to go!
Step 3: add the workflow#
Now that you've technically authenticated with Fly, put the following workflow file in your repository, and you're ready to deploy! Just commit this and head back over to Tangled. On the "pipelines" page you'll see your pipeline running! It's genuinely that simple. Once it's done you can visit your application on Fly.io and make sure everything looks good.
.tangled/workflows/deploy.yml
when:
- event: ["push", "manual"]
branch: ["main"]
engine: "nixery"
dependencies:
nixpkgs:
- flyctl
steps:
- name: deploy
command: |
fly deploy --remote-only --ha=false