caxai
1.0.0
微服务GenUI架构的实现。当前的微服务有:
您可以在本地计算机或 docker 上设置和运行该项目。首先让我们设置环境变量。
在 auth-server Rename .env.example to .env and add DB_URL, TEST_DB_URL, SECRET_KEY
在 todo-server 中添加 DB_URL 和 TEST_DB_URL。它们可以与上面相同或不同
对于 nextjs-client 运行 pnpm install - 无需更新它们
在终端中打开根目录即:cax 并运行
make auth
并访问http://localhost:8080/api/docs
make todo
并访问http://localhost:8000/api/docs
make next
并访问http://localhost:3000
将 root .env.example 重命名为 .env 并添加缺少的环境变量(DB_URL=、TEST_DB_URL=、SECRET_KEY=)
运行: docker compose -d up
我们将把 FastAPI 微服务部署到 Google Cloud Run,将 NextJS CUI 部署到 Vercel。
确保您已安装 gcloud 和 vercel cli 并经过身份验证
认证服务器
cd auth-server
gcloud run deploy auth-server --source . --port 8080 --env-vars-file .env.gcp.yaml --allow-unauthenticated --region us-central1 --min-instances 1
cd todo-server
gcloud run deploy todo-micro-server --source . --port 8000 --env-vars-file .env.gcp.yaml --allow-unauthenticated --region us-central1 --min-instances 1
cd nextjs-client
vercel link
然后访问 vercel 并将所有环境变量添加到您的项目中并在终端运行中:
vercel --prod