Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Command history cleans up all the time #289

Closed
ihor-sviziev opened this issue Feb 3, 2021 · 7 comments · Fixed by #304
Closed

Command history cleans up all the time #289

ihor-sviziev opened this issue Feb 3, 2021 · 7 comments · Fixed by #304
Labels
enhancement New feature or request
Milestone

Comments

@ihor-sviziev
Copy link
Contributor

Hi,

I found that when I'm rebooting my computer and then running warden env up - it all the time re-creates php-fpm container. As a result, the entire command history in the warden shell is getting lost.

It would be great if we could persist command history OR do not re-create the php-fpm container when it's not really needed (for instance new image was pulled, or some config has changed, etc.)

@Den4ik
Copy link

Den4ik commented Feb 13, 2021

@ihor-sviziev if you will use warden env start container will not be recreated

@sprankhub
Copy link
Contributor

+1 for persisting the command history.

@ihor-sviziev
Copy link
Contributor Author

ihor-sviziev commented Feb 17, 2021

@Den4ik looks like warden env up re-creates php-fpm container because of changing the SSH_AUTH_SOCK variable after reboot.

I see this behavior on WSL2 + the following solution for ssh agent.
It seems if I'll switch to the solution with single static ssh auth sock - it shouldn't re-create containers.

if ! pgrep ssh-agent > /dev/null; then
  rm -f /tmp/ssh-auth-sock
  eval "$(ssh-agent -s -a /tmp/ssh-auth-sock)"
  ssh-add
else
  export SSH_AUTH_SOCK=/tmp/ssh-auth-sock
fi

Seems like on Mac OS we have static SSH_AUTH_SOCK, that's why we don't have such an issue, but we do have it on WSL2 and Ubuntu 20.04 (didn't look for a solution for clean Ubuntu)

@davidalger
Copy link
Collaborator

@ihor-sviziev Interesting workaround. That would explain why I hadn't experienced the behavior myself, primary driver being Mac OS only occasionally working on my Linux box. Using start vs up would prevent the re-create as well then, since it docker-compose doesn't look for changes in the container spec when only start has been requested. Sounds like we've got the best of both worlds: workaround to prevent re-create and persisted bash history thanks to the PR from @Den4ik making it happen.

@Den4ik
Copy link

Den4ik commented Feb 17, 2021

@ihor-sviziev interesting. I didn't work on windows 10 years, but for now I really want to check it ))

@ihor-sviziev
Copy link
Contributor Author

ihor-sviziev commented Feb 18, 2021

One interesting thing - today I had the same issue on Ubuntu 20.04, but with known hosts. After reboot - the php-fpm container was re-created and the ~/.ssh/known_hosts file was removed, so I wanted to check why that container was re-created.

I checked what was the output of warden env config before and after reboot - diff is interesting - that's IP of the traefik in the extra_hosts section:
https://github.com/davidalger/warden/blob/3cc14a24867191342564748962375a3d5d3c879b/environments/includes/php-fpm.base.yml#L9-L11

The last digit of IP was changed from 3 to 4 for some reason.
@Den4ik can we do the same thing for ssh known hosts as you did for bash history? AFAIK there might be some issues with permissions, right?

@ihor-sviziev
Copy link
Contributor Author

I created a PR for fixing similar issue with the ~/.ssh/known_hosts file. #315

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants