Skip to content

Set tmux shell on init#286

Merged
pSpitzner merged 2 commits intorelease/2.0.0from
tmux_shell
Mar 13, 2026
Merged

Set tmux shell on init#286
pSpitzner merged 2 commits intorelease/2.0.0from
tmux_shell

Conversation

@semohr
Copy link
Collaborator

@semohr semohr commented Mar 9, 2026

closes #282

@semohr semohr changed the base branch from main to release/2.0.0 March 9, 2026 17:38
@lina-bh
Copy link

lina-bh commented Mar 9, 2026

perhaps need to add the venv bin directory to the PATH as well

@semohr
Copy link
Collaborator Author

semohr commented Mar 9, 2026

perhaps need to add the venv bin directory to the PATH as well

Not sure I get you, bash should be globally available for any user 🤔

Using the container docker exec -it beets-flask sh:

su beetle
which bash
> /usr/bin/bash

@lina-bh
Copy link

lina-bh commented Mar 9, 2026

Not for bash, but for beet

@semohr
Copy link
Collaborator Author

semohr commented Mar 9, 2026

I see what you mean now. Shouldn't be an issue as far as I can see, since we install all packages into the global python environment right now.

@pSpitzner
Copy link
Owner

I see what you mean now. Shouldn't be an issue as far as I can see, since we install all packages into the global python environment right now.

Im not a 100% sure about this 😅
Afaik we still have a .venv folder (which we might not want) but this requires us to make sure its activated or set as default venv.

> docker exec -it -u beetle beets-flask-dev bash
beetle@beets-container-dev:/repo$ which python
/repo/backend/.venv/bin/python

See #257 and #256

@semohr lets have a look at the venv convention together.

@semohr
Copy link
Collaborator Author

semohr commented Mar 9, 2026

Im not a 100% sure about this 😅 Afaik we still have a .venv folder (which we might not want) but this requires us to make sure its activated or set as default venv.

> docker exec -it -u beetle beets-flask-dev bash
beetle@beets-container-dev:/repo$ which python
/repo/backend/.venv/bin/python

See #257 and #256

@semohr lets have a look at the venv convention together.

We should only have one python binary which is located in .venv. We append that path to the global environment in the Dockerfile.

We might ship a unused binary since we inherit from FROM python:3.12-slim-trixie AS base and might want to change that going forward. For the PR here this should not matter as the right python binary is in the path and is used.

@lina-bh
Copy link

lina-bh commented Mar 9, 2026

I think it's worth making PATH explicit in the tmux session or really anywhere else that needs it. The image environment variables work until they don't because some process got created in a different way or the environment was overwritten.

@semohr
Copy link
Collaborator Author

semohr commented Mar 10, 2026

The whole point of using a containerized image is to provide a reproducible environment. We need to be able to trust that the environment variables set in the Dockerfile are consistently available, regardless of the machine or runtime. This should be a core guarantee of containerized applications.

If another application or image runner modifies environment variables like PATH in a way that breaks that guarantee, it’s better to address that behavior in the tool itself rather than working around it in each individual setup.

Having different etc/passwd files depending on deployment is understandable, but changes to our environment variables shouldn’t happen.


I don’t think we need to preemptively include code/potential fixes that might be unnecessary. Let’s see if this fix works first. We can always revisit it if it doesn’t 🙃

As an fyi, for me the path seems to be correctly set inside the tmux session:

beetle@beets-container:/music/inbox$ echo $PATH
/repo/backend/.venv/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin

@pSpitzner pSpitzner merged commit 0810c72 into release/2.0.0 Mar 13, 2026
2 checks passed
@pSpitzner pSpitzner deleted the tmux_shell branch March 13, 2026 08:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Integrated tmux cannot start if user's login shell is /sbin/nologin

3 participants