Rails: disk needed during deploy or after server starts

Hi all,

I am using Shrine gem in our application which needs to initialize with default storage path.

As I understand, Disk is not available during deploy process on Render. And so I tried to avoid it by wrapping code with if defined?(Rails::Server) which should ensure, that the code is run only when server is up. Unfortunately this always returns false on Render.

Is there any way to initialize Shrine only when the server is up?

UPDATE: I have actually just been successful by putting the init code to puma.rb, which is kinda weird, but at least it works.

You can write your own Bash script and use it as a build command.
In that script, you could set an env var (like “DEPLOYING=true”) at the very beginning (and unset it at the end) and then check for that (if ENV["DEPLOYING"]) to determine if a deploy is going on.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.