Build and Deploy: testing out the ways to host a Gatsby site
Published: March 06, 2020 | 3 min readOnce the first 100 Days of Gatsby Challenge was behind me, I dove right into the second challenge to learn about deploying a Gatsby site with a few different services. The two services in particular I wanted to compare were Gatsby Cloud and Netlify, considering I was already familiar with deploying sites using Zeit's Now service.
Choosing between the tools
This challenge involved getting set up with a free site hosting service. I chose to test out two services at once: Gatsby Cloud to try out hosting my 100DaysOfGatsby challenges site, and used Netlify to host my kathleenmcmahon.dev site. I wasn't sure if I needed to use a CMS for the challenges site, so skipped that step in the process.
At the time, I noticed a suggestion to upgrade to gatsby@^2.19.9
, followed the steps and discovered my project had package security vulnerabilities, 6 low and 9 high vulnerabilities. I fixed 6 of them by running npm audit fix
in the Command Line Interface (CLI). The 9 high vulnerabilities remaining had no patch available at the moment.
Aside: The Gatsby Cloud builds for my challenges site were quite nice… and this was an attraction for me:
“Gatsby Cloud can automatically deploy each site build to a CDN host of your choice—just connect and you are good to go!"
The setup to host a site using Gatsby Cloud was more straightforward than using the Zeit Now workflow that we currently use at O'Reilly Media for deploying our design system documentation. When using Zeit, we have to build a static site before deploying, and set up our config in a specific way, depending on whether we were using v1
or v2
of Now
. There definitely are some gymnastics involved with the local config files.
Personally, I haven't been a fan of the way Zeit would request read/write access to Administration to all your GitHub repositories in order to use the service as ov v2
, rather than the way Gatsby Cloud and Netlify allow you to grant scoped repository access permissions. In fact, that blanket permissions request by Zeit has long been a big barrier to entry for users who want to contribute to our design system documentation.
Zeit has been rebranded to Vercel as of late April 2020, and it looks like they may be changing how you can deploy sites with their service. I'm hoping they may consider changing that permissions model, because other than that, deploying static sites with their service is pretty sweet.
After I set up the challenges site on Gatsby Cloud, I set up hosting with Netlify for my blog site by signing up for a starter plan and creating a team. In that team, I created a unique site name, purchased a domain name for my blog site, and pointed my deployment to that URL to act as the primary domain. Really seamless process.
Things I learned:
- You can’t use the Deploy to Netlify button in your project's
README.md
if your GitHub repository is private. - You can point your Gatsby Cloud build to a URL created in your Netlify team. Nice.
That completes Challenge 2. I'm glad I made some time to pick these challenges back up, and I enjoyed testing out the different ways to deploy and host sites. It's now time to take on the 100 Days of Gatsby — Challenge 3.