banner
miaoer

miaoer

喵二の小博客 xLog 分站
tg_channel
telegram

Mix-space kami Theme Deployment: Serverless Saves Garbage Hosting

Preface#

Because my Phoenix host in the United States is a bit slow for both front-end and back-end of Mix-space, and recently it was attacked, which can be described as adding insult to injury. All the traffic of Tencent Cloud CDN was wiped out, and I lost 200 yuan. Although Tencent Cloud agreed to refund later, it was embarrassing to continue doing business on Tencent Cloud. What if it gets wiped out again...

::: gallery
1
2
:::

In the meantime, I also used Cloudflare to protect the front-end and back-end services, but the speed during the evening peak was very unsatisfactory, and the conditions for proxying were not available to all visitors.

So I plan to deploy the front-end and back-end of Mix-space using Serverless, but it seems that the latest Shiro still needs the support of back-end and database. Let's solve the problem of the front-end for now. Even if the back-end is covered by Cloudflare, it is still very fast. This blog post will guide you through the tutorial of deploying Kami on Serverless.

Serverless service providers

Here I tested these two Serverless service providers, both of which can deploy Kami normally, and the routes for subscribing to /feed and site map /sitemap have been updated and resolved by Mix-space author @Innei, thank you.

Preparation#

Before this, please deploy all the back-end services. If you haven't deployed them yet, please deploy them.

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 out my submission this time.

Deployment#

This article takes Vercel deployment as an example. First, you need to create a new Project and find our Fork repository, then click Import.

In the Environment Variables section, enter 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

## Do not copy the example directly

Then click Deplay to complete the deployment successfully.

Domain#

After the deployment is completed, don't be too happy too soon. Click Add Domain to bind your domain name, enter your front-end domain name here, for example, www.miaoer.xyz, and click Add after entering.

Type  Name  Value
CNAME www cname.vercel-dns.com.

Then we need to go to the DNS service provider to perform the resolution. Add a record for www, select CNAME as the target, and enter cname.vercel-dns.com. to complete the resolution. Wait a moment and 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.xyz/posts/blog/mx-kami-serverless


Loading...
Ownership of this post data is guaranteed by blockchain and smart contracts to the creator alone.