akondas/symfony-consul-bundle

自动注册 Symfony 应用到 Consul

安装次数: 16

依赖者: 0

建议者: 0

安全: 0

星星: 10

关注者: 3

分支: 1

公开问题: 0

类型:symfony-bundle

0.2.0 2022-10-01 13:29 UTC

This package is auto-updated.

Last update: 2024-08-29 05:30:50 UTC


README

Consul 中注册和注销您的 Symfony 应用程序

Consul Service

1. 安装

composer require akondas/symfony-consul-bundle

2. 配置

在 Symfony 中启用此包,将以下行添加到您的 bundles.php 文件中

Akondas\ConsulBundle\ConsulBundle::class => ['all' => true]

添加路由

consul_bundle:
  resource: '@ConsulBundle/Resources/config/routing.yml'

配置参考

consul:
  service:
    name: 'subscription-service' # name of your app
    host: 'localhost' # host of your application under which it is available
    port: 8000 # port of your application under which it is available 
  client:
    base_uri: http://127.0.0.1:8500 # consule server uri

3. 使用

可用命令

  • bin/console consul:register - 在 Consul 中注册应用程序
  • bin/console consul:deregister - 从 Consul 注销应用程序
  • bin/console debug:consul-check - 调试 Consul 检查