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