I am able of deploying my app, both the web app process and my worker processes.
When I log into a machine via flyctl ssh console --app 'my_app', while I do get access to the machine, the environment that is set up for me isn’t exactly what the Dockerfile says.
In particular, the Dockerfile modifies PATH so I can use the python version from .venv instead of the /usr/bin/python. Why? because the .venv version has all the PIP packages I need.
Disclaimer, this works perfectly in the processes being run, my problem is only while connecting via SSH.
In the Dockerfile:
ENV PATH="/.venv/bin/:$PATH"
If I just log in via ssh, and run printenv PATH, I can clearly see venv is not there.
So if I then run python, and use “import redis” or any other import from packages that are installed, they of course are not found, as I’m using /usr/bin/python instead of ./venv/bin/python
I can run it manually doing PATH="/.venv/bin/:$PATH" python to overwrite the environment variable and then I can run things as I intended, but that is not what I would expect.
To be absolutely clear, I would expect the environment variables to still be set, instead of only having the ones from fly.production.toml
Hi… The ones from the Dockerfile actually were set, it’s just that PATH got overwritten—by the normal SSH login sequence.
Try the following instead:
$ fly ssh console --pty -C bash
The different behavior that you’re expecting to be the default was requested immediately after fly ssh was released, as part of the very first reply to the announcement post:
A workaround that gives you that final item with less typing might be to try modifying root’s ~/.profile.
Personally, the existing behavior is closer to what I expect from something named ssh, but I appreciate a lot of the logic in what the two of you are saying. Maybe there could be a separate “resume within Dockerfile” kind of operation, eventually.
Thanks for the reply. now I think it might be easier to use the regular ssh and set the path variable by myself as its a lot more cumbersome setting the project’s toml file env vars than just PATH.
I’m very grateful for the fast reply <3, take care.