Hi, first thanks to the geniuses at Fly, I’ve had a blast this week learning it all.
I’m trying to create a Fly app through Github actions. I’ve had reasonable success but I hit a block when I tried to deploy. I believe now that it’s because I’m not getting a build machine on fly to deploy my applications.
When I run the following command from the terminal, it creates a remote builder for me.
flyctl launch --remote-only --org personal --name demo-keycloak-app-actions
Funnily enough it seems to do this with or without the --remote-only flag too.
When I run this same command in the Github Action however, with --remote-only, no remote builder is created, so when I later do
flyctl deploy -a demo-keycloak-app-actions --remote-only --config ${{ github.workspace }}/../../fly.toml, it fails with
Error: failed to grab app config from existing machines, error: could not create a fly.toml from any machines :-(
Am I right in thinking that it’s because of not having a remote builder that I’m failing to deploy? For reference, I’m building a Keycloak application with the following steps (still a work in progress)
Cool I missed that about --remote-only, that explains a lot! I want to create an app just once. At the moment my goals for this Action would be to be able to reuse it to create Dev and Prod environments, and be able to create apps based on whatever the repo name is, so all I need to do is create a repo with a dockerfile, create this Action and it should just deploy my application automatically.
I’ll paste the Action file I have at the moment, just bear in mind it’s still a work in progress lol, it’s my first time creating a yaml file like this, I was going to make it clean after I got it all working.
I captured the fly.toml file from the Launch step and pushed it to my repo, but I’m just realising now that although it pushes to the repo before the Deploy stage, the action may have it’s own lifecycle or something and use the older version of the repo, I’m not sure. Maybe I should use artifacts.
That workflow always launches the app, and that will cause error when it runs the second time after the app has been created.
It’s not particularly clear to me what you’re trying to achieve here. I think you can find examples in the fly.io docs on how to use it in CI/CD. I’d also recommend checking out flycd.dev if you’re struggling with YAML and creating a good workflow.
I’m not quite sure what you mean by ‘always launches the app’. Do you mean just the fact that it happens every time on push? I don’t intend to let that happen when I’m finished.
I’m just trying to achieve the last deploy step. But I’m struggling with Fly not being able to do that, the only error I get is Error: failed to grab app config from existing machines, error: could not create a fly.toml from any machines :-(. I assume it means a toml file from one of the remote build machines because I’m supplying it from my git repository.
I’ll be honest, I’ve only ever used some pretty simple github actions. So it might be helpful if someone else chimes in on how to achieve what you want to do.
Usually I’ll see users deploying apps on push. So the app gets re-deployed whenever there’s a code change.
You should clone your repo locally. Run fly launch from your terminal. And then push the resulting fly.toml into the repo. Then just have the fly deploy steps in the github action. If your fly.toml is in the repo’s top level working directory, then you won’t get the error anymore and you won’t need to use the --config flag.
I agree with the deployment on push. I was just experimenting to see if I could do the entire thing automated, but it’s starting to become more of a pain than it’s worth to be honest lol. It works perfectly fine from the console.
Hi all, thank you all for the help! It set me in the right direction.
I’ve ‘solved’ this by just launching from the command line. It’s far far simpler, it wasn’t worth the effort to get it all going purely by a GitHub action.
I have a simple Github repo now that we can just fork from, name our repo/app name, clone it, launch, push the Toml file, and the Action will do all those other steps nice and easy. So fast too.