W
Wasp2w ago
lucky72o

Continuous Deployment with fly.io

I'm looking for instruction of what is the best practice setting up CD with WASP, github actions and fly.io. Could someone please point me out to documentation?
8 Replies
kapa.ai
kapa.ai2w ago
Hi @lucky72o. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave: ---------------------- I can help you with setting up Continuous Deployment for your Wasp app with GitHub Actions and Fly.io. Based on the knowledge sources, here's what's available: GitHub Actions for Wasp Deployment Wasp has a GitHub Action for deployment that you can use. According to the GitHub issue discussion, there is a deploy action available at: <https://github.com/wasp-lang/deploy-action> This action should help you set up CD with GitHub Actions. Fly.io Deployment Commands For deploying to Fly.io, Wasp provides CLI commands that you'll likely use in your CI/CD pipeline: 1. Initial setup (run once):
wasp deploy fly launch my-wasp-app <region>

wasp deploy fly launch my-wasp-app <region>

This creates your apps on Fly.io and generates fly-server.toml and fly-client.toml files that you should commit to version control. 2. Redeployment (for CD):
wasp deploy fly deploy

wasp deploy fly deploy

This is the command you'll use in your GitHub Actions workflow to update your deployed app with the latest changes. According to the deployment CLI documentation, you should run wasp deploy fly deploy whenever you want to update your deployed app. Setting Up CD While the knowledge sources don't provide a complete step-by-step guide for setting up CD with GitHub Actions, the general approach would be: 1. Use the Wasp deploy action from the repository mentioned above 2. Configure it to run wasp deploy fly deploy on pushes to your main branch 3. Ensure your fly-server.toml and fly-client.toml files are in version control I recommend checking out the wasp-lang/deploy-action repository for specific instructions on how to configure the GitHub Action for your workflow. ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ---------------------- Sorry @lucky72o, I seem to be having a bit of trouble. Don't worry though, I've pinged my support and they will try to fix me up! :technologist: Perhaps try again in 15mins?
miho
miho2w ago
Did the bot's answer help out? We talk about this in the docs: https://wasp.sh/docs/deployment/ci-cd
CI/CD Scenarios | Wasp
Setting up a CI/CD pipeline is an optional but highly recommended part of deploying applications.
lucky72o
lucky72oOP2w ago
yes, bot's answer was helpful, thanks! I’ve been trying to use the wasp-lang/deploy-action GitHub Action, but it fails on ubuntu-latest because the Node version in the GitHub runner (Node 20.x) doesn’t meet Wasp’s minimum requirement (Node 22.12+). The action doesn’t automatically install the correct Node version, so it errors out before deployment. Do you have a recommended workaround or update planned for the action so it installs the required Node version automatically? Thanks!
miho
miho2w ago
I actually have on my list this sprint to deprecate the action https://github.com/wasp-lang/wasp/issues/3385 and replace it docs on how to do the deploy without the action. What we'll recommend going forward: to just replicate the steps from the action in your own workflow: - install Node.js - install Wasp - run wasp deploy fly You can do something like this:
name: Wasp Deploy

on:
push:
branches:
- main

jobs:
deploy:
name: Deploy to Fly.io
runs-on: ubuntu-latest
env:
# You must add FLY_API_TOKEN to your Repository Secrets
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }}

steps:
- uses: actions/checkout@v5

- name: Setup Node.js
uses: actions/setup-node@v6
with:
node-version: '22'

- name: Install Wasp
run: curl -sSL https://get.wasp.sh/installer.sh | sh -s -- -v 0.19.0

- name: Install Flyctl
uses: superfly/flyctl-actions/setup-flyctl@master

- name: Deploy
run: wasp deploy fly deploy
name: Wasp Deploy

on:
push:
branches:
- main

jobs:
deploy:
name: Deploy to Fly.io
runs-on: ubuntu-latest
env:
# You must add FLY_API_TOKEN to your Repository Secrets
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }}

steps:
- uses: actions/checkout@v5

- name: Setup Node.js
uses: actions/setup-node@v6
with:
node-version: '22'

- name: Install Wasp
run: curl -sSL https://get.wasp.sh/installer.sh | sh -s -- -v 0.19.0

- name: Install Flyctl
uses: superfly/flyctl-actions/setup-flyctl@master

- name: Deploy
run: wasp deploy fly deploy
GitHub
Deprecate the Wasp Github Action · Issue #3385 · wasp-lang/wasp
Deprecate the https://github.com/wasp-lang/deploy-action Reasons for the deprecation It&#39;s quite a basic action that doesn&#39;t bring that values beyond being &quot;Wasp branded&quot;. The main...
lucky72o
lucky72oOP7d ago
I see, this what I ended up doing at the end thanks! @miho one suggestion to your deployment script is to pin the wasp installation version. My deployment jast broke because of new 0.19.0 wasp version
miho
miho7d ago
That's a good point - we do it usually, the script I sent over here was just a quick example so I missed that, sorry 🙈
lucky72o
lucky72oOP7d ago
no problem 🙂
MEE6
MEE67d ago
Wohooo @lucky72o, you just became a Waspeteer level 3!

Did you find this page helpful?