I have files generated by the phoenix web app that can be downloaded.
They are stored in a directory called downs of the app dir. if I change release I expect these files to stay where they are and be found by all releases
I have added plug Plug.Static, at: "/downs", from: Path.expand('./downs'), gzip: false
I then generate urls with /downs/xxx
1- if I run the app with mix phx.server from the app dir it works ok
2- if I run the app with _build/rel/prod/v1/bin/v1 start from the app dir (after having build the release) it works ok
the problem is :
3- if I upload the release previoulsy built (on another machine) to another directory test1 with the downs dir copied into test1 (but not in priv/static) , and from test1 I run v1/bin/v1 start, the app works ok but the files in downs are not found
I uploaded in test1 only the content of v1, not the full tree _build/prod/rel/v1
the url is correctly generated but looks like the plug static line is ignored in case 3
thanks for any advice
in short
> test1
> - downs
> - file1
> - v2
> - all files generated by mix release found under _build/prod/rel/v2 originally
file1 present when generating the release is found
but a file2 put by the application when running the release is not found for download although the url are exaclty similar
/downs/file1
/downs/file2
since file2 was put by the running application the app dir is ok but the download of the file intercepted by plug static works for file1 but not for file2
Note that with this MY_APP_DOWNS_PATH should match to a path on the machine where the releases will be run.
This won’t probabbly be what you want. So config/releases would serve you better.
Edit: MY_APP_DOWNS_PATH in my example is of course an absolute path and can even be outside the app folder.
I see you’ve already found a solution that works for you. ^^
I was assuming that your downs folder is not a classic “assets” folder files and shouldn’t be renewed from release to release.