Shirone's Blog

Moving!

I used to deploy my blog with cloudflare wrangler. It is a service works with cloudflare worker and can easily deploy your static website. Cloudflare just release wrangler but the docs are really hard to understand and as it is really complicate to migrate my website from wrangler1 to wrangler2, and as some ip address from cloudflare are banned in China, the connection might be blocked. So I finally decided to move my website to other platforms.

At first, I’m planning to deploy my website back to my own cloud server. But since serverless frameworks such as Github pages, Amazon lambda or cloudflare workers has many benefits. Such as easy to use, less maintenance and better integration (such as CDN services). Most of them are cheap and even free so I’m really reluctant about my leaving. After doing some research, I finally decided to use Azure Static Web Apps to deploy my site as it provides free tier for education subscription.

And what we need to do is really easy. Just create a new static web app on your azure account, and connect it with your github repo.

Azure Static Web Apps

Select your github repo and branch, and then you can choose your build command and output directory. As we are using Hugo to build our website, we can just use the hugo building preset.

Azure Static Web Apps With Hugo Preset

Then you can deploy your website with just one click. Azure will automatically setup the CI/CD workflow with github actions. After that you want you update your blog you can just push your code to your github repo and it will be deployed automatically.

Azure Static Web Apps Deploy

The only thing you need to do is to setup your DNS. Azure will provide you a domain name for your website, but you can also use your own domain name. You just need to add a CNAME record to your DNS provider and point it to the domain name provided by Azure. Since I’m using cloudflare to manage my DNS, I need to first validate the domain on azure, then add a CNAME record to the link of this static web app created by azure.

Azure Static Web Apps DNS