Is it possible to run release_command with a different image? Or Increase release_command machine memory size?

Hi!
As the title says, I am trying to look for a way to run release_command in a different image than the deploying image.

In Dockerfile, I am building a node project, and eventually output the server files without node_modules.
But I also want to run database migration in release_command, which requires node_modules exist.
I have tried installing dependencies when running release_command, but it ended up with running out of memory and can’t deploy.
So I am thinking if I can build an image with node_modules installed specifically for migration, and build another image without node_modules for deploy.

I also couldn’t find a way to increase the memory of the release_command machine (so I can install during release_command).

Is there any solution to this?
Thanks!

Hi… There isn’t a way to do exactly that, as far as I know, but you can get pretty close with a custom ephemeral machine (one of the Fly.io platform’s best features, :black_cat:)…

Since it sounds like you may already have a plan for building the different images and then pushing them each to the registry, the remaining steps would go roughly along the following lines:

$ fly console --vm-memory 8096 -C bin/migrate \
  --image registry.fly.io/releaser-image:01HABC
$ fly deploy --image registry.fly.io/normal-image:01HZYX

(Note that this lacks the usual ssh before the console subcommand, and the -C is whatever your release_command used to be.)

This isn’t as convenient as having everything in one step, but I think it’s the closest you’d be able to get, at present.

Hope this helps a little!


As a small aside, the answer to this part was added to the docs relatively recently:

[deploy] release_command = "bin/rails db:prepare" [deploy.release_command_vm] size = "performance-1x" memory = "8gb"
1 Like

I have tried [deploy.release_command_vm] as the docs suggested before creating this question, but it didn’t work.

That is really an acceptable way.
Thanks a lot!

1 Like

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