渲染 = 把动态数据转换成静态HTML文件的过程
VanBlog使用Next.js的 ISR(Incremental Static Regeneration 增量静态再生成) 技术:
这个博客的方法是我看数据库数据的,不懂的不要轻易使用,直接用博客系统带的备份方案,直接导出json 和 图片。
VanBlog的数据主要存储在MongoDB中,包含以下重要数据:
需要保留的数据(文章数据):
articles
- 文章内容drafts
- 草稿categories
- 分类tags
- 标签(如果有的话)customPages
- 自定义页面moments
- 动态viewers
- 浏览量统计visits
- 访问记录需要重新配置的数据(系统配置):
metas
- 站点信息(包含域名配置)users
- 用户信息settings
- 系统设置tokens
- API令牌UV 是一个由 Astral 团队开发的高性能 Python 环境管理工具,它集成了包管理、虚拟环境管理和 Python 版本管理等功能。以下是使用 UV 管理 Python 环境的主要步骤和方法:
UV 可以通过多种方式安装:
bash展开代码pip install uv
bash展开代码curl -LsSf https://astral.sh/uv/install.sh | sh
powershell展开代码irm https://astral.sh/uv/install.ps1 | iex
uv --version
验证安装。vmware 的 dns 问题 导致 git pull失败:
nslookup github.com
github.com
的 DNS 解析是否正确,确认是否返回 GitHub 的真实 IP(如 20.205.243.166
)。echo "nameserver 8.8.8.8" > /etc/resolv.conf
github.com
指向 127.0.0.1
。ssh-keygen -f "/root/.ssh/known_hosts" -R "github.com"
ssh -T git@github.com
yes
后即可正常认证。更离谱的是,有时候这个文件只是软连接,可以看看这样:
bash展开代码ls -l /etc/resolv.conf
sudo rm /etc/resolv.conf
echo "nameserver 8.8.8.8" > /etc/resolv.conf
sudo chattr +i /etc/resolv.conf # 锁定文件(防止被覆盖)
sudo systemctl stop systemd-resolved # 禁用 systemd-resolved(可选)
sudo systemctl disable systemd-resolved
在 Ubuntu 服务器上执行以下命令:
bash展开代码# 安装必要的包
sudo apt update
sudo apt install -y debian-keyring debian-archive-keyring apt-transport-https
# 添加 Caddy 官方 GPG 密钥
curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/gpg.key' | sudo gpg --dearmor -o /usr/share/keyrings/caddy-stable-archive-keyring.gpg
# 添加 Caddy 仓库
curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/debian.deb.txt' | sudo tee /etc/apt/sources.list.d/caddy-stable.list
# 安装 Caddy
sudo apt update
sudo apt install caddy
/.well-known/acme-challenge/
路径发送HTTP请求验证域名控制权清理无用镜像/容器/卷/网络
使用以下命令一键清理所有未被使用的资源(包含停止的容器、悬空镜像、未使用的网络和卷):
bash展开代码docker system prune -a --volumes
-a
:删除所有未被容器引用的镜像(不仅仅是悬空镜像)。--volumes
:删除未被使用的卷(⚠️ 确保卷中无重要数据!)。单独清理不同资源
停止的容器:
bash展开代码docker container prune
悬空镜像(未被任何容器引用):
bash展开代码docker image prune
未被使用的卷:
bash展开代码docker volume prune
构建缓存(Builder Cache):
bash展开代码docker builder prune
在 VMware 中扩容虚拟磁盘后,Linux 系统并不会自动识别新增的空间,需要手动扩展分区和文件系统。本教程以 GPT 分区表 + ext4/xfs 文件系统为例,详细介绍如何安全扩展 /dev/sda3
分区,使其占用全部可用空间。
sudo
bash展开代码echo "nameserver 8.8.8.8" > /etc/resolv.conf
看是否可以正常解析:
bash展开代码nslookup github.com
确定里面没有乱指:
bash展开代码vim /etc/hosts