App doesn't respect the fly.toml?

Hi,

I deployed my Remix app to Fly via Github actions and it works fine. However, I deployed the same app to the staging, it doesn’t work, the Github action was just hanging there.

I check the staging app logs and see the app runs with port 3000. However, I think it should run on port 8080. It doesn’t follow things that I set in fly.toml. Do I need a separate fly.toml file for the staging app?

app ready: http://localhost:3000

My CI/CD

  • The deploy production works perfect
  • The deploy staging doesn’t work
      - name: 🚀 Deploy Staging
        if: ${{ github.ref == 'refs/heads/staging' }}
        uses: superfly/flyctl-actions@1.3
        with:
          args: "deploy --app app-fly-staging --image registry.fly.io/${{ steps.app_name.outputs.value }}:${{ github.ref_name }}-${{ github.sha }}"
        env:
          FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }}

      - name: 🚀 Deploy Production
        if: ${{ github.ref == 'refs/heads/aiven-fly' }}
        uses: superfly/flyctl-actions@1.3
        with:
          args: "deploy --app app-fly --image registry.fly.io/${{ steps.app_name.outputs.value }}:${{ github.ref_name }}-${{ github.sha }}"
        env:
          FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }}

My fly.toml

app = "app-fly"
kill_signal = "SIGINT"
kill_timeout = 5
processes = []

[env]
  PORT = "8080"
  FLY = "true"

[experimental]
  allowed_public_ports = []
  auto_rollback = true

[[services]]
  http_checks = []
  internal_port = 8080
  processes = ["app"]
  protocol = "tcp"
  script_checks = []
  [services.concurrency]
    hard_limit = 25
    soft_limit = 20
    type = "connections"

  [[services.ports]]
    force_https = true
    handlers = ["http"]
    port = 80

  [[services.ports]]
    handlers = ["tls", "http"]
    port = 443

  [[services.tcp_checks]]
    grace_period = "1s"
    interval = "15s"
    restart_limit = 0
    timeout = "2s"

I am on the Launch plan and wondering how many app I could run?

Hey,

Yes need a different fly.toml config for each app/environment. You can name it anything you want and pass --config <file-name> to the deploy command to indicate which configuration file you want to use. Let’s say fly.prod.toml for production and fly.stage.toml for staging.

1 Like

Hi,

I follow this template and it doesn’t seem we need to create a new fly.toml for each app/environment

Could we override the fly.toml config with deploy --app app-name

That overrides the app name for v1 Apps, yes. And it should work.

Better to rely on multiple configs (like suggested above), as it’s more cleaner and less error prone, imo.