Deployment
Github Actions
Use Github Actions for easy updates
This guide will walk you through the process of setting up a GitHub Actions to easily deploy updates for your Remix app to Fly.io.
Prerequisites
- A Fly.io account
- A GitHub repository with a fork of the boringdatabase repository.
- Flyctl CLI installed and authenticated on your local machine
Steps
1. Generate a Fly.io Access Token
-
Open your terminal at root of the boringdatabase repository
-
Run the following command:
fly tokens create deploy
You can also create a deploy token via the fly dashboard https://fly.io/apps/{your-app-name}/tokens
-
Copy the generated token
2. Add the Token to GitHub Secrets
- Go to your GitHub repository
- Click on “Settings” > “Secrets and variables” > “Actions”
- Click “New repository secret”
- Name:
FLY_API_TOKEN
- Value: Paste the token you copied earlier
- Click “Add secret”
3. View your GitHub Workflow File
- In your repository, you will find
.github/workflows/main.yml
- Uncomment the Deploy Production step!
deploy:
name: 🚀 Deploy
runs-on: ubuntu-22.04
needs: [lint, typecheck, vitest]
# only build/deploy branches on pushes
if: ${{ github.event_name == 'push' }}
steps:
- name: ⬇️ Checkout repo
uses: actions/checkout@v4
- name: 👀 Read app name
uses: SebRollen/toml-action@v1.2.0
id: app_name
with:
file: "fly.toml"
field: "app"
- name: 🎈 Setup Fly
uses: superfly/flyctl-actions/setup-flyctl@1.5
- name: 🚀 Deploy Production
if: ${{ github.ref == 'refs/heads/main' }}
run: flyctl deploy --remote-only --build-arg COMMIT_SHA=${{ github.sha }} --app boringdatabase-demo
env:
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }}
Github will automatically inject your FLY_API_TOKEN during the deploy stage
4. Commit and Push
- Commit the changes in your workflow to git.
6. Monitor Deployment
- Go to your GitHub repository
- Click on the “Actions” tab
- You should see the “Fly Deploy” workflow running
Troubleshooting
- If the deployment fails, check the workflow logs in the GitHub Actions tab
- Ensure your
fly.toml
file is correctly configured - Verify that your Fly.io account has the necessary permissions and resources