In which directory are assets supposed to go when using releases?

I’m using elixir releases but compiling to another directory:

MIX_ENV=prod mix release --force --path ../myapp-releases/

And then building assets with:

MIX_ENV=prod mix help assets.deploy

My problem is that the assets will be created in the current working directory. And I need them in ../myapp-releases/, but I don’t know exactly in which directory to place them.

All my attempts so far result in 404s for any CSS and JS files.

assets go into /priv/static dir then go into the release. You should do the release after compiling the assets, not before.

This is what I just did. After copying the files to the production server I end up with this in my release directory:


But nevertheless, I still see 404s.

[debug] Converted error Phoenix.Router.NoRouteError to 404 response
[info] GET /assets/app-064645c1408a0fdfe1d2ab58d4944133.js
[info] Sent 404 in 270µs

Is there a place where the asset locations is configured? Maybe I changed it somehow.

In case it matters, I’m not using a webserver/reverse-proxy in front of Phoenix.

Are you sure Plug.Static in your endpoint is configured to serve those files? In older versions of phoenix css/js files were at the root not in the assets subfolder. You can also disable serving compressed files there iirc.


That was it. I had Plug.Static but it did not specify the assets directory. This is a 7 year old Phoenix project that I just converted to a recent Phoenix/Elixir. And I missed that.

Thanks a lot. :heart_decoration: