Preface#
Because my Phoenix, USA host for Mix-space's front-end and back-end is somewhat slow, and recently it was attacked, making matters worse, all the traffic from Tencent Cloud CDN was wiped out, and I even lost a hefty sum of 200. Although Tencent Cloud agreed to refund later, it became quite awkward to conduct business with Tencent Cloud afterward, in case it happens again...
::: gallery
:::
In the meantime, I also used Cloudflare to protect the front-end and back-end services, but the speed during peak hours was very unsatisfactory, and not all visitors had the conditions for the proxy;
So I plan to deploy the Mix-space front-end and back-end using Serverless, but currently, the latest Shiro still requires back-end and database support. For now, let's solve the front-end issue; even if the back-end is behind Cloudflare, it is still quite fast. This blog post 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. Additionally, the issue with not being able to subscribe to the /feed
site map /sitemap
routes has been updated and resolved by the Mix-space author @Innei, thank you.
Preparation#
Before this, please deploy all the back-end 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 back-end 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#
After deployment, don't be too eager to celebrate; click Add Domain
to bind your domain. Fill in your front-end domain, taking www.miaoer.xyz
as an example, and after entering it, click Add
.
Type Name Value
CNAME www cname.vercel-dns.com.
You will need to resolve this with your DNS provider by adding a record for www
, selecting CNAME as the target, and filling 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