Deploying to Fly.io
This guide explains how to configure your Fluxon application for deployment on Fly.io.
Dockerfile
Your Dockerfile needs to be configured to access the Fluxon repository during the build process. Add the following RUN
command before your dependency installation:
RUN --mount=type=secret,id=FLUXON_LICENSE_KEY \
mix hex.repo add fluxon https://repo.fluxonui.com \
--fetch-public-key "SHA256:zF8zWamOWgokeJdiIYgRl91ZBmQYnyXlxIOp3ralbos" \
--auth-key "$(cat /run/secrets/FLUXON_LICENSE_KEY)"
# Your existing deps installation
RUN mix deps.get --only $MIX_ENV
Deployment
Local Deployment
For local deployments using fly deploy
, you'll need to set up your license key as an environment variable:
# Set license key
export FLUXON_LICENSE_KEY="your-license-key"
# Deploy with the license key as a build secret
fly deploy --build-secret FLUXON_LICENSE_KEY=$FLUXON_LICENSE_KEY
GitHub Actions
To deploy using GitHub Actions, you'll need to configure your repository secrets and workflow:
Add
FLUXON_LICENSE_KEY
to your repository secrets at:https://github.com/[user]/[repo]/settings/secrets/actions
Configure your workflow (
.github/workflows/fly.yml
):
name: Fly Deploy
on:
push:
branches:
- main
jobs:
deploy:
name: Deploy app
runs-on: ubuntu-latest
concurrency: deploy-group
steps:
- uses: actions/checkout@v4
- uses: superfly/flyctl-actions/setup-flyctl@master
- run: |
flyctl deploy --remote-only \
--build-secret FLUXON_LICENSE_KEY="${{ secrets.FLUXON_LICENSE_KEY }}"
env:
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }}
Security Note
Never commit your Fluxon license key directly in your repository. Always use environment variables or secrets management.