Deploy from subfolder

I have a repo containing two projects - one “main” project at the root, and another in a subfolder. I’d like to be able to deploy just the project in the subfolder. I’ve read the responses in this thread - Deploy a GitHub sub directory - and know that I can cd into the subfolder for my bulid command. However, both the “root” project and the subfolder project use Ruby, but they currently use different Ruby versions. When I try to deploy the subfolder project, the build auto-detects the Ruby version in the root (and also runs bundle install with the root Gemfile). Can I override the Ruby version to use in the subproject? Is there a Ruby version manager (like rbenv or rvm) available to run from a build script?

That’s an interesting question - I took a look at what goes on behind the scenes and there’s an undocumented DEFAULT_RUBY_VERSION that is set and then used to specify the Ruby version - so if you were to set that you can lock the version of Ruby you want, I created an example repo at render-multi-ruby-example/render.yaml at master · johnbeynonorg/render-multi-ruby-example · GitHub which demonstrates this

EDIT: Ah, but setting it up with an app in the root and then a second in a path the detected version of Ruby (via the .ruby-version) will override the environment variable so this solution I put forward would only work if the apps are both in separate sub-folders and there’s nothing in the root path to detect.

John B

Thanks for the reply. We have the “main” app in the root, and a secondary one (that I want to deploy on Render) in a subfolder, so I guess that means that there is no solution for us right now, given that we have different Ruby versions? Or is there a way to run some manual command to force a specific version?

Yes, having the main app in the root means the app in the subfolder would get the same version as the one in the root. The DEFAULT_RUBY_VERSION environment variable isn’t used if there’s a .ruby-version in the path so there isn’t a way to change the behaviour, aside from moving your root folder into a subdirectory - this is also more typical to monorepo support across other providers too.

John B