fly-apps/dockerfile-rails

Change location of IRB history file

Opened this issue · 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.

rubys commented

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

No, I'm using 1.2.5

rubys commented

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?

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.