通过webhook 向 bus项目,推送跟配置更新
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-bus-amqp</artifactId>
</dependency>
version: '2'
services:
rabbitmq:
container_name: rabbitmq-server
image: 'rabbitmq:management'
environment:
- RABBITMQ_DEFAULT_USER=guest
- RABBITMQ_DEFAULT_PASS=guest
ports:
- "5672:5672"
- "15672:15672"
$ docker-compose up
spring.cloud.bus.enabled=true
spring.cloud.bus.refresh.enabled=true
spring.rabbitmq.host=localhost
spring.rabbitmq.port=5672
spring.rabbitmq.username=guest
spring.rabbitmq.password=guest
# step 1: 安装必要的一些系统工具
sudo apt-get update
sudo apt-get -y install apt-transport-https ca-certificates curl software-properties-common
# step 2: 安装GPG证书
curl -fsSL http://mirrors.aliyun.com/docker-ce/linux/ubuntu/gpg | sudo apt-key add -
# Step 3: 写入软件源信息
sudo add-apt-repository "deb [arch=amd64] http://mirrors.aliyun.com/docker-ce/linux/ubuntu $(lsb_release -cs) stable"
# Step 4: 更新并安装 Docker-CE
sudo apt-get -y update
sudo apt-get -y install docker-ce
sudo gpasswd -a ${USER} docker
退出当前登录,再次登录
服务器global ip: 47.103.128.15 放开 8888, 8181 端口
在 https://github.com/thefirstwind/springcloud-series-config-repo 项目中的webhook中添加 http://47.103.128.159:8888/monitor
修改 springcloud-series-config-repo 中的 catalogservice.properties 然后 push
2020-09-21 22:15:05.022 INFO 17580 --- [nio-8888-exec-7] s.c.a.AnnotationConfigApplicationContext : Closing org.springframework.context.annotation.AnnotationConfigApplicationContext@10c00739: startup date [Mon Sep 21 22:15:04 CST 2020]; root of context hierarchy
2020-09-21 22:15:05.177 INFO 17580 --- [nio-8888-exec-7] o.s.cloud.bus.event.RefreshListener : Received remote refresh request. Keys refreshed []
http://47.103.128.159:8181/properties
{"datasource":{"driverClassName":"com.mysql.jdbc.Driver","url":"jdbc:mysql://localhost:3306/catalog","username":"root","password":"dev@990990"},"name":"kei6"}