亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

使用 docker 鏡像在 Heroku 上部署 Go App + Vue.js

使用 docker 鏡像在 Heroku 上部署 Go App + Vue.js

Go
忽然笑 2023-06-05 19:31:12
我正在嘗試使用 docker 圖像在 Heroku 上部署應用程序https://github.com/valasek/timesheet 。應用程序在前端有一個 go 后端 (negroni/gorilla) 和 Vue.js/Vuetify.js,并且正在使用 PostgreSQL 持久性。我堅持部署。我不知道如何調試,如何顯示命令行輸出,什么是失敗的......以及任何幫助非常感謝。相關 Dockerfile - https://github.com/valasek/timesheet/blob/master/Dockerfile以下是我正在執行的步驟:> docker build --rm -f "Dockerfile" -t timesheet:latest .Successfully tagged timesheet:latest...> heroku container:push timesheet:latest --app timesheet-cloud...The push refers to repository [registry.heroku.com/timesheet-cloud/timesheet]...Your image has been successfully pushed. You can now release it with the 'container:release' command.> heroku container:release timesheet --app timesheet-cloudReleasing images timesheet to timesheet-cloud... done> heroku ps -a timesheet-cloudFree dyno hours quota remaining this month: 971h 8m (97%)Free dyno usage for this app: 0h 0m (0%)For more information on dyno sleeping and how to upgrade, see:https://devcenter.heroku.com/articles/dyno-sleeping
查看完整描述

2 回答

?
慕容3067478

TA貢獻1773條經驗 獲得超3個贊

這很可能會發生,因為 Heroku 沒有檢測到您的應用程序的任何端點(默認情況下綁定在端口 3000 上)。

Heroku 將您的應用程序歸為一個動態端口,并將端口值放在名為 的環境變量中$PORT

您的應用程序必須使用 Heroku 在此變量中指定的值并偵聽其上的傳入連接,因為這是 Heroku 轉發連接的地方。

您可以使用檢查應用程序上的當前環境變量heroku run printenv

(我看到你正在使用 Viper,它應該處理 env 變量。


查看完整回答
反對 回復 2023-06-05
?
楊魅力

TA貢獻1811條經驗 獲得超6個贊

  1. 在 Heroku DB 連接和 PORT 字符串應該從環境變量中讀取

  • 數據庫網址

  • 港口

更新的是文件timesheet.yaml。

  1. Axios 中的 BaseUrl 設置為 '' 因此 Axios 使用相對 API URL,這是有效的。修復在文件axiosSettings.js中。

在命令heroku run printenv返回之前:

panic:?dial?tcp?127.0.0.1:5432:?connect:?connection?refused

現在我得到:

Running?printenv?on???timesheet-cloud...?up,?run.1962?(Free)
Feb?15?16:22:34.186?[INFO]?config?file?/timesheet.yaml
Feb?15?16:22:34.197?[INFO]?connecting?to?DB?postgres://user:[email protected]:5432/dbname
Feb?15?16:22:34.246?[INFO]?connected?to?DB?postgres://user:[email protected]:5432/dbname


查看完整回答
反對 回復 2023-06-05
  • 2 回答
  • 0 關注
  • 210 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號