Leon's Blogging

Coding blogging for hackers.

用 Foreman 管理進程

| Comments

若專案需要啟動多個 process,可以用 foreman 來管理它們。

設定

在根目錄底下新增 Procfile 檔案

設定所有要跑的指令

1
2
3
4
5
#Procfile
web:    bundle exec rails s -p $PORT
worker: bundle exec rake worker
urgentworker: bundle exec rake urgent_worker
scheduler:  bundle exec rake scheduler

安裝gem foreman

1
gem install foreman
1
2
3
4
5
foreman start
13:44:20 web.1          | started with pid 82891
13:44:20 worker.1       | started with pid 82892
13:44:20 urgentworker.1 | started with pid 82893
13:44:20 scheduler.1    | started with pid 82894

gem:

參考文件:

Comments