[{"data":1,"prerenderedAt":753},["ShallowReactive",2],{"post-\u002Fblog\u002F2026-05-18-hello-world":3,"surround-\u002Fblog\u002F2026-05-18-hello-world":746},{"_path":4,"_dir":5,"_draft":6,"_partial":6,"_locale":7,"title":8,"description":9,"date":10,"tags":11,"body":15,"_type":740,"_id":741,"_source":742,"_file":743,"_stem":744,"_extension":745},"\u002Fblog\u002F2026-05-18-hello-world","blog",false,"","Hello, World：这个站是怎么搭起来的","这个站用 Nuxt 3 静态生成，文件放在家里 NAS 的 nginx 容器里，经 Cloudflare Tunnel 对外，没有放 Vercel。记一下选型和整条部署链路。","2026-05-18",[12,13,14],"nuxt","个人站","cloudflare-tunnel",{"type":16,"children":17,"toc":734},"root",[18,26,31,38,43,176,207,337,358,363,372,409,414,429,441,446,451,459,488,525,643,688,693,698,723,728],{"type":19,"tag":20,"props":21,"children":22},"element","p",{},[23],{"type":24,"value":25},"text","工作里造过不少系统，代码、想法和踩过的坑散在各处。我一直想要一个地方把它们串起来，不为引流，也不为简历，就是给自己留一个能反复回看的归档。",{"type":19,"tag":20,"props":27,"children":28},{},[29],{"type":24,"value":30},"开博客之前，我拿一句话说服过自己：「好的工程师把项目交付掉就完了，会写作的工程师把项目变成可复利的资产。」这句不是名言，是我自己编的。",{"type":19,"tag":32,"props":33,"children":35},"h2",{"id":34},"为什么选-nuxt-3",[36],{"type":24,"value":37},"为什么选 Nuxt 3",{"type":19,"tag":20,"props":39,"children":40},{},[41],{"type":24,"value":42},"候选有三个：Astro、Next.js、Nuxt 3。我要的是静态生成（SSG）：构建的时候把每个页面提前渲染成 HTML 文件，线上只要一个能发文件的 web 服务器，不用常驻一个 Node 进程。",{"type":19,"tag":44,"props":45,"children":46},"table",{},[47,77],{"type":19,"tag":48,"props":49,"children":50},"thead",{},[51],{"type":19,"tag":52,"props":53,"children":54},"tr",{},[55,61,67,72],{"type":19,"tag":56,"props":57,"children":58},"th",{},[59],{"type":24,"value":60},"维度",{"type":19,"tag":56,"props":62,"children":64},{"align":63},"center",[65],{"type":24,"value":66},"Astro",{"type":19,"tag":56,"props":68,"children":69},{"align":63},[70],{"type":24,"value":71},"Next.js",{"type":19,"tag":56,"props":73,"children":74},{"align":63},[75],{"type":24,"value":76},"Nuxt 3",{"type":19,"tag":78,"props":79,"children":80},"tbody",{},[81,104,132,154],{"type":19,"tag":52,"props":82,"children":83},{},[84,90,95,100],{"type":19,"tag":85,"props":86,"children":87},"td",{},[88],{"type":24,"value":89},"SSG 能力",{"type":19,"tag":85,"props":91,"children":92},{"align":63},[93],{"type":24,"value":94},"强",{"type":19,"tag":85,"props":96,"children":97},{"align":63},[98],{"type":24,"value":99},"一般",{"type":19,"tag":85,"props":101,"children":102},{"align":63},[103],{"type":24,"value":94},{"type":19,"tag":52,"props":105,"children":106},{},[107,112,117,122],{"type":19,"tag":85,"props":108,"children":109},{},[110],{"type":24,"value":111},"内容生态",{"type":19,"tag":85,"props":113,"children":114},{"align":63},[115],{"type":24,"value":116},"Content Collections",{"type":19,"tag":85,"props":118,"children":119},{"align":63},[120],{"type":24,"value":121},"MDX",{"type":19,"tag":85,"props":123,"children":124},{"align":63},[125],{"type":19,"tag":126,"props":127,"children":129},"code",{"className":128},[],[130],{"type":24,"value":131},"@nuxt\u002Fcontent",{"type":19,"tag":52,"props":133,"children":134},{},[135,140,145,149],{"type":19,"tag":85,"props":136,"children":137},{},[138],{"type":24,"value":139},"与现有 Vue 项目栈一致",{"type":19,"tag":85,"props":141,"children":142},{"align":63},[143],{"type":24,"value":144},"否",{"type":19,"tag":85,"props":146,"children":147},{"align":63},[148],{"type":24,"value":144},{"type":19,"tag":85,"props":150,"children":151},{"align":63},[152],{"type":24,"value":153},"是",{"type":19,"tag":52,"props":155,"children":156},{},[157,162,167,172],{"type":19,"tag":85,"props":158,"children":159},{},[160],{"type":24,"value":161},"部署到 NAS 静态目录",{"type":19,"tag":85,"props":163,"children":164},{"align":63},[165],{"type":24,"value":166},"可以",{"type":19,"tag":85,"props":168,"children":169},{"align":63},[170],{"type":24,"value":171},"需额外适配",{"type":19,"tag":85,"props":173,"children":174},{"align":63},[175],{"type":24,"value":166},{"type":19,"tag":20,"props":177,"children":178},{},[179,181,190,192,197,199,205],{"type":24,"value":180},"最后选了 Nuxt 3，理由就三条。我平时在做的 ",{"type":19,"tag":182,"props":183,"children":187},"a",{"href":184,"rel":185},"https:\u002F\u002Fgenesis-platform.cn",[186],"nofollow",[188],{"type":24,"value":189},"Genesis",{"type":24,"value":191}," 平台，前端就是 Vue，两边用同一套东西，脑子不用来回切。",{"type":19,"tag":126,"props":193,"children":195},{"className":194},[],[196],{"type":24,"value":131},{"type":24,"value":198}," 能把 Markdown 当数据库查，博客列表页就是一句 ",{"type":19,"tag":126,"props":200,"children":202},{"className":201},[],[203],{"type":24,"value":204},"queryContent",{"type":24,"value":206},"：",{"type":19,"tag":208,"props":209,"children":213},"pre",{"className":210,"code":211,"language":212,"meta":7,"style":7},"language-ts shiki shiki-themes github-light github-dark","queryContent\u003CPost>('\u002Fblog')\n  .where({ _draft: { $ne: true } })\n  .sort({ date: -1 })\n  .find()\n","ts",[214],{"type":19,"tag":126,"props":215,"children":216},{"__ignoreMap":7},[217,255,285,319],{"type":19,"tag":218,"props":219,"children":222},"span",{"class":220,"line":221},"line",1,[223,228,234,239,244,250],{"type":19,"tag":218,"props":224,"children":226},{"style":225},"--shiki-default:#6F42C1;--shiki-dark:#B392F0",[227],{"type":24,"value":204},{"type":19,"tag":218,"props":229,"children":231},{"style":230},"--shiki-default:#24292E;--shiki-dark:#E1E4E8",[232],{"type":24,"value":233},"\u003C",{"type":19,"tag":218,"props":235,"children":236},{"style":225},[237],{"type":24,"value":238},"Post",{"type":19,"tag":218,"props":240,"children":241},{"style":230},[242],{"type":24,"value":243},">(",{"type":19,"tag":218,"props":245,"children":247},{"style":246},"--shiki-default:#032F62;--shiki-dark:#9ECBFF",[248],{"type":24,"value":249},"'\u002Fblog'",{"type":19,"tag":218,"props":251,"children":252},{"style":230},[253],{"type":24,"value":254},")\n",{"type":19,"tag":218,"props":256,"children":258},{"class":220,"line":257},2,[259,264,269,274,280],{"type":19,"tag":218,"props":260,"children":261},{"style":230},[262],{"type":24,"value":263},"  .",{"type":19,"tag":218,"props":265,"children":266},{"style":225},[267],{"type":24,"value":268},"where",{"type":19,"tag":218,"props":270,"children":271},{"style":230},[272],{"type":24,"value":273},"({ _draft: { $ne: ",{"type":19,"tag":218,"props":275,"children":277},{"style":276},"--shiki-default:#005CC5;--shiki-dark:#79B8FF",[278],{"type":24,"value":279},"true",{"type":19,"tag":218,"props":281,"children":282},{"style":230},[283],{"type":24,"value":284}," } })\n",{"type":19,"tag":218,"props":286,"children":288},{"class":220,"line":287},3,[289,293,298,303,309,314],{"type":19,"tag":218,"props":290,"children":291},{"style":230},[292],{"type":24,"value":263},{"type":19,"tag":218,"props":294,"children":295},{"style":225},[296],{"type":24,"value":297},"sort",{"type":19,"tag":218,"props":299,"children":300},{"style":230},[301],{"type":24,"value":302},"({ date: ",{"type":19,"tag":218,"props":304,"children":306},{"style":305},"--shiki-default:#D73A49;--shiki-dark:#F97583",[307],{"type":24,"value":308},"-",{"type":19,"tag":218,"props":310,"children":311},{"style":276},[312],{"type":24,"value":313},"1",{"type":19,"tag":218,"props":315,"children":316},{"style":230},[317],{"type":24,"value":318}," })\n",{"type":19,"tag":218,"props":320,"children":322},{"class":220,"line":321},4,[323,327,332],{"type":19,"tag":218,"props":324,"children":325},{"style":230},[326],{"type":24,"value":263},{"type":19,"tag":218,"props":328,"children":329},{"style":225},[330],{"type":24,"value":331},"find",{"type":19,"tag":218,"props":333,"children":334},{"style":230},[335],{"type":24,"value":336},"()\n",{"type":19,"tag":20,"props":338,"children":339},{},[340,342,348,350,356],{"type":24,"value":341},"意思是：取 ",{"type":19,"tag":126,"props":343,"children":345},{"className":344},[],[346],{"type":24,"value":347},"content\u002Fblog\u002F",{"type":24,"value":349}," 下所有文章，去掉标了草稿的，按日期倒序。还有 ",{"type":19,"tag":126,"props":351,"children":353},{"className":352},[],[354],{"type":24,"value":355},"nuxt generate",{"type":24,"value":357}," 一条命令出纯静态产物，扔进 nginx 就能用。",{"type":19,"tag":32,"props":359,"children":361},{"id":360},"一个请求怎么走到这个站",[362],{"type":24,"value":360},{"type":19,"tag":20,"props":364,"children":365},{},[366],{"type":19,"tag":367,"props":368,"children":371},"img",{"alt":369,"src":370},"这个站的访问链路：浏览器经 HTTPS 到 Cloudflare 边缘，再经 Cloudflare Tunnel（复用已有的 tunnel1）进到家里 NAS 上的 cloudflared 容器，转给 personal-site 这个 nginx:alpine 容器，它读的是挂载进来的 NAS 上 personal-site\u002Fdist 目录","\u002Fimages\u002Fblog\u002Fhello-world\u002Fdeploy-topology.svg",[],{"type":19,"tag":20,"props":373,"children":374},{},[375,377,383,385,391,393,399,401,407],{"type":24,"value":376},"站点的文件放在家里的 NAS 上。NAS 上跑着一个 ",{"type":19,"tag":126,"props":378,"children":380},{"className":379},[],[381],{"type":24,"value":382},"nginx:alpine",{"type":24,"value":384}," 容器，名字叫 ",{"type":19,"tag":126,"props":386,"children":388},{"className":387},[],[389],{"type":24,"value":390},"personal-site",{"type":24,"value":392},"，NAS 上的 ",{"type":19,"tag":126,"props":394,"children":396},{"className":395},[],[397],{"type":24,"value":398},"personal-site\u002Fdist",{"type":24,"value":400}," 目录挂到容器里的 ",{"type":19,"tag":126,"props":402,"children":404},{"className":403},[],[405],{"type":24,"value":406},"\u002Fusr\u002Fshare\u002Fnginx\u002Fhtml",{"type":24,"value":408},"，nginx 就把这个目录里的文件原样发出去。",{"type":19,"tag":20,"props":410,"children":411},{},[412],{"type":24,"value":413},"家里没有对外开端口，外面的请求是靠 Cloudflare Tunnel 进来的。它的做法是在内网跑一个 cloudflared，由它主动连到 Cloudflare，外面的请求再顺着这条连接转进来。隧道我没有新建，复用了已有的 tunnel1，只加了一条 ingress 规则：",{"type":19,"tag":208,"props":415,"children":418},{"className":416,"code":417,"language":24,"meta":7,"style":7},"language-text shiki shiki-themes github-light github-dark","resume.genesis-platform.cn → http:\u002F\u002Fpersonal-site\n",[419],{"type":19,"tag":126,"props":420,"children":421},{"__ignoreMap":7},[422],{"type":19,"tag":218,"props":423,"children":424},{"class":220,"line":221},[425],{"type":19,"tag":218,"props":426,"children":427},{},[428],{"type":24,"value":417},{"type":19,"tag":20,"props":430,"children":431},{},[432,434,439],{"type":24,"value":433},"箭头后面的 ",{"type":19,"tag":126,"props":435,"children":437},{"className":436},[],[438],{"type":24,"value":390},{"type":24,"value":440}," 就是那个 nginx 容器的名字，cloudflared 也跑在 NAS 的 Docker 里，按容器名就能找到它。",{"type":19,"tag":20,"props":442,"children":443},{},[444],{"type":24,"value":445},"整条链路里没有一行「服务器代码」。HTTPS 由 Cloudflare 边缘负责，页面被 CDN 缓存住以后，请求不会回到家里，NAS 的 CPU 占用接近 0。",{"type":19,"tag":32,"props":447,"children":449},{"id":448},"写完一篇怎么上线",[450],{"type":24,"value":448},{"type":19,"tag":20,"props":452,"children":453},{},[454],{"type":19,"tag":367,"props":455,"children":458},{"alt":456,"src":457},"发布流程：本地写 Markdown，npm run generate 生成 .output\u002Fpublic；NAS 上先把 dist 备份成 dist.bak.时间戳、只留最近 5 份，再用 tar 管道经 SSH 写入 dist，docker exec 进容器 nginx -s reload；最后 curl 公网地址看到 200 算完成","\u002Fimages\u002Fblog\u002Fhello-world\u002Fpublish-flow.svg",[],{"type":19,"tag":20,"props":460,"children":461},{},[462,464,470,472,478,480,486],{"type":24,"value":463},"本地跑 ",{"type":19,"tag":126,"props":465,"children":467},{"className":466},[],[468],{"type":24,"value":469},"npm run generate",{"type":24,"value":471},"，产物在 ",{"type":19,"tag":126,"props":473,"children":475},{"className":474},[],[476],{"type":24,"value":477},".output\u002Fpublic\u002F",{"type":24,"value":479},"，全是 HTML、CSS、JS 和图片。把它同步到 NAS 的 ",{"type":19,"tag":126,"props":481,"children":483},{"className":482},[],[484],{"type":24,"value":485},"dist\u002F",{"type":24,"value":487}," 目录，nginx 直接发新文件，Cloudflare Tunnel 照常转发，别的什么都不用动。",{"type":19,"tag":20,"props":489,"children":490},{},[491,493,499,501,507,509,515,517,523],{"type":24,"value":492},"最早的打算是 ",{"type":19,"tag":126,"props":494,"children":496},{"className":495},[],[497],{"type":24,"value":498},"pnpm generate",{"type":24,"value":500}," 加 rsync，上线当天两样都换掉了。pnpm 卡在 corepack 上：",{"type":19,"tag":126,"props":502,"children":504},{"className":503},[],[505],{"type":24,"value":506},"package.json",{"type":24,"value":508}," 里的 ",{"type":19,"tag":126,"props":510,"children":512},{"className":511},[],[513],{"type":24,"value":514},"packageManager",{"type":24,"value":516}," 字段锁了版本，corepack 拉不到对应的 pnpm，我就删了这个字段，改回 npm。rsync 是绿联 NAS 那边不让用：它的 rsync daemon 要以 root 身份切换用户，我的登录账号做不到，一直报 ",{"type":19,"tag":126,"props":518,"children":520},{"className":519},[],[521],{"type":24,"value":522},"cannot set euid as root",{"type":24,"value":524},"。最后改成本地用 tar 打包，经 SSH 管道到 NAS 上解包：",{"type":19,"tag":208,"props":526,"children":530},{"className":527,"code":528,"language":529,"meta":7,"style":7},"language-bash shiki shiki-themes github-light github-dark","tar --exclude '.DS_Store' -cf - -C .output\u002Fpublic . \\\n  | ssh \"$NAS_HOST\" \"rm -rf '$NAS_DIST'\u002F* '$NAS_DIST'\u002F.[!.]* 2>\u002Fdev\u002Fnull; tar -xf - -C '$NAS_DIST\u002F'\"\n","bash",[531],{"type":19,"tag":126,"props":532,"children":533},{"__ignoreMap":7},[534,582],{"type":19,"tag":218,"props":535,"children":536},{"class":220,"line":221},[537,542,547,552,557,562,567,572,577],{"type":19,"tag":218,"props":538,"children":539},{"style":225},[540],{"type":24,"value":541},"tar",{"type":19,"tag":218,"props":543,"children":544},{"style":276},[545],{"type":24,"value":546}," --exclude",{"type":19,"tag":218,"props":548,"children":549},{"style":246},[550],{"type":24,"value":551}," '.DS_Store'",{"type":19,"tag":218,"props":553,"children":554},{"style":276},[555],{"type":24,"value":556}," -cf",{"type":19,"tag":218,"props":558,"children":559},{"style":246},[560],{"type":24,"value":561}," -",{"type":19,"tag":218,"props":563,"children":564},{"style":276},[565],{"type":24,"value":566}," -C",{"type":19,"tag":218,"props":568,"children":569},{"style":246},[570],{"type":24,"value":571}," .output\u002Fpublic",{"type":19,"tag":218,"props":573,"children":574},{"style":246},[575],{"type":24,"value":576}," .",{"type":19,"tag":218,"props":578,"children":579},{"style":276},[580],{"type":24,"value":581}," \\\n",{"type":19,"tag":218,"props":583,"children":584},{"class":220,"line":257},[585,590,595,600,605,610,615,620,625,629,634,638],{"type":19,"tag":218,"props":586,"children":587},{"style":305},[588],{"type":24,"value":589},"  |",{"type":19,"tag":218,"props":591,"children":592},{"style":225},[593],{"type":24,"value":594}," ssh",{"type":19,"tag":218,"props":596,"children":597},{"style":246},[598],{"type":24,"value":599}," \"",{"type":19,"tag":218,"props":601,"children":602},{"style":230},[603],{"type":24,"value":604},"$NAS_HOST",{"type":19,"tag":218,"props":606,"children":607},{"style":246},[608],{"type":24,"value":609},"\"",{"type":19,"tag":218,"props":611,"children":612},{"style":246},[613],{"type":24,"value":614}," \"rm -rf '",{"type":19,"tag":218,"props":616,"children":617},{"style":230},[618],{"type":24,"value":619},"$NAS_DIST",{"type":19,"tag":218,"props":621,"children":622},{"style":246},[623],{"type":24,"value":624},"'\u002F* '",{"type":19,"tag":218,"props":626,"children":627},{"style":230},[628],{"type":24,"value":619},{"type":19,"tag":218,"props":630,"children":631},{"style":246},[632],{"type":24,"value":633},"'\u002F.[!.]* 2>\u002Fdev\u002Fnull; tar -xf - -C '",{"type":19,"tag":218,"props":635,"children":636},{"style":230},[637],{"type":24,"value":619},{"type":19,"tag":218,"props":639,"children":640},{"style":246},[641],{"type":24,"value":642},"\u002F'\"\n",{"type":19,"tag":20,"props":644,"children":645},{},[646,648,654,656,662,664,670,672,678,680,686],{"type":24,"value":647},"这些步骤都写进了仓库里的 ",{"type":19,"tag":126,"props":649,"children":651},{"className":650},[],[652],{"type":24,"value":653},"deploy.sh",{"type":24,"value":655},"：先构建，再把 NAS 上的 ",{"type":19,"tag":126,"props":657,"children":659},{"className":658},[],[660],{"type":24,"value":661},"dist",{"type":24,"value":663}," 复制一份 ",{"type":19,"tag":126,"props":665,"children":667},{"className":666},[],[668],{"type":24,"value":669},"dist.bak.时间戳",{"type":24,"value":671},"（只留最近 5 份，出问题能直接换回去），然后 tar 同步、",{"type":19,"tag":126,"props":673,"children":675},{"className":674},[],[676],{"type":24,"value":677},"docker exec personal-site nginx -s reload",{"type":24,"value":679},"，最后 curl 一下公网地址。平时发布就是一条 ",{"type":19,"tag":126,"props":681,"children":683},{"className":682},[],[684],{"type":24,"value":685},"bash deploy.sh prod up",{"type":24,"value":687},"。",{"type":19,"tag":32,"props":689,"children":691},{"id":690},"接下来想写的",[692],{"type":24,"value":690},{"type":19,"tag":20,"props":694,"children":695},{},[696],{"type":24,"value":697},"慢慢补：",{"type":19,"tag":699,"props":700,"children":701},"ul",{},[702,708,713,718],{"type":19,"tag":703,"props":704,"children":705},"li",{},[706],{"type":24,"value":707},"大数据平台从 0 到 1 的设计踩坑",{"type":19,"tag":703,"props":709,"children":710},{},[711],{"type":24,"value":712},"本地 122B 大模型双机 TP 部署的整个排错过程",{"type":19,"tag":703,"props":714,"children":715},{},[716],{"type":24,"value":717},"DolphinScheduler 与自研调度引擎的取舍",{"type":19,"tag":703,"props":719,"children":720},{},[721],{"type":24,"value":722},"Cloudflare Tunnel 在家用 NAS 上的实战配置",{"type":19,"tag":20,"props":724,"children":725},{},[726],{"type":24,"value":727},"不定时更新，写一篇是一篇。",{"type":19,"tag":729,"props":730,"children":731},"style",{},[732],{"type":24,"value":733},"html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}",{"title":7,"searchDepth":287,"depth":287,"links":735},[736,737,738,739],{"id":34,"depth":257,"text":37},{"id":360,"depth":257,"text":360},{"id":448,"depth":257,"text":448},{"id":690,"depth":257,"text":690},"markdown","content:blog:2026-05-18-hello-world.md","content","blog\u002F2026-05-18-hello-world.md","blog\u002F2026-05-18-hello-world","md",[747,750],{"_path":748,"title":749},"\u002Fblog\u002F2026-08-22-genesis-onedata-standards","数仓命名靠词根管：Genesis 的数据标准和 OneData 建模是怎么设计的",{"_path":751,"title":752},"\u002Fblog\u002F2024-05-08-data-modeling-api","数据建模 API 功能说明",1796523532956]