Building Static Site: Hugo + GCP + Namesilo

Purchase Domain Name

Domain name

namesilo is safe and cheap with various payment options(including visa, paypal, bitcoin, mastercard, Alipay and Wechat Pay), can prevent the whois info leak.

Coupon code

okoff or go2think

Configure the DNS

Change Nameservers to be the name server of Cloud DNS introduced below.

Random Thoughts

Register a domain name using Google Domains <- Sometimes your region may not be supported to use the Google Domain service to purchase domain.

Sadly, fabbit.com is purchased by someone else, so I have to buy a similar one f4bb1t.com. It’s possible that someone will register f4bbit.com or fabb1t.com to build a honeypot, who knows?

SSL with load balancer

Noted: SSL domain status: FAILED_NOT_VISIBLE Certificate provisioning failed for the domain. Either of the following might be the issue:

  • The domain’s DNS record doesn’t resolve to the IP address of the Google Cloud load balancer. To resolve this issue, update the DNS records to point to your load balancer’s IP address.

  • The SSL certificate isn’t attached to the load balancer’s target proxy. To resolve this issue, update your load balancer configuration.

Setting Up an domain using Cloud DNS

For the DNS part, I use the google cloud built-in DNS. reference (Step 4 only)

Hugo Static Site

Hugo has many different themes to choose, and the only thing needed to update content is to update the MD files, which is easy to manage.

PC:

hugo server -t [theme_name] --buildDrafts
hugo
git push origin 

Push the hugo folder to Github repo.

Server:

git pull origin
sudo cp -R public/* /var/www/html/  

/var/www/html/ for Apache2

Travis-CI?

Some CICD tool like Travis-CI, Jenkis can be applied to automate the process, but I personally think bash script is already very fast with [gcloud sdk](https://cloud.google.com/sdk/docs/quickstart#initializing_the, only requires running 2 scripts) less than 10 secs…haha.

Google Bucket? S3?

Given that Hugo is static, it can also be hosted in Github.io, or Google bucket, AWS S3 bucket, but due to some reasons, I wanna use a dedicated server for more usages.

Don’t want to build the site yourself?

Easy, email me and I can build it for you!

$300+ per static site(without domain fee + gcp service fee), if you are handsome, 10% discount is at the corner…lol