Home Posts Post Search Tag Search

Game Site Journal - 13 Fly.io Deployment issues
Published on: 2025-04-28 Tags: elixir, Blog, Side Project, LiveView, Game Site, Fly, Deployment

Fixing the Fly.io Deploy Issue

I ran into a deployment problem that ended up being surprisingly simple: some of my files had Windows-style line endings (CRLF) instead of the Linux-style (LF) that Fly.io expects.


How I Found the Issue

I tracked the problem down systematically:

  1. I went through older commits until I found one that deployed successfully.
  2. Then I ran a diff against the current master branch:
git diff <working-branch-id> master
  1. While scrolling through the diff, I noticed a lot of lines ending with ^M — a clear sign of Windows line endings.

  2. In VSCode, I simply clicked the CRLF indicator in the bottom-right corner and changed the format to LF.

This immediately resolved the deploy issues.


Steps I Took to Rule Out Other Causes

1. Checked Local Permissions

I verified that my local files had the correct permissions:

ls -l rel/overlays/bin
-rwxr-xr-x 1 vinny vinny 99 Apr 28 10:58 migrate
-rwxr-xr-x 1 vinny vinny 52 Apr 28 10:27 migrate.bat
-rwxr-xr-x 1 vinny vinny 91 Apr 28 10:27 server
-rwxr-xr-x 1 vinny vinny 49 Apr 28 10:27 server.bat
  • User vinny → read, write, execute (rwx)
  • Group → read, execute (rx)
  • Others → read, execute (rx)

✅ Local permissions were fine.


2. Checked the Remote Server

I SSHed into the Fly.io server:

fly ssh console
ls -l /app/bin/migrate

Output:

-rwxr-xr-x 1 nobody root 96 Apr 24 02:32 /app/bin/migrate
  • The file exists with the right permissions.

I then tried running it manually:

/app/bin/migrate
# Output: 18:52:19.672 [info] Migrations already up

✅ The script works as expected.


3. Tried Running as the Correct User

runuser -u nobody -- /app/bin/migrate
# Output: 19:04:36.875 [info] Migrations already up

✅ Also works correctly.


4. Attempted Release Command Override

I tried changing the release command in fly.toml:

release_command = "runuser -u nobody -- /app/bin/migrate"

❌ This did not solve the deploy problem.


The Real Culprit

After all this, I checked the source files in GitHub and noticed the ^M characters — the Windows line endings.

Switching the files to LF in VSCode fixed everything.


Takeaways

  • Deployment issues like No such file or directory can sometimes be caused by line ending formats.
  • Systematic debugging — checking local permissions, verifying remote files, and manually running scripts — helps rule out other causes.
  • Always ensure your repository uses LF line endings for Linux-based deploy targets like Fly.io.