我正在嘗試使用 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 變量。

楊魅力
TA貢獻1811條經驗 獲得超6個贊
在 Heroku DB 連接和 PORT 字符串應該從環境變量中讀取
數據庫網址
港口
更新的是文件timesheet.yaml。
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
- 2 回答
- 0 關注
- 210 瀏覽
添加回答
舉報
0/150
提交
取消