basic rails app fails to deploy

Can you show more logs?

Also, try with LOG_LEVEL=debug fly deploy --nixpacks.

DEBUG Loaded flyctl config from/Users/tunde/.fly/config.yml
DEBUG determined hostname: "TUNDEs-MacBook-Pro.local"
DEBUG determined working directory: "/Users/tunde/Desktop/Dev/booapi"
DEBUG determined user home directory: "/Users/tunde"
DEBUG determined config directory: "/Users/tunde/.fly"
DEBUG ensured config directory exists.
DEBUG ensured config directory perms.
DEBUG cache loaded.
DEBUG config initialized.
DEBUG initialized task manager.
DEBUG started querying for new release
DEBUG client initialized.
DEBUG --> POST https://api.fly.io/graphql

{
  "query": "query ($appName: String!) { appbasic:app(name: $appName) { id name platformVersion organization { id slug } } }",
  "variables": {
    "appName": "boo-api"
  }
}

DEBUG {}
DEBUG <-- 200 https://api.fly.io/graphql (1.44s)

{
  "data": {
    "appbasic": {
      "id": "boo-api",
      "name": "boo-api",
      "platformVersion": null,
      "organization": {
        "id": "zQpLKVXNGapwgH61jXMLyk5zbLcmLmQBY",
        "slug": "personal"
      }
    }
  }
}
DEBUG app config loaded from /Users/tunde/Desktop/Dev/booapi/fly.toml
==> Verifying app config
--> Verified app config
==> Building image
DEBUG trying remote docker daemon
DEBUG Trying 'Nixpacks' strategy
DEBUG --> POST https://api.fly.io/graphql

{
  "query": "mutation($input: EnsureMachineRemoteBuilderInput!) { ensureMachineRemoteBuilder(input: $input) { machine { id state ips { nodes { family kind ip } } }, app { name organization { id slug } } } }",
  "variables": {
    "input": {
      "appName": "boo-api",
      "organizationId": null
    }
  }
}

DEBUG {}
DEBUG <-- 200 https://api.fly.io/graphql (1.85s)

{
  "data": {
    "ensureMachineRemoteBuilder": {
      "machine": {
        "id": "9080170c655987",
        "state": "started",
        "ips": {
          "nodes": [
            {
              "family": "v6",
              "kind": "public",
              "ip": "2604:1380:4601:d602:0:72e2:289e:1"
            },
            {
              "family": "v4",
              "kind": "private",
              "ip": "172.19.16.130"
            },
            {
              "family": "v6",
              "kind": "privatenet",
              "ip": "fdaa:0:9bf4:a7b:23c8:72e2:289e:2"
            }
          ]
        }
      },
      "app": {
        "name": "fly-builder-purple-waterfall-6060",
        "organization": {
          "id": "zQpLKVXNGapwgH61jXMLyk5zbLcmLmQBY",
          "slug": "personal"
        }
      }
    }
  }
}
DEBUG checking ip &{Family:v6 Kind:public IP:2604:1380:4601:d602:0:72e2:289e:1 MaskSize:0}
DEBUG checking ip &{Family:v4 Kind:private IP:172.19.16.130 MaskSize:0}
DEBUG checking ip &{Family:v6 Kind:privatenet IP:fdaa:0:9bf4:a7b:23c8:72e2:289e:2 MaskSize:0}
DEBUG --> POST https://api.fly.io/graphql

Waiting for remote builder fly-builder-purple-waterfall-6060... 🌍 {
  "query": "query ($appName: String!) { appbasic:app(name: $appName) { id name platformVersion organization { id slug } } }",
  "variables": {
    "appName": "boo-api"
  }
}

DEBUG {}
Waiting for remote builder fly-builder-purple-waterfall-6060... 🌎 DEBUG <-- 200 https://api.fly.io/graphql (427.22ms)

{
  "data": {
    "appbasic": {
      "id": "boo-api",
      "name": "boo-api",
      "platformVersion": null,
      "organization": {
        "id": "zQpLKVXNGapwgH61jXMLyk5zbLcmLmQBY",
        "slug": "personal"
      }
    }
  }
}
DEBUG --> POST https://api.fly.io/graphql

{
  "query": "mutation($input: ValidateWireGuardPeersInput!) { validateWireGuardPeers(input: $input) { invalidPeerIps } }",
  "variables": {
    "input": {
      "peerIps": [
        "fdaa:0:9bf4:a7b:957f:0:a:2"
      ]
    }
  }
}

DEBUG {}
Waiting for remote builder fly-builder-purple-waterfall-6060... 🌍 DEBUG <-- 200 https://api.fly.io/graphql (460.61ms)

{
  "data": {
    "validateWireGuardPeers": {
      "invalidPeerIps": []
    }
  }
}
Waiting for remote builder fly-builder-purple-waterfall-6060... 🌏 DEBUG Remote builder available, but pinging again in 50ms to be sure
Waiting for remote builder fly-builder-purple-waterfall-6060... 🌎 DEBUG Remote builder available, but pinging again in 50ms to be sure
Waiting for remote builder fly-builder-purple-waterfall-6060... 🌍 DEBUG Remote builder available, but pinging again in 50ms to be sure
Waiting for remote builder fly-builder-purple-waterfall-6060... 🌎 DEBUG Remote builder is ready to build!
Remote builder fly-builder-purple-waterfall-6060 ready
DEBUG --> POST https://api.fly.io/graphql

{
  "query": "mutation($input: ValidateWireGuardPeersInput!) { validateWireGuardPeers(input: $input) { invalidPeerIps } }",
  "variables": {
    "input": {
      "peerIps": [
        "fdaa:0:9bf4:a7b:957f:0:a:2"
      ]
    }
  }
}

DEBUG {}
DEBUG <-- 200 https://api.fly.io/graphql (467.9ms)

{
  "data": {
    "validateWireGuardPeers": {
      "invalidPeerIps": []
    }
  }
}
DEBUG --> POST https://api.fly.io/graphql

{
  "query": "mutation($input: EnsureMachineRemoteBuilderInput!) { ensureMachineRemoteBuilder(input: $input) { machine { id state ips { nodes { family kind ip } } }, app { name organization { id slug } } } }",
  "variables": {
    "input": {
      "appName": "boo-api",
      "organizationId": null
    }
  }
}

DEBUG {}
DEBUG <-- 200 https://api.fly.io/graphql (735.51ms)

{
  "data": {
    "ensureMachineRemoteBuilder": {
      "machine": {
        "id": "9080170c655987",
        "state": "started",
        "ips": {
          "nodes": [
            {
              "family": "v6",
              "kind": "public",
              "ip": "2604:1380:4601:d602:0:72e2:289e:1"
            },
            {
              "family": "v4",
              "kind": "private",
              "ip": "172.19.16.130"
            },
            {
              "family": "v6",
              "kind": "privatenet",
              "ip": "fdaa:0:9bf4:a7b:23c8:72e2:289e:2"
            }
          ]
        }
      },
      "app": {
        "name": "fly-builder-purple-waterfall-6060",
        "organization": {
          "id": "zQpLKVXNGapwgH61jXMLyk5zbLcmLmQBY",
          "slug": "personal"
        }
      }
    }
  }
}
DEBUG checking ip &{Family:v6 Kind:public IP:2604:1380:4601:d602:0:72e2:289e:1 MaskSize:0}
DEBUG checking ip &{Family:v4 Kind:private IP:172.19.16.130 MaskSize:0}
DEBUG checking ip &{Family:v6 Kind:privatenet IP:fdaa:0:9bf4:a7b:23c8:72e2:289e:2 MaskSize:0}
DEBUG --> POST https://api.fly.io/graphql

{
  "query": "mutation($input: ValidateWireGuardPeersInput!) { validateWireGuardPeers(input: $input) { invalidPeerIps } }",
  "variables": {
    "input": {
      "peerIps": [
        "fdaa:0:9bf4:a7b:957f:0:a:2"
      ]
    }
  }
}

DEBUG {}
DEBUG <-- 200 https://api.fly.io/graphql (466.06ms)

{
  "data": {
    "validateWireGuardPeers": {
      "invalidPeerIps": []
    }
  }
}
Proxying local port /var/folders/4h/_83sbzt9083fbl90zplwz89m0000gn/T/268362603/docker.sock to remote [fdaa:0:9bf4:a7b:23c8:72e2:289e:2]:2375
DEBUG calling nixpacks at /Users/tunde/.fly/bin/nixpacks with args: [build --name registry.fly.io/boo-api:deployment-01GD90PK5SYXCBHMMC8E4003XZ /Users/tunde/Desktop/Dev/booapi] and docker host: unix:///var/folders/4h/_83sbzt9083fbl90zplwz89m0000gn/T/268362603/docker.sock
╔═══════════════════════════════ Nixpacks v0.5.7 ══════════════════════════════╗
β•‘ setup      β”‚ pkgs: procps, libpq-dev                                         β•‘
β•‘            β”‚ cmds: curl -sSL https://get.rvm.io | bash -s stable && .        β•‘
β•‘            β”‚ /etc/profile.d/rvm.sh                                           β•‘
β•‘            β”‚ rvm install ruby-3.1.2                                          β•‘
β•‘            β”‚ rvm --default use ruby-3.1.2                                    β•‘
β•‘            β”‚ gem install bundler:2.3.20                                      β•‘
β•‘            β”‚ echo 'source /usr/local/rvm/scripts/rvm' >> /root/.profile      β•‘
║──────────────────────────────────────────────────────────────────────────────║
β•‘ install    β”‚ bundle install                                                  β•‘
║──────────────────────────────────────────────────────────────────────────────║
β•‘ build      β”‚ bundle exec rake assets:precompile                              β•‘
║──────────────────────────────────────────────────────────────────────────────║
β•‘ start      β”‚ bundle exec bin/rails server -b 0.0.0.0 -p ${PORT:-3000} -e     β•‘
β•‘            β”‚ $RAILS_ENV                                                      β•‘
β•šβ•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•

Error: Please install Docker to build the app https://docs.docker.com/engine/install/
DEBUG result image:<nil> error:exit status 1
Error failed to fetch an image or build from source: exit status 1

Ok, that’s interesting.

Try the following:

fly m start -a fly-builder-purple-waterfall-6060 9080170c655987
fly proxy /var/run/docker.sock:2375 -a fly-builder-purple-waterfall-6060
curl --unix-socket /var/run/docker.sock http://localhost/info

If fly proxy does not work on the first try, keep trying a few times, the machine might not be running yet.

This sequence of commands will essentially proxy docker from the Fly machine (remote builder) to the standard unix path.

The last curl just shows that it’s working.

Then try fly deploy --nixpacks again if it’s all working.

okay, I will try that and get back to you.

So I have run fly proxy /var/run/docker.sock:2375 -a fly-builder-purple-waterfall-6060

several times and I keep getting this error:

Error listen unix /var/run/docker.sock: bind: permission denied

Ok that would explain your issues.

Can you ls -lah /var/run and show me the output?

new message after several tries:


Error fly-builder-purple-waterfall-6060.internal: host was not found in DNS

ls -lah /var/run is displaying the following:

drwxrwxr-x  30 root             daemon            960B Sep 18 17:19 .
drwxr-xr-x  31 root             wheel             992B Sep 13 11:08 ..
-rw-r--r--   1 root             daemon              0B Sep 18 20:06 .autoBackup
srwxrwxrwx   1 root             daemon              0B Sep 18 10:25 .sim_diagnosticd_socket
-rw-r--r--   1 root             daemon              4B Sep 18 10:25 auditd.pid
-rw-------   1 root             daemon              0B Sep 18 10:25 automount.initialized
drwxr-xr-x   3 _assetcache      _assetcache        96B Sep 18 10:25 com.apple.AssetCache
----------   1 root             daemon              0B Sep 18 10:25 com.apple.WindowServer.didRunThisBoot
-r--------   1 root             daemon              0B Sep 18 10:25 com.apple.logind.didRunThisBoot
-r--------   1 root             daemon              0B Sep 18 10:25 com.apple.loginwindow.didRunThisBoot
-r--------   1 root             daemon              0B Sep 18 10:25 com.apple.mdmclient.daemon.didRunThisBoot
-rw-r--r--   1 root             daemon              0B Sep 18 10:26 com.apple.softwareupdate.availableupdatesupdated
drwxr-xr-x   2 root             daemon             64B Sep 18 10:25 com.apple.wifivelocity
srwxrwxrwx   1 root             daemon              0B Sep 18 10:25 cupsd
-rw-r--r--   1 root             daemon              4B Sep 18 10:25 diskarbitrationd.pid
drwxr-xr-x   3 _displaypolicyd  _displaypolicyd    96B Sep 18 10:25 displaypolicyd
-rw-r--r--   1 root             wheel              16B Sep 18 10:25 fudinit
srw-rw-rw-   1 root             daemon              0B Sep 18 10:25 mDNSResponder
drwx------   3 root             daemon             96B Sep 18 10:25 mds
srwxrwxrwx   1 root             daemon              0B Sep 18 10:25 portmap.socket
srwxrwxrwx   1 root             daemon              0B Sep 18 10:25 pppconfd
-rw-r--r--   1 root             daemon            360B Sep 18 10:25 resolv.conf
srw-rw-rw-   1 root             daemon              0B Sep 18 10:25 syslog
-rw-r--r--@  1 root             daemon              3B Sep 18 10:25 syslog.pid
-r--r--r--   1 root             daemon              0B Sep 18 10:25 systemkeychaincheck.done
srw-rw-rw-   1 root             daemon              0B Sep 18 10:25 systemkeychaincheck.socket
srwxrwxrwx   1 root             daemon              0B Sep 18 10:25 usbmuxd
-rw-r--r--@  1 root             daemon            3.1K Sep 18 20:18 utmpx
srw-------   1 root             daemon              0B Sep 18 10:25 vpncontrol.sock
-rw-r--r--   1 root             wheel               0B Sep 18 10:25 wifi

Looks like you don’t have permission to write to /var/run. That’s possibly why I didn’t do that at when I added the nixpacks functionality.

This shouldn’t matter anyway. Try this instead:

fly m start -a fly-builder-purple-waterfall-6060 9080170c655987
fly proxy /Users/tunde/docker.sock:2375 -a fly-builder-purple-waterfall-6060
curl --unix-socket /Users/tunde/docker.sock http://localhost/info

Here I’m just trying to make sure you can proxy requests to the remote builder.

are these

fly proxy /Users/tunde/docker.sock:2375 -a fly-builder-purple-waterfall-6060
curl --unix-socket /Users/tunde/docker.sock http://localhost/info

together or they should be run one after the other?

Each line is a separate command

okay so this line is not responding at the moment

fly proxy /Users/tunde/docker.sock:2375 -a fly-builder-purple-waterfall-6060

after running the above all I can see at my terminal is this:

Proxying local port /Users/tunde/docker.sock to remote [fly-builder-purple-waterfall-6060.internal]:2375

and the cursor stopped… no progress.

Oh right, you need to open a new terminal to run the curl command. Sorry, I should’ve specified.

okay let me do that

Btw, this is likely because nixpacks currently require docker to be installed locally (but it doesn’t require a local docker daemon to be running).

1 Like

Hi, so the steps you spelled yesterday didn’t work. I opened a new terminal like you suggested and I kept getting errors. I wanted to let you know immediately but my post was limited. So I tried theses steps

fly m start -a fly-builder-purple-waterfall-6060 9080170c655987
fly proxy /Users/tunde/docker.sock:2375 -a fly-builder-purple-waterfall-6060
curl --unix-socket /Users/tunde/docker.sock http://localhost/info

and I got:

Error listen unix /Users/tunde/docker.sock: bind: address already in use

what do I do again? The app has not been deployed as I write this.

@tunde - sometimes when I get stuck trying to get a big thing working I try starting over with a small thing, get that working, and try to see what the difference is. With that in mind, can you try Getting Started Β· Fly Docs ? If that works for you, then lets figure out what is different about your application. If that doesn’t work for you, then we can eliminate your application from the debugging and work on what is left.

I tried it using the getting started docs and I got errors. Jerome stepped in and we were making progress in solving it. But I still have errors. maybe you can read up the chats and continue from where Jerome stopped?

1 Like