I am using in my app a binary called cbc, which I download from the internet at the build and store it at opt/render/project/src/bin.
when I’m on the shell it recognizes cbc and it runs okay. To give you more info I’m running this command:
‘…/…/bin/cbc tmp/mp_h2_od_d0.93_tCQDP_0.mps cost column ratio 1 solve solu tmp/mp_h2_od_d0.93_tCQDP_0_sol_init.txt’
from the opt/render/project/src/solver_fpl/run/ directory at the shell and it works fine as it should, because it recognizes cbc (I’m providing the exact path) and the mp_h2_od_d0.93_tCQDP_0.mps file is at ./tmp/ directory.
But when I’m running the app it crashes on the same commandwith output:
FileNotFoundError: [Errno 2] No such file or directory: ‘…/…/bin/cbc tmp/mp_h2_od_d0.93_tCQDP_0.mps cost column ratio 1 solve solu tmp/mp_h2_od_d0.93_tCQDP_0_sol_init.txt’
What could be the problem?
Is the shell the exact environment where my app is running?
I’ve replied to the long-running ticket that we have around this, let’s keep the conversation in one place (on the ticket). To cover the same points for anyone finding this ticket:
Is the shell the exact environment where my app is running?
Yes, the “Shell” tab of a paid instance will be the view of the running instance (or a random running one if you have multiple instances)
If the files are “missing”, they are either being referenced incorrectly, or they may have been lost to the ephemeral filesystem of instances.
Render instances have an ephemeral filesystem, meaning any file written to the instance after it has booted will be lost when it next restarts (e.g. spun down if on free instance type, next deploy, manual restart, etc.).
If you want to persist download/generate on your running service, you’ll need to have a persistent store, e.g. a Render Disk (which is chargeable and also requires a paid instance type) or an external service like AWS S3.