Set project root to child directory

Hi there, I am currently setting up my first Render site and I am having troubles with one aspect of the setup. The website is a headless Gatsby site with a Sanity CMS where both projects exist as two subdirectories of the root.

I want to specify for Render to use the web/ directory inside the root as the root for the website. Is there a way to accomplish this?

I am using a web service and not a static site.

Thanks

You can’t change the project root, but you can cd into a child directory before running your build and start commands. Let me know and I’ll be happy to help you debug any issues you see with this approach.

Based on the setup you describe you may want to use a static site for the Gatsby project and a separate web service for the CMS. With static sites, you specify a Publish Directory, which becomes the root of your website. See our Gatsby deployment guide for more on how this works.

Hi david, thanks for the reply.

The primary reason I am using a web service rather than a static site is because I am trying to be able to run my gatsby site in watch mode hosted on a server. I want it to be able to update as a preview for changes maybe in Sanity. Does this sound like a possibility to you?

Hi @ShaeSco, I’m not very familiar with Sanity and assumed wrongly that it was an open source project. Based on GitHub - sanity-io/gatsby-source-sanity: Gatsby source plugin for building websites using Sanity.io as a backend., it seems like watch mode is a Sanity-specific feature meant for development. While it’s possible to use this setup in production, it’s probably not a good idea. Your site will be slower and less secure, as explained here: Downsides to using "gatsby develop" in production? · Issue #19670 · gatsbyjs/gatsby · GitHub.