Unable to deploy from a repo in GitHub

I have been doing a task for troubleshooting engineer role where I have assigned to deploy an app in fly.io. I have followed all the steps mentioned in in the forum link : Continuous Deployment with Fly.io and GitHub Actions · Fly Docs

Still getting errors while I play with the commands. The most frequent errors I have received are.

1s

1Run flyctl deploy --remote-only -a buttonfly

6==> Verifying app config

7Error: failed to grab app config from existing machines, error: could not create a fly.toml from any machines :frowning:

8No machines configured for this app

9

10Error: Process completed with exit code 1.

==> Verifying app config
Validating /Users/sumoncule/Desktop/flyhirebutton/58032/.github/workflows/fly.toml
Platform: machines
✓ Configuration is valid
→ Verified app config
==> Building image
Remote builder fly-builder-dry-brook-6201 ready
Error: failed to fetch an image or build from source: app does not have a Dockerfile or buildpacks configured. See App Configuration (fly.toml) · Fly Docs

how to correct the error below. 0s
1
Run flyctl deploy --remote-only
6
Error: the config for your app is missing an app name, add an app_name field to the fly.toml file or specify with the -a flag`
7

8
Error: Process completed with exit code 1.

Someone please help me.

1 Like

Hi @bhaswar1212

The doc you linked to needs some updating. :slight_smile:

Are you trying to deploy the sample Go app from that document or a different app?

Where are you seeing the errors and at what point in the process?

In general, the correct order for the steps in Continuous Deployment with Fly.io and GitHub Actions · Fly Docs (which we’ll update shortly) should be like this:

  1. Fork go-example to your own GitHub repository.
  2. Clone the repository to your local machine
  3. NOTE: the example doesn’t seem to have a .gitignore file, so you can ignore this step. :slight_smile: Edit .gitignore and remove fly.toml if it is present in that file - fly.toml will need to be pushed into the repository to allow deployment to happen.
  4. Run flyctl launch from inside the go-example app directory to create a fly.toml configuration file. Say N to adding databases and N to deploy now
  5. Get a Fly API token by running flyctl tokens create deploy -x 999999h. Copy the output.
  6. Go to your newly created repository on GitHub and select Settings.
  7. Go to Secrets and variables > Actions and create a Repository secret called FLY_API_TOKEN with the value of the token from step 5.
  8. Back in your local go-example working directory, create .github/workflows/fly.yml with these contents (Note that the go-example’s default branch is currently master, yours might be main. Change the fly.yml file accordingly.):
name: Fly Deploy
on:
  push:
    branches:
      - master
jobs:
  deploy:
    name: Deploy app
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
      - uses: superfly/flyctl-actions/setup-flyctl@master
      - run: flyctl deploy --remote-only
        env:
          FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }}

  1. Commit your changes and push them up to GitHub.
  2. This is where the magic happens - The push will have triggered a deploy and from now on whenever you push a change, the app will automatically be redeployed.

You should see that the Fly Deploy workflow is running under the GitHub Actions tab.

1 Like

Hello Andie, He (bhaswar1212) already showed the issue and the error. I am also having the same issue. Specifically he said:

Error: the config for your app is missing an app name, add an app_name field to the fly.toml file or specify with the -a flag`

I am having the same issue. - yml file proof

However when we push our code to github we get this error:

You should, after following the process outlined in my reply above, have a fly.toml file in your repo. fly.toml is the config file for your app. You can run fly launch locally in your repo and then push the resulting fly.toml into your remote repo.

Yes, its in the repo but the issue still remained.
However I was able to find the fix to the issue. - Make sure the toml file itself has the app_name variable. Once I did this and pushed the code. it worked.

# fly.toml app configuration file generated for vgmify on 2023-05-18T11:06:18-07:00
#
# See https://fly.io/docs/reference/configuration/ for information about how to use this file.
#

app_name = "vgmify"
app = "vgmify"
primary_region = "lax"

[http_service]
  internal_port = 8080
  force_https = true
  auto_stop_machines = true
  auto_start_machines = true
  min_machines_running = 0

Curious if your fly.toml had no app name at all? Or did it have an auto-generated app name?

Hey masterjx9, Thank you for the solution. Even after running with your solution I am getting this error provided in the screenshot.

@bhaswar1212
Do you have a fly.toml file in your remote repo for the app named buttonfly?

1 Like

@bhaswar1212
Going back to some of your original errors, it seems like your fly.toml file (app config file) is in the directory where your fly.yml file (github actions file) should be. So, maybe the fly deploy command can’t find the Dockerfile it needs?

Suggest maybe starting over from the top of the instructions in my reply above.

yes fly.toml and fly.yml are at the same directory called workflows. fly.toml is created under the workflow once I run the command fly launch

Try moving your fly.toml file into the root directory of your app, where your Dockerfile is.

1 Like

Hello @andie - Sorry for the late reply.
When I ran flyctl launch it asked me for a name for the app and I put vgmify. That is what the app variable is. Then it asked for some other things which I declined to based on the documentation for CI/CD with github actions and fly.io.

Then it worked for me AFTER I changed my port to 8080 for fly.io in my app.py for flask/python. (I was used to having it as a variable because of heroku. lol)

Long story short - it seemed to work only AFTER I put the app_name: <INSERT NAME OF WEBAPP> variable as an environment variable inside the fly.toml file after its been created using the flyctl launch. After that, my git push commands would work and my webapp would update once I made sure my ports were set to 8080 for fly.io.

1 Like

@masterjx9 The joys of troubleshooting apps!

I’m 99% sure that app_name = "vgmify" doesn’t do anything in your fly.toml file, though. I’m not going to ask you to test it out, since you have things working now. :slight_smile: Obviously, we need to do better with that error message! It was probably just the deploy process not finding the fly.toml file.

We’ll be pushing some fixes to the docs and error messages, so thank you for posting about the issues you were seeing!

Still working on the error messages, but the docs are updated with the correct steps and info now:

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.