Use Netlify features while hosting on a different server

I suspect this is quite the long shot, but I figured I would throw it out there and see what I could find.

The company I contract for has been making WordPress sites for clients for a very long time. As a developer I like staying on the bleeding-edge of technology and I’m always looking for ways to make my workflow more pleasant and get a better end result. To that end, I’ve been reading a lot about Gatsby and I’ve been itching to try it out on a new project.

Running a Gatsby-generated front-end with a WordPress back-end seems like a great way to be able to use modern, clean, and intuitive code to build a site fast, without rocking the boat too much by suggesting a huge switch to a completely different platform or paradigm. Our editors and clients can stick with the CMS they know and are comfortable with, I can enjoy all the luxuries of React, and the end-users get a site that loads and responds lightning fast since everything is pre-generated static markup. Everybody wins!

The sticking point is that asking our clients to sign up for two different hosting services, and having to mess with DNS configuration, is a dealbreaker. Most of these clients come to us with a domain name already pointing to a cheap shared hosting plan on a Linux/PHP server, they give us FTP/database credentials, and we deploy from our own staging server when the site is approved. The ideal way for me to give this Gatsby thing a shot would be to have WordPress installed in a subdirectory on their server, with the Gatsby-generated files in the root, and — here’s where Netlify comes in — some way to automatically rebuild the static site whenever the WordPress is updated. I’ve read that Netlify can handle automatic rebuilding and deployment by responding to a webhook, but I really don’t want to have to host the front-end of the site on Netlify’s servers and the back-end somewhere else.

Is there any way to do what I’m trying to achieve here? I’d be fine with having a mirror of the front-end files on Netlify with some sort of script or function that automatically FTPs any changed files to the client’s production server on build — would that be a possibility? Or is there another solution that I’m not thinking of?

Hosting a single site, or in this case many single sites, using two providers is not possible. Your clients would have to be willing to switch to Netlify, which I think would be a fairly easy sell when they realize the benefits. And of course, when they take notice of the increased efficiency on your end. It would be best to speak with a Netlify rep, however.

Hi,

Looks like your ideal solution would be to run wordpress and gatsby by the same hosting company, but Netlify can’t do that at the moment.

The only real option is to change the DNS configuration, but this should be really an issue to us, developers, not for your clients. You could definitely try and run a demo project in netlify without any DNS changes and you can demonstrate to your clients (or to your employers) the clear benefits of having static site hosted on Netlify.

There’s a multitude of things you can do with the CMS side as well:

You can have a gatsby project using the gastby-source-wordpress plugin which can directly query the the wordpress content using Wordpress’s Rest API. You can do this directly from the Netlify Build Environment, but you have to make sure the build process is not taking more then 15 mins.
For bigger sites, when it’s more time and resources needed to build the site i would recommend to either subscribe to Pro tier on Netlify or have a server which does the build step.

A very convenient way would be to solve this issue if there would be a wordpress plugin which can be installed in any WP instance and that would allow to trigger a gatsby build locally directly from the Wordpress CMS and once the build is finished it could deploy right away to Netlify.
I don’t think such a thing exists (let me know if you do find something like this), maybe you can raise a Github issue on Gastby Repo.

hi all! I am moving this to #topics:opentalk as this is a bit more of a free form discussion than actual support question. If people have specific requests though, I recommend going over to Feature requests - what do you already love, what could be better?

and posting a feature request :slight_smile: