# Zeabur 部署(docker, nodejs, postgresql) 環境建置分 一、資料庫建置跟 二、github 專案建置兩個階段 一、資料庫建置 === **1. 點擊建立服務**  **2. 選擇 Docker 容器映像**  **3. 輸入 posgres, 一鍵部署**  **4. 點擊檔案,可檢視系統檔案**   **5. 點擊紀錄,可檢視環境建置 log**   **6. 點擊指令,可輸入指令**   **7. posgresql 環境建置完成**  **8. 檢視環境變數,紅框變數資料將在第二階段 github 專案建置時使用**  **9. 檢視網路,網域跟連接埠將在第二階段 github 專案建置時使用**  二、github 專案建置 === **10. 點擊建立服務**  **11. 選擇 Github**  **12. 設定 Github 儲存庫**  **13. 輸入 github 密碼**  **14. Select repositories 選擇要部署的 github 專案**  **15. 回到 zeabur,選擇剛剛選取的 github 專案**  **16. 點擊部署**  **17. github 專案環境建置中**  **18. 點擊設定**  **19. 設定預算**  **20. 因為 github 專案還未設定環境變數,會顯示崩潰重試中**  **21. 回到剛剛建置的 postgresql 環境,檢視環境變數,記下紅框變數資料**  **22. 檢視網路,記下網域跟連接埠資料**  **23. 回到 github 專案環境**  **24. 檢視網路,點擊綁定 Zeabur 子網域,Zeabur 有提供免費網域,設定網域,點擊確認綁定**  **25. 網域綁定成功,之後要設定新網域,刪除舊網域重新設定新的就可以**  **26. google 第三方登入設定剛剛綁定的網域網址**  **27. Google Cloud Platform API 服務,設定 google 第三方登入 callback 網址,點擊編輯按鈕(紅框)**  **28. 設定重新導向 URI**  **29. 回到 github 環境專案環境,設定環境變數** ``` DB_DATABASE = (Zeabur postgresql 環境的 DB 名稱,變數值位置: 環境變數 => POSTGRES_DB 值) DB_ENABLE_SSL = false DB_HOST = (Zeabur postgresql 環境的網域,變數值位置: 網路=>網域) DB_PASSWORD = (Zeabur postgresql 環境的 DB 名稱,變數值位置: 環境變數 => PASSWORD 值) DB_PORT = (Zeabur postgresql 環境的網域,變數值位置: 網路=>連接埠) DB_SYNCHRONIZE = true DB_USERNAME = (Zeabur postgresql 環境的網域,變數值位置: 環境變數 => POSTGRES_USER 值) GOOGLE_CALLBACK_URL = http://butter-sugar-test.zeabur.app/api/v1/users/auth/google/callback GOOGLE_CLIENT_ID = (Google Cloud Platform API 服務憑證設定值) GOOGLE_CLIENT_SECRET = (Google Cloud Platform API 服務憑證設定值) JWT_SECRET = (自己設個亂數) LOG_LEVEL = debug SESSION_SECRET = (自己設個亂數) ```  **30. 環境變數設定完後,點擊重啟目前版本重新部署**  **31. 重新部署中**  **32. 發現 crash**  **33. 檢視 log,發現資料庫出現問題**  **34. 資料庫crash 了,回到 postgresql-tic 環境,儀錶板會顯示重新建置按鈕,點擊後,重新生成 postgresql-que 環境**  **35. 回到 github 專案,點擊重新部署**  **36. github 專案部署成功**  **37. 簡易前端測試, Open with Live Server**  **38. 點擊連結**  **39. 選擇要登入的 Email**  **40. 登入成功**  **41. Postman 測試 API - 取得學生資料**  **42. Postman 測試 API - 更新學生資料**  **43. Postman 測試 API - 更新的學生資料**  **44. Postman 測試 API - 驗證是否登入** 
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up