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

Set up Rails to work with a read-only container filesystem #58

Open
doshitan opened this issue Jan 22, 2025 · 0 comments
Open

Set up Rails to work with a read-only container filesystem #58

doshitan opened this issue Jan 22, 2025 · 0 comments

Comments

@doshitan
Copy link
Contributor

doshitan commented Jan 22, 2025

Context

As a part of the deployment instructions with the platform infra, folks are instructed to set enable_command_execution to true because when the service starts in the container, it tries to write to the container filesystem. When deployed to ECS this is not allowed (by default). The enable_command_execution happens to disable this read-only requirement in ECS as a side effect, but has other implications as well that are not appropriate for all environments.

The platform infra may get a more targeted read-only filesystem toggle, but even then, it would be nicer if the Rails template could just work more "out of the box" and not require the write access to its container system.

Implementation

Determine if such a thing is possible. Implement if so.

Seems like when Rails/puma try to right a pidfile on startup. And also possibly general temporary file handling, as by default Rails stores temporary files in a relative tmp directory. Quoting a note made elsewhere about the tmp file handling:

A few different options are available for using data volumes and we should do a little research and refer to how we solved this problem on past projects to decide on the right solution.

If we were not using Fargate, we could use tmpfs, but Fargate launch does not support tmpfs.

The easiest option, since this is just for tmp files/ephemeral, might be to use bind mounts. See https://stackoverflow.com/a/79264666 for an example.

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

No branches or pull requests

1 participant