使用foreman 管理基于Procfile 的应用
foreman 是一个协议,我们可以用来方便的管理基于Procfile 文件定义的应用(测试环境会很方便,当然生产也可以使用)
我们可以用来快速的搭建一个服务的依赖系统,同时方便的进行管理,同时社区也有了多种语言的实现
几个方便的语言实现
- golang
参考地址:https://github.com/mattn/goreman - python
参考地址:https://github.com/nickstenning/honcho - nodejs
参考地址:https://github.com/strongloop/node-foreman - shell
参考地址:https://github.com/chrismytton/shoreman
一个基于goreman 部署的本地etcd 集群
- Procfile
# Use goreman to run `go get github.com/mattn/goreman` # Change the path of bin/etcd if etcd is located elsewhere etcd1: bin/etcd --name infra1 --listen-client-urls http://${IP}:2379 --advertise-client-urls http://${IP}:2379 --listen-peer-urls http://${IP}:12380 --initial-advertise-peer-urls http://${IP}:12380 --initial-cluster-token etcd-cluster-1 --initial-cluster ‘infra1=http://${IP}:12380,infra2=http://${IP}:22380,infra3=http://${IP}:32380‘ --initial-cluster-state new --enable-pprof --logger=zap --log-outputs=stderr etcd2: bin/etcd --name infra2 --listen-client-urls http://${IP}:22379 --advertise-client-urls http://${IP}:22379 --listen-peer-urls http://${IP}:22380 --initial-advertise-peer-urls http://${IP}:22380 --initial-cluster-token etcd-cluster-1 --initial-cluster ‘infra1=http://${IP}:12380,infra2=http://${IP}:22380,infra3=http://${IP}:32380‘ --initial-cluster-state new --enable-pprof --logger=zap --log-outputs=stderr etcd3: bin/etcd --name infra3 --listen-client-urls http://${IP}:32379 --advertise-client-urls http://${IP}:32379 --listen-peer-urls http://${IP}:32380 --initial-advertise-peer-urls http://${IP}:32380 --initial-cluster-token etcd-cluster-1 --initial-cluster ‘infra1=http://${IP}:12380,infra2=http://${IP}:22380,infra3=http://${IP}:32380‘ --initial-cluster-state new --enable-pprof --logger=zap --log-outputs=stderr proxy: bin/etcd grpc-proxy start --endpoints=${IP}:2379,${IP}:22379,${IP}:32379 --listen-addr=${IP}:23790 --advertise-client-url=${IP}:23790 --enable-pprof ? # A learner node can be started using Procfile.learner ?
- 环境变量
.env 文件
IP=127.0.0.1
- 启动
goreman -f Procfile start
参考资料
https://ddollar.github.io/foreman/
https://github.com/mattn/goreman
相关推荐
CurrentJ 2020-08-18
JustHaveTry 2020-07-17
Dannyvon 2020-07-13
Dannyvon 2020-07-04
###host字段指定授权使用该证书的etcd节点IP或子网列表,需要将etcd集群的3个节点都添加其中。cp etcd-v3.3.13-linux-amd64/etcd* /opt/k8s/bin/
xiunai 2020-07-04
breezegao 2020-07-02
微微一笑 2020-06-14
微微一笑 2020-06-12
CurrentJ 2020-06-06
lenchio 2020-06-04
微微一笑 2020-06-03
工作中的点点滴滴 2020-06-01
Rcvisual 2020-05-28
Dannyvon 2020-05-28
微微一笑 2020-05-26
wishli 2020-05-19
工作中的点点滴滴 2020-05-14