Preface#
Due to my Phoenix, Arizona server being slow for both the Mix-space frontend & backend, and recently being attacked, which made matters worse, all the Tencent Cloud CDN traffic was wiped out, and I even incurred a loss of 200 large sums. Although Tencent Cloud agreed to refund later, it became quite awkward to conduct business with Tencent Cloud afterward, in case it gets wiped again...
::: gallery
:::
In the meantime, I used Cloudflare to protect the frontend & backend services, but the speed during peak hours was not ideal, and the proxy conditions were not available to all visitors;
So I plan to deploy the Mix-space frontend & backend using Serverless, but currently, the latest Shiro still requires backend and database support. For now, let's solve the frontend issue; the backend is still quite fast even with Cloudflare. This blog will guide you through the tutorial for deploying Kami on Serverless.
Serverless Providers
I tested these two Serverless providers, both of which can deploy Kami normally, and the routing for subscribing to /feed
and the sitemap /sitemap
has been updated and resolved by the Mix-space author @Innei, thank you.
Preparation#
Before this, please deploy all backend services. If you haven't deployed yet, please deploy here.
We need to Fork mx-space/kami to our own GitHub repository.
We also need to prepare static resources, such as site icons, Google-site-verification... For example, check my commit this time.
Deployment#
This article will take Vercel deployment as an example. First, you need to create a new Project, find our Forked repository, and click Import
.
In the Environment Variables section, input the API link and backend address.
NEXT_PUBLIC_API_URL https://api.miaoer.xyz/api/v2 ## API Address
NEXT_PUBLIC_GATEWAY_URL https://api.miaoer.xyz ## Gateway Address
## Please do not copy directly
Then click Deploy to successfully deploy.
Domain#
Once the deployment is complete, don't be too eager to celebrate; click Add Domain
to bind your domain, fill in your frontend domain, here using www.miaoer.xyz
as an example, input it and click Add
.
Type Name Value
CNAME www cname.vercel-dns.com.
You will need to resolve this with your DNS provider, add a record for www
, choose CNAME as the target, and fill in cname.vercel-dns.com.
to complete the resolution. After a moment, the SSL/TLS certificate will be deployed.
Enjoy~
![]((https://cdn.miaoer.xyz/notes/23-08-28/blog-23-08-28.png)
This article is synchronized and updated to xLog by Mix Space. The original link is https://www.miaoer.net/posts/blog/mx-kami-serverless