zoukankan      html  css  js  c++  java
  • 使用foreman 管理基于Procfile 的应用

    foreman 是一个协议,我们可以用来方便的管理基于Procfile 文件定义的应用(测试环境会很方便,当然生产也可以使用)
    我们可以用来快速的搭建一个服务的依赖系统,同时方便的进行管理,同时社区也有了多种语言的实现

    几个方便的语言实现

    一个基于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

  • 相关阅读:
    重构与单元测试
    10个现代的软件过度设计错误
    连接ORACLE数据库,是否必须要安装oracle客户端
    关于区块链
    为什么K8s会成为主流?
    Devops K8s
    关于UDP协议
    OO第四单元总结
    OO第三单元总结--根据JML写代码
    面向对象电梯系列总结
  • 原文地址:https://www.cnblogs.com/rongfengliang/p/12121637.html
Copyright © 2011-2022 走看看