I've been taking a bit of a break from corporate America this year and thought I'd use the chance to start this blog. On a recommendation from a friend, I coded up a quick page leveraging next.js, came up with a bit of basic CSS and the time to deploy came around.
While there are a lot of static content hosting options out there, I thought I'd try Google Cloud. It has the reputation of being the cloud with the most sophisticated service offering, and I was interested in checking it out. My overall impression is that there are some nice services on the Google platform. However, it can be a bit too complicated and even 14 years later it is easy to run into beta features and unfinished services.
Since I was exploring the services on offer, I decided to check out all the services that would be relevant for a Jamstack deployment of the blog.
Why Serverless Hosting instead of Google Cloud Storage Bucket?
While the current iteration of the website consists of static content, I may be adding more dynamic features in the future. I am considering this implementation a bit of a research project. A Google Cloud Storage Bucket (the equivalent to S3) is definitely the straight forward solution here.
A few years ago, I happened to have bought the domain doich.in
on GoDaddy. I decided a
good first learning step would be to transfer it to Google Cloud. Registering a domain is fairly straight forward
with all the registrars I have used so far. Google has a service called Google Domains
and at a first glance, it seemed like what I needed. I downloaded the cloud tools CLI, followed the relevant
documentation guide and finished the process successfully. This is when I discovered that it is a little more
complicated than usual.
The Duplicate Features Problem
Google has two services that allow you to register and manage domains. Google Domains is indeed one such service. However, there is a slightly more integrated version called Cloud Domains. While Google Domains seems to work ok with Google Cloud, it is the less cloud integrated version. This being my very first interaction with Google Cloud, I felt like I had made a bad decision and picked the inferior of the two products.
As any real engineer does, after having done the thing, I went to read the relevant docs for Cloud Domains to get a better feal on what I am missing out on. This is where I came across this gem:
Apparently the die is cast on this one. Importing domains from Cloud Domains into Google Domains is supported, but the reverse is not supported. Feels bad...
What is the difference?
Cloud domains is designed around the concept of a project. The domain is associated with a project and access can be managed via the usual IAM tools. Moreover, Domain management and DNS management are split into two services in GCP, for finer grained control. Google Domains on the other hand, is build around the concept of a user and has an integrated free DNS management solution.
Which one do you really want?
As a solo dev, Google Domains is probably your best pick (especially since it comes with a free DNS). Also, while the docs didn't make it clear to me, after a while, my Google Domains registered domain did also appear in Cloud Domains and worked seamlessly with other services.
With domain name sorted out, I moved on to figuring out the hosting solution that seemed appropriate . Here I had to make another choice between three services in this space:
As the pin next to Cloud Run
indicates, I ended up going with that one. However, I did have to read a little
into the various options on offer here. Cloud Functions
seems to be the closest one to AWS Lambdas. It allows you to
run "small single purpose functions that respond to cloud events". While seemingly the lightest weight solution, I
didn't have any functions to run for my "blog" use case. On the other end of the spectrum, we have Google App Engine
which seems to be geared more toward deploying full stack applications. From the three, Cloud Run
appears
to be the newest thing on offer, and it does allow running a container as the deployable artifact. While it's
definitely overkill to run a static blog out of a container, it does have a very generous 2 million requests free
tier, so I picked that one.
Even though I am quite happy with the ease of use of Cloud Run
, it did leave a bit of a strange taste in my mouth.
It feels like its competing against other Google Cloud services, and it makes no guarantees that at some future point
there won't be a new Google Giga Scale
service (or some such) that will replace it.
Additionally, Cloud Run
does still feel like a bit of a beta product that is filling out features.
When I deployed my blog, I thought, sweet, this Manage Custom Domains
bit is exactly what I need. It literally
allows me to map a domain right from the cloud run dashboard. It even finds my domain even though I am not using the
correct cloud service! This is great!
But, once I kicked off the mapping, I got a spinner indicating that it's configuring. Makes sense, DNS record changes take a bit to propagate. And then the spinner went on for a while longer. And about 15 minutes later when I checked on it, it disappeared, with the DNS record failing to change.
After mucking about through the documentation for a bit, I noticed that this is a beta service and it doesn't work
in all regions. In fact, it just silently fails since my cloud run instance is deployed to us-east4
region, which
is not supported yet. It's not a big deal, but the lack of any guard rails during the configuration process was
quite surprising.
Even with the failed attempt at the easy domain mapping, I was feeling confident I am getting close to the end of the setup process. How hard could it be to point an A record and configure a CDN around some static content?
It turns out, far more difficult than everything so far. The process involved setting up a number of networking services:
While I didn't find anything too surprising in these configurations, I was quite surprised that the Cloud Run
service didn't have a configuration shortcut to make all of this happen in one go. It definitely seems like the
domain mapping part of the service is where they are headed, but it's really beta and it doesn't have the option for
a CDN.
Overall when it comes to this part, Google Cloud definitely felt like an extreme overkill for this use case. I just wanted a simple static website for my blog. As a first time Google Cloud user, I navigated the documentation maze and ended up with far more than what I was looking for. I will probably end up changing the setup and perhaps going with something easy and simple to configure like Cloud Flare CDN. On the plus side, almost everything that was configured ended up being free for a small site like this. The only part that costs money at the moment is the load balancer, which has a minimum fee regardless of usage.
I will probably poke around a bit more and write another blog post as I explore more service offerings.