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

Create a bypass for hardcoded rails tmp folder #185

Closed
Tracked by #182
maxirmx opened this issue Aug 14, 2024 · 7 comments · Fixed by #203
Closed
Tracked by #182

Create a bypass for hardcoded rails tmp folder #185

maxirmx opened this issue Aug 14, 2024 · 7 comments · Fixed by #203
Assignees

Comments

@maxirmx
Copy link
Member

maxirmx commented Aug 14, 2024

Rails has hardcoded path to tmp folder as described in rails/rails#39583
If tebako is used this path is within memfs, is readonly and cannot be used for temporarily files

We either patch it tebako-runtime or implement a feature similar to docker volume.

@maxirmx maxirmx self-assigned this Aug 14, 2024
@maxirmx maxirmx changed the title Invent bypass for hardcoded rails tmp folder Create a bypass for hardcoded rails tmp folder Aug 14, 2024
@ronaldtse
Copy link
Contributor

The docker volume functionality is described here:

@maxirmx
Copy link
Member Author

maxirmx commented Aug 14, 2024

I am afraid Rails support reuires a 'real' filesystem. 'Real' here means a file system which is accessible by other processes.
For example, Rails tmp folder contains pid and restart files that shall be used to send commands/signals to tebako package or log files that would be nice to keep when tebako package terminates.

If we 'embed' OverlayFS in a way we do it with DwarFS it won't be accesiible from other processes.

So even with docker-style volumes they have to link to a filesystem that is mounted by the operating system. It can be OverlayFS, of course.

@ronaldtse
Copy link
Contributor

In this case, it can only be a directory created inside the system $TMPDIR? i.e. it is not a self-contained working directory.

@maxirmx
Copy link
Member Author

maxirmx commented Aug 14, 2024

As far as I understand Rails have 'tmp' and 'cache'
Cache may be self-contained and OverlayFS will suit perfectly
Tmp has to be 'real'. It is configurable but there are three Rails methods that ignore configuration and use hardcoded
File.join(Rails.root, "tmp") instead of config.paths["tmp"]

This issue did not exist in the ruby-packer times.

I see three possible approaches to it:

  1. The fast method is to patch rails 'on the fly' so that it honours its own configuration.
  2. The other fast method is to (optionally) support mapping of /__tebako_memfs__/tmp to system folder. In this case the user can start tebako package app with additional parameter like app --with-tebako-tmp-folder=$TMPDIR/rails
  3. The solid method is to implement generic mapping of memfs folder to system folder like docker --volume
    app --tebako-volume=tmp:$TMPDIR/rails

Methods 1,2 will take a week
Method 3 will take a month

@maxirmx
Copy link
Member Author

maxirmx commented Aug 14, 2024

There is one argument for approach 3
#154 will require similar functionality to mount a second instance of memfs

@ronaldtse
Copy link
Contributor

I agree with 3.

@maxirmx
Copy link
Member Author

maxirmx commented Aug 15, 2024

tamatebako/libdwarfs#115

@maxirmx maxirmx linked a pull request Sep 26, 2024 that will close this issue
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 a pull request may close this issue.

2 participants