官术网_书友最值得收藏!

Running applications locally

How often have we faced issues in the production environment that fail to reproduce in the development environment? Hence, it is critical that when developing and debugging an application, the code in a local development environment is executed in the same manner as the remote environment. This ensures that any differences between the two environments and bugs that hard to find are intercepted before deploying the code to production.

In a local development environment, you can run a small-scale version of your application by launching one process for each of the two process types: web and worker.

Foreman is a command-line tool used to run Procfile-based applications locally. It is installed automatically by the Heroku toolbelt (Heroku client package), and is also available as a gem.

If you don't have foreman installed, use the gem install foreman command to install it from the prompt.

Starting foreman is easy as shown in the following screenshot:

Running applications locally

Since the Procfile has both web and worker processes, foreman will start one of each process type with the output interleaved on your terminal. Your web process uses port 5000, because this is what foreman provides as a default in the $PORT environment variable. The web process must use this value, since it is used by the Heroku platform on deployment as well. You can test the application now. Press Ctrl + C to send a signal to close down the application when it is done.

主站蜘蛛池模板: 仁怀市| 丹寨县| 高邮市| 平顶山市| 余庆县| 蓬溪县| 荥阳市| 旌德县| 喀喇| 津南区| 菏泽市| 上杭县| 张家口市| 陕西省| 调兵山市| 大渡口区| 闵行区| 清水县| 类乌齐县| 安庆市| 攀枝花市| 崇明县| 电白县| 敦煌市| 丰镇市| 揭西县| 鲜城| 杨浦区| 苏尼特右旗| 江安县| 南丹县| 鱼台县| 牟定县| 丰城市| 莲花县| 肥乡县| 沈阳市| 磐安县| 绥化市| 安国市| 梧州市|