Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Question] How to broadcast refresh through all clients without webhook #733

Closed
regardfs opened this issue Jun 28, 2017 · 9 comments
Closed
Labels

Comments

@regardfs
Copy link

I read the note from Spring-cloud-config

the default configuration also detects filesystem changes in local git repositories (the webhook is not used in that case but as soon as you edit a config file a refresh will be broadcast).

Does this mean no dependency of spring-cloud-config-monitor and no /endpoint of /monitor, just enable and config rabbitmq info it will refresh all spring-cloud-config client?
But indeed, it would not work..
Could u guys show me an example of how to fulfill this scenario??
Thanks a lot

@regardfs regardfs changed the title [Question] [Question] broadcast refresh through all clients without webhook Jun 28, 2017
@regardfs regardfs changed the title [Question] broadcast refresh through all clients without webhook [Question] How to broadcast refresh through all clients without webhook Jun 28, 2017
@ryanjbaxter
Copy link
Contributor

Have your tried adding spring-cloud-bus and spring-cloud-monitor to the classpath? Does it work then?

@regardfs
Copy link
Author

regardfs commented Jun 28, 2017

@ryanjbaxter
hi, Sure, it works, I followed this page asimio's toturial and everything goes fine
when git push happens , clients automatically refresh by themselves.
when I saw the official site Note about absence of webhook of git, I want to use this pattern cause I have many repos for huge of projects, it is not a best practice for configure webhook on these repos.

the default configuration also detects filesystem changes in local git repositories (the webhook is not used in that case but as soon as you edit a config file a refresh will be broadcast).

@regardfs
Copy link
Author

@ryanjbaxter
Does this default configuration means removing webhook only?

@ryanjbaxter
Copy link
Contributor

So you are editing the file in your local git repo and not seeing a refresh event broadcasted?

@regardfs
Copy link
Author

regardfs commented Jun 29, 2017

@ryanjbaxter yes,so I posted a issue and question here.
Here is my configurations:

application.yml

spring:
  cloud:
    config:
      server:
        git:
          uri: http://192.168.100.22/devops/spring-cloud-configs.git
          search-paths: test1/
          username: leo
          password: 1366662Ti
    bus:
      enabled: true
      trace:
        enabled: true
  rabbitmq:
    host: localhost
    port: 5672
    username: guest
    password: guest
  profiles:
    active: config-monitor
server:
  port: 8003

bootstrap.yml

spring:
  application:
    name: configurations``


> and dependencies same as official

             <dependency>
		<groupId>org.springframework.cloud</groupId>
		<artifactId>spring-cloud-config-monitor</artifactId>
		<version>1.3.1.RELEASE</version>
	</dependency>
            <dependency>
                   <groupId>org.springframework.cloud</groupId>
                   <artifactId>spring-cloud-starter-bus-amqp</artifactId>
                   <version>1.3.1.RELEASE</version>
            </dependency>`

When config web hock as http://192.168.100.201:8003/monitor, everything goes fine, when remove hook, could not refresh.
Furthermore, you know if you have hundreds of micro services , it is not best practice to config webhook one by one, I am try to use post method when something change on local repo with cmd like

curl -v -X POST "http://localhost:8003/monitor" -H "Content-Type: application/json" -H "X-Event-Key: repo:push" -H "X-Hook-UUID: webhook-uuid" -d '{"push": {"changes": []} }'

@regardfs
Copy link
Author

@dsyer, might u cc this issue?
I have hacked spring-cloud-bus and found it use this class RefreshRemoteApplicationEvent to refresh.

@spencergibb
Copy link
Member

There is no way to broadcast refresh requests without /monitor or by triggering a manual refresh using /bus/refresh unless you code something by hand.

@regardfs
Copy link
Author

regardfs commented Jul 1, 2017

@spencergibb , Yeah I saw the code, I try to make a curl request to simulate the request to monitor like

curl -v -X POST "http://localhost:8003/monitor" -H "Content-Type: application/json" -H "X-Event-Key: repo:push" -H "X-Hook-UUID: webhook-uuid" -d '{"push": {"changes": []} }'

@regardfs
Copy link
Author

regardfs commented Jul 5, 2017

@spencergibb
I have finish this task with urlconnection and simulate the request above.
Thanks all you guys, I will close this question.

@regardfs regardfs closed this as completed Jul 5, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants