running script_checks with no docker, Node.js Deployment

I don’t have docker, and I’m trying to deploy my Node.js app, this works normally using flyctl deploy (well after some troubleshooting),
but:
It gets a lot harder when I try to use script_checks:

  [[services.script_checks]]
    interval      = "5s"
    timeout       = "1s"
    command       = "/app/health_check.sh"
    grace_period  = "5s"
    restart_limit = 0

Deployment fails, and using flyctl vm status <instance id> gives me:
rpc error: code = Unknown desc = bad response code: 500 => Unhandled rejection: Io(Os { code: 13, kind: PermissionDenied, message: "Permission denied" })
Similarly when I try to run the script using bash or sh i.e. "bash /app/health_check.sh" I get:

rpc error: code = Unknown desc = bad response code: 500 => Unhandled rejection: Io(Os { code: 2, kind: NotFound, message: "No such file or directory" })

Now connecting to the machine using flyctl ssh console and running the script manually indeed gives Permission denied error, but running it with bash works normally.

Any idea on how to solve this?

p.s: here’s the repo link, you can see I tried many variations :grimacing:

I am not sure how buildpacks work, but try some / all of these:

  1. The script is missing exec permissions, so modify: chmod +x ./health_check.sh
  2. Remove the shebang #!/bin/bash from health_check.sh 'cause bash may not be at /bin?
  3. Remove bash from [[services.script_checks]] command (ref).

Mhm…
I tried all of them, i.e.

command       = "chmod +x ./app/health_check.sh"

Also for some sanity check I tried:

command       = "chmod +x ./health_check.sh"

In both cases I got:

rpc error: code = Unknown desc = bad response code: 500 => Unhandled rejection: Io(Os { code: 2, kind: NotFound, message: "No such file or directory" })

Nah, not like that. See: Fix health_check.sh on Fly by ignoramous · Pull Request #1 · OoMiDOoO/full-stack-open-pokedex · GitHub

1 Like

Well… this works, but how can I change my exec permissions on my local (windows) machine? I’d like to reproduce the error (again) :smiley:

After some googling, I can set my config in .git to to watch for file modes, this would fix it for using Github Actions, but the remaining question is, does flyctl deploy monitor file mode change (mainly on windows)?

For anyone having the same problem:

flyctl deploy doesn’t mirror file permissions from your windows local machine, at least from what I have tried so far,

so either:
Use some linux distro and do as what @ignoramous did, i.e. change file permissions and deploy.
Or
Use docker since you can add chmod +x app/bin/* somewhere in your dockerfile
Or
See:

To make file executable in git therefore it will be executable on Github, you will need to deploy using Github Actions, for more help see my repo.

1 Like