Mix Space is a simple yet sophisticated personal blog system with good animation design, cute style, and rich functionality. It is fast, modern, and its active open-source community allows you to enjoy the stunning brought by the new technology stack.
Environment Preparation:#
Operating System: It is recommended to use the latest Ubuntu/Debian or other Linux kernel versions not less than 4.19.
Linux Kernel Version: Not less than 4.19, recommended 5.x.
Memory Recommendation: Greater than 1 GiB.
Memory Requirements:
Memory required for building: Greater than 1 GiB.
Memory required for running: Not less than 768 MiB.
Environment Used by This Site#
- Server: CentOS Linux release 7.9.2009 (Core), Kernel Version 6.0.10-1.el7.elrepo.x86_64
- Docker version 20.10.21+Docker-compose version 1.29.1
- Node.js v16.18.1, npm v8.19.2, nvm v0.39.2
If the operating system used is CentOS, the default kernel version may not meet the requirements. Please confirm whether it is necessary to upgrade the Linux kernel version before setting up.#
Environment Preparation#
Install software packages#
Debian / Ubuntu
apt update && apt install git curl vim wget git-lfs -y
CentOS
yum check-update && yum install git curl vim wget git-lfs -y
Install Docker#
SSH connect to the server and use a one-click script to conveniently install Docker and Docker Compose:
curl -fsSL https://get.docker.com | bash -s docker --mirror Aliyun
Install nvm for managing Node.js versions#
Open the terminal and use a one-click script to conveniently install nvm:
bash -c "$(curl -fsSL https://gitee.com/RubyKids/nvm-cn/raw/master/install.sh)"
Restart the terminal to take effect.
Install the latest LTS version of Node.js:
nvm install --lts
Install the required modules:
npm i -g pnpm pm2
Start Deploying Mix Space#
This site adopts manual deployment. For more deployment methods, please refer to the official documentation at https://mx-space.js.org/
Deploy Core#
Docker Deployment#
# Create a new folder
cd && mkdir -p mx-space/core && cd $_
# Fetch the docker-compose.yml file
wget https://fastly.jsdelivr.net/gh/mx-space/core@master/docker-compose.yml
# Fetch the Core configuration file
wget https://fastly.jsdelivr.net/gh/mx-space/core@master/.env.example -O .env
Edit the .env file:
# THIS ENV FILE EXAMPLE ONLY FOR DOCKER COMPOSE
# SEE https://docs.docker.com/compose/environment-variables/#the-env-file
JWT_SECRET=7294c34e0b28ad28 # Fill in a string with a length of not less than 16 characters and not more than 32 characters here
ALLOWED_ORIGINS=test.cn,www.test.cn # Fill in the allowed domain name here, usually the domain name of Kami. If multiple domain names are allowed to access, separate them with commas
You can now start the backend:
docker compose up -d
Deploy kami Mix Default Frontend#
Fetch the source files#
cd && cd mx-space
git clone https://github.com/mx-space/kami.git --depth 1
# If the cloning is slow, you can use the following mirror address
git clone https://github.1qi777.com/mx-space/kami.git --depth 1
Switch to the latest tag#
cd kami && git fetch --tags && git checkout $(git rev-list --tags --max-count=1)
Fetch the image files#
git lfs fetch --all
git lfs pull
Note: If the fetching is not successful, you can manually download the files from GitHub and place them in the corresponding directory.
Configuration file#
Copy .env.example to .env
cp .env.example .env
Edit the .env file, it should look like this:
# API URL
NEXT_PUBLIC_API_URL=https://server.test.cn/api/v2
# GATEWAY URL
NEXT_PUBLIC_GATEWAY_URL=https://server.test.cn
# Configuration item name used by the frontend
NEXT_PUBLIC_SNIPPET_NAME=kami
# If using a CDN, modify the artifact prefix; generally leave it blank
ASSETPREFIX=
Build#
Here, we use pnpm as the package manager.
# Install the required modules
pnpm i
# Build
pnpm build
Start the frontend#
pnpm prod:pm2
# Optional
pm2 start