Skip to content

Building Eureka Client and Server

karthik-vn edited this page Aug 31, 2012 · 12 revisions
  • Install the latest git and gradle packages.

  • Get the Eureka source from github

     
     git remote add --track master origin [email protected]:Netflix/eureka.git
     git pull
    
  • Eureka server has Eureka client built in and as with any other application relies on the client to be configured.

By default, the Eureka server searches for property files eureka-client.properties in the classpath. It further searches for environment specific overrides in the environment specific properties files. The environment is typically "test" or "prod" and is supplied by a "-Deureka.environment" java commandline switch to the eureka client (without the .properties suffix). Accordingly the client also searches for eureka-client-{test,prod}.properties.

Additionally, the same searching mechanism is used for Eureka Server by searching for eureka-server-{test,prod}.properties.

Navigate to eureka-server/conf/ and edit the following files to configure the eureka server. Eureka server also needs its own Eureka Client configuration as with any other application.


eureka-client.properties
eureka-client-test.properties
eureka-server.properties
eureka-server-test.properties

The Eureka configuration searches the client related property files in eureka-client.properties in the
classpath. It also searches for the environment specific properties specified by

-Deureka.environment
for different environments like test and prod.

The properties in the files explain what they are for. At the minimum the following things need to be
configured


Application Name (eureka.name)
Application Port (eureka.port)
Virtual HostName (eureka.vipAddress)
Eureka Service Urls (eureka.serviceUrls)
  • Now, build the Eureka Server by executing the following

     
      ./gradlew -I gradle/netflix-oss.gradle clean build
      

    This generates a WAR(web application archive) artifact - ./eureka-server/build/libs/eureka-server-
    -SNAPSHOT.war

  • This WAR contains all the server configurations you changed. Copy this to the your tomcat deployment directory under _$TOMCAT_HOME/webapps/ _

    
      cp ./eureka-server/build/libs/eureka-server--SNAPSHOT.war $TOMCAT_HOME/webapps/eureka.war
      
  • Start your tomcat server. Access http://localhost:/eureka to verify the information there. Your server's eureka client should register itself in 30 seconds and you should see that information there.