dockerfile-rails icon indicating copy to clipboard operation
dockerfile-rails copied to clipboard

Change location of IRB history file

Open olbrich opened this issue 1 year ago • 4 comments

If you connect to a docker container and run rails console, IRB will attempt to record a history file in /rails/.irb_history, but this location is not writeable.

Perhaps configuring IRB to record this to /rails/log/irb_history.log would be preferable. Users can already do this manually by including a .irbrc file in the root of their project, so it may be helpful to create a default one if that file does not exist.

olbrich avatar Mar 13 '23 20:03 olbrich

I'm assuming that you are running off of main as that hasn't been released?

Not documented very well, but --sudo will make the whole /rails tree owned by rails

rubys avatar Mar 13 '23 21:03 rubys

No, I'm using 1.2.5

olbrich avatar Mar 14 '23 13:03 olbrich

It looks like the following does not give ownership over /rails, just the files in that directory:

COPY --from=build --chown=rails:rails /rails /rails

I'm leaning towards adding an option that does a touch .irb_history and ensures that it is owned by the rails user. This way I won't have to worry about applications that have an existing .irbrc file. Thoughts?

rubys avatar Mar 14 '23 19:03 rubys

That would probably work. I'm also thinking that people are likely to mount volumes for the logs directory so they can persist or otherwise retain them. Moving the .irb_history file into that directory would allow that history to be persisted as well (which might be useful for security audits or just convenience). But maybe that's something that could just be documented.

olbrich avatar Mar 14 '23 21:03 olbrich