stack-labs / questions

任何关于Micro的问题都可以在Issue中创建
27 stars 6 forks source link

如何用pm2部署 micro api 网关 #73

Open zhongyuanjia opened 4 years ago

zhongyuanjia commented 4 years ago

现在的自己用micro写的微服务都是build后通过pm2部署,但是网关是通过命令行启动的,不知道怎么用pm2

zhongyuanjia commented 4 years ago

已解决,使用以下脚本去pm2 start即可

apps:
  - name: micro-gateway
    script: ./config.toml # 随意写个文件路径
    interpreter: micro
    interpreter_args: api
    instances: 1
    exec_mode: fork
    env: 
      MICRO_API_HANLDER: rpc
      MICRO_REGISTRY: etcd
zhongyuanjia commented 4 years ago

还有一种方式是

 pm2 start "micro api" --name micro-gateway