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

Persist bash history for console between containers #627

Open
kierenevans opened this issue Oct 12, 2021 · 5 comments · May be fixed by #635
Open

Persist bash history for console between containers #627

kierenevans opened this issue Oct 12, 2021 · 5 comments · May be fixed by #635
Labels
enhancement New feature or request

Comments

@kierenevans
Copy link
Contributor

kierenevans commented Oct 12, 2021

To improve the developer experience for harness upgrades, store /home/build/.bash_history on a named volume, allowing history of commands to persist between console containers for a project

Our current named volumes are here - https://github.com/inviqa/harness-base-php/blob/1.2.x/src/_base/docker-compose.yml.twig#L24-L40 - and the console container can reference them here - https://github.com/inviqa/harness-base-php/blob/1.2.x/src/_base/_twig/docker-compose.yml/service/console.yml.twig#L13-L17

@kierenevans kierenevans added the enhancement New feature or request label Oct 12, 2021
@kierenevans kierenevans linked a pull request Nov 10, 2021 that will close this issue
@NoDiskInDriveA
Copy link
Contributor

@kierenevans I gave it a little try and came up with this https://github.com/inviqa/harness-base-php/tree/feature/persistent-console-history - the way it's set up, it's the same history for all users, but that might actually be helpful 😅

@kierenevans
Copy link
Contributor Author

@NoDiskInDriveA That's a clever solution, though it might need a bit more attention on linux as the volume is owned by root so will need it's permissions fixing for the build user to be able to write to it:

build@3c66e3277784:/app$ ls -la /home/build/.console/
total 0
drwxr-xr-x 2 root  root    6 Mar  7 08:40 .
drwxr-xr-x 1 build build 178 Mar  7 08:40 ..

build@3c66e3277784:/app$ mount | grep console
/dev/nvme0n1p3 on /home/build/.console type xfs (rw,relatime,attr2,inode64,logbufs=8,logbsize=32k,noquota)

Different users (other than root) probably can't write to it either once permissions are fixed, unless it were to be a 777 file?
Perhaps it can be a file per user account that we'd want to persist?

@NoDiskInDriveA
Copy link
Contributor

@kierenevans Damn, and here I was, using MacOS and thinking I was smart...I have zero experience how Docker behaves on Linux. I just know file permissions on shares are a PITA 😬

@NoDiskInDriveA
Copy link
Contributor

@kierenevans Though, couldn't we use an existing mount? Point HISTFILE into /app somewhere?

@NoDiskInDriveA
Copy link
Contributor

NoDiskInDriveA commented Mar 7, 2024

Like so? Since it's about dev experience, we could tie it to the "ws console" command instead of having to deal with multiple users.
inviqa/harness-docker@0.4.x...feature/persistent-bash-history-for-console

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.

2 participants