I have a project that I use kinda like a small CD system. This project run inside the VM where the main backend run as-well.
Both of them I deploy using releases with MIX_ENV=prod mix release
.
One of the actions that this small CD project does is call the backend migration command like this:
System.cmd("/backend/bin/backend", ["eval", "Release.migrate"])
When my project runs this, I get this error:
/backend/bin/backend: 18: .: cannot open /backend/release/releases/0.1.0/env.sh: No such file
{"", 2}
If I run the same command but from the terminal, it works fine, and if I copy the whole CD project source code and run it using iex -S mix
, then it works fine as-well, it only breaks when inside a release.
I guess this has to do with something from bundling the erlang VM inside the release or something like that, but I’m not sure.
Any suggestion on how to fix that? Or is this a bug?