Rails perms - app/assets/images

This is more of a bug report, hopefully somebody sees it. I am trying fly.io for the first time using a toy Rails app. I have a few images in app/assets/images:

$ ls -l app/assets/images

.rw-r--r--@ 3 Oct 15:56 logo.svg
.rw-------@ 4 Oct 09:36 root-1.jpg
.rw-r--r--@ 3 Oct 16:23 root-hero-bottom.png
.rw-r--r--@ 3 Oct 16:22 root-hero-right.png
.rw-r--r--@ 3 Oct 16:22 root-hero-top.png

My assets compile and deploy just fine, but I have a broken image on the home page. HTTP 403 on the root-1.jpg file. I looked in fly console:

> puts `ls -l /app/public/assets`

-rw-r--r-- 1 Oct  5 21:32 logo-c100dc0f56d204f30329ee692d0c9eae3d4ed9f8.svg
-rw------- 1 Oct  5 21:32 root-1-8d240df62a70bdbdc00075a382165ad1f0501a9f.jpg
-rw-r--r-- 1 Oct  5 21:32 root-hero-bottom-3b8c2873dcdf10489a45ac4b903e95eab4bb6d8e.png
-rw-r--r-- 1 Oct  5 21:32 root-hero-right-b8f7c794aa3a0bef7a5b13ce1394f20ff0ba74c0.png
-rw-r--r-- 1 Oct  5 21:32 root-hero-top-7511b17a431da0861d8fadd730d832d742a90405.png

The file is there but fly won’t serve it. I guess this is because the file isn’t readable? It seems a bit odd that these perms were somehow copied all the way from my dev machine to fly.io, thereby preventing the file from being served. Somebody along the way should’ve made them readable, probably.

Workaround: a git precommit hook that verifies perms on my dev machine

1 Like

can you use fly logs to verify that this is a permission issue? The reason why I’m not sure is that I believe rails runs as root…

Definitely a perms issue. When I changed the perms on my dev machine (chmod a+r root-*) and redeployed the problem was fixed.

1 Like