These are chat archives for spring-cloud/spring-cloud

20th
Apr 2016
sawa05
@sawa05
Apr 20 2016 05:37
hello
i am new here, i would like to know if you guys talk about policies on VM placement and security?
Piotr Lewandowski
@navaro1
Apr 20 2016 07:41
I have question - I am using spring-cloud-consul
and I would like to set IP address of my service - to be precise in ConsulLifecycle method register have address set to null and I'd like to set value there
NewService class has the variable of address that I am interested in
is there any way I can set the address there via configuration (or any other way?)
Spencer Gibb
@spencergibb
Apr 20 2016 07:47
Have you tried spring.cloud.consul.discovery.hostname?
Piotr Lewandowski
@navaro1
Apr 20 2016 07:47
no, let me check :)
unforunatelly still null
Spencer Gibb
@spencergibb
Apr 20 2016 07:50
where are you setting spring.cloud.consul.discovery.hostname? What consul artifacts (gradle/mvn) are you using?
Piotr Lewandowski
@navaro1
Apr 20 2016 07:50
2016-04-20 09:50:19,253 INFO k.cloud.consul.discovery.ConsulLifecycle: 129 - Registering service with consul: NewService{id='contact-profile-service-8888', name='contact-profile-service', tags=[], address='null', port=8888, check=Check{script='null', interval=10s, ttl=null, http=http://153.65.206.178:8888}}
this is the debug info
with my very nice IP, lol
in boostrap yml
i am using mvn
   <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-starter-consul-all</artifactId>
            <version>1.0.0.M2</version>
        </dependency>
and NewService{id='contact-profile-service-8888', name='contact-profile-service', tags=[], address='null', port=8888, check=Check{script='null', interval=10s, ttl=null, http=http://xxxxxx:8888}} <- here I'd like to set address value to something
Dave Syer
@dsyer
Apr 20 2016 07:52
Any reason you are using M2 (it's very old)?
Spencer Gibb
@spencergibb
Apr 20 2016 07:52
you should use the most recent version, that’s very old 1.0.0.RC2
:smile:
Piotr Lewandowski
@navaro1
Apr 20 2016 07:53
hmm
I do not have any good reason
I'll try this way :)
Piotr Lewandowski
@navaro1
Apr 20 2016 08:00
now I get Caused by: java.lang.IllegalArgumentException: @ConditionalOnMissingBean annotations must specify at least one bean (type, name or annotation)
when trying to start my application
Spencer Gibb
@spencergibb
Apr 20 2016 08:01
Are you importing the spring-cloud-dependencies BOM?
Piotr Lewandowski
@navaro1
Apr 20 2016 08:01
what is BOM?
  <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
            <exclusions>
                <exclusion>
                    <groupId>org.springframework.boot</groupId>
                    <artifactId>spring-boot-starter-logging</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-actuator</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-security</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-starter-consul-all</artifactId>
            <version>1.0.0.RC2</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-starter-config</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-commons</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.httpcomponents</groupId>
            <artifactId>httpcore</artifactId>
            <version>4.4.4</version>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>jcl-over-slf4j</artifactId>
        </dependency>
        <dependency>
            <groupId>ch.qos.logback</groupId>
            <artifactId>logback-classic</artifactId>
        </dependency>
        <dependency>
            <groupId>net.logstash.logback</groupId>
            <artifactId>logstash-logback-encoder</artifactId>
            <version>4.5.1</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.easytesting</groupId>
            <artifactId>fest-assert</artifactId>
            <version>1.4</version>
            <scope>test</scope>
        </dependency>
    </dependencies>
this are my dependencies
<dependencyManagement>
    <dependencies>
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-dependencies</artifactId>
            <version>Brixton.RC2</version>
            <type>pom</type>
            <scope>import</scope>
        </dependency>
    </dependencies>
</dependencyManagement>
Piotr Lewandowski
@navaro1
Apr 20 2016 08:06
okay, adding this
Exception in thread "main" java.lang.NoSuchMethodError: org.springframework.core.ResolvableType.forInstance(Ljava/lang/Object;)Lorg/springframework/core/ResolvableType;
thank you for so much of your help!
Spencer Gibb
@spencergibb
Apr 20 2016 08:08
You have mixed versions of spring
what version of boot are you using?
Piotr Lewandowski
@navaro1
Apr 20 2016 08:09
okay
and which should I be?
1.2.8.RELEASE I believe
Piotr Lewandowski
@navaro1
Apr 20 2016 08:16
and I think it's dictated by his
<parent>
        <groupId>org.springframework.cloud</groupId>
        <artifactId>spring-cloud-starter-parent</artifactId>
        <version>Angel.SR6</version>
    </parent>
Spencer Gibb
@spencergibb
Apr 20 2016 08:16
you shouldn’t use that anymore
Piotr Lewandowski
@navaro1
Apr 20 2016 08:17
okay
Spencer Gibb
@spencergibb
Apr 20 2016 08:17
that should be the boot parent now
the pom import I showed above replaces that.
Piotr Lewandowski
@navaro1
Apr 20 2016 08:19
okay
thank you
Spencer Gibb
@spencergibb
Apr 20 2016 08:21
check out http://start.spring.io It will give you the current best practice for configuring dependencies.
Piotr Lewandowski
@navaro1
Apr 20 2016 08:25
thanks a lot :)
will refactor my pom and try again
@spencergibb : works like a charm! thank you!
Spencer Gibb
@spencergibb
Apr 20 2016 08:28
NP, glad to help.
Dave Syer
@dsyer
Apr 20 2016 08:53
I updated the http://projects.spring.io/spring-cloud/ page to show start.spring.io style BOM usage
Spencer Gibb
@spencergibb
Apr 20 2016 08:53
nice
it’s hard on the project pages because they don’t have the release train version
Dave Syer
@dsyer
Apr 20 2016 08:54
Yes. We'd have to do some scripting.
I had to do some scripting to get that cloud.spring.io change
Spencer Gibb
@spencergibb
Apr 20 2016 08:54
but they should say the same thing
ok
Dave Syer
@dsyer
Apr 20 2016 08:54
so it's only a bit more work
Spencer Gibb
@spencergibb
Apr 20 2016 08:59
I see, we would have to map 1.0.x -> Angel and 1.1.x -> Brixton
Niklas Herder
@herder
Apr 20 2016 09:09
Hi, I was just wondering abt the reasons that setting management.port=0 makes the Eureka client fail to register the chosen port, when server.port=0 seems to work fine with Eureka? I saw here spring-cloud/spring-cloud-netflix@1129872 that it's not possible to register the correct port since we don't know it when the instance config is created, but would it be possible to update it via some ApplicationEvent when the management port is updated?
Spencer Gibb
@spencergibb
Apr 20 2016 09:10
@herder it’s one of the most difficult things we have tried to do. Theoretically it should be possible. In reality, it’s been difficult.
Jose Armesto
@fiunchinho
Apr 20 2016 10:45
hey! I want to configure my eureka client to use a DNS based lookup to discovery the eureka servers. This DNS is a TXT record with addresses for the servers like shown here https://github.com/Netflix/eureka/blob/master/eureka-server/src/main/resources/eureka-client.properties#L76
should I use this?
eureka:
  client:
      shouldUseDns: true
      eurekaServer:
        domainName: mydns.com
I can’t find any docs with spring using this
Niklas Herder
@herder
Apr 20 2016 11:25
Yeah, I imagined that I don't have the whole picture here, @spencergibb ... :) It would be really nice to not have to bother with collisions of the management port when running multiple instances locally, but if it's that difficult it's maybe not worth it.
Is there somewhere special I should start looking if I want to take a stab at it?
@fiunchinho : This works for me:
eureka:
  client:
    registerWithEureka: true
    fetchRegistry: true
    useDnsForFetchingServiceUrls: true
    eurekaServerDNSName: eureka.local.net
    eurekaServerPort: 8761
    eurekaServerURLContext: eureka
    region: eu-central-1
The properties are slightly different in Spring Cloud
Jose Armesto
@fiunchinho
Apr 20 2016 11:27
oh awesome, I’ll try that
any docs that I can reference?
Niklas Herder
@herder
Apr 20 2016 11:30
I just checked the code instead :)
EurekaClientConfigBean, specifically
Jose Armesto
@fiunchinho
Apr 20 2016 11:55
thanks
Bryan
@bla204
Apr 20 2016 17:56
Hi All. I have been trying to figure this out for a while. When deploying a set of services using spring-cloud-consul from within a set of docker swarm nodes there doesn't seem to be an easy way of having a given service find its local consul. What I have working now is they all try and find one particular consul on the overlay network, but if that one ever goes down no more would be able to register until it was back and it also seems consul stops checking the service health, though the discovery client still seems happy.
Bryan
@bla204
Apr 20 2016 18:13
Slight correction it appears the discovery client simply remembers the last results as even after having killed all the consul instances off it continues to function.
So is the appropriate setup in docker swarm to run a consul agent node on each machine and compose to somehow use the hosts environment to set the correct host at startup or would we expect to start a new consul agent every time we launch a new container?