Permalink
Browse files

More initial configuration files for Sample Eureka service and client.

  • Loading branch information...
1 parent 5393945 commit f2f3fcb1aa983b65aa0649ab57073f5dae785640 Karthik Ranganathan committed Aug 26, 2012
View
@@ -46,13 +46,12 @@ jar {
dependencies {
compile 'com.thoughtworks.xstream:xstream:1.4.2'
- compile 'com.netflix.archaius:archaius-core:0.2.2'
+ compile 'com.netflix.archaius:archaius-core:0.3.3'
compile 'javax.ws.rs:jsr311-api:1.1.1'
compile 'com.netflix.servo:servo-core:0.4.13'
compile 'com.sun.jersey:jersey-bundle:1.9.1'
compile 'com.sun.jersey.contribs:jersey-apache-client4:1.8'
compile 'org.apache.httpcomponents:httpclient:4.1.2'
-
}
}
@@ -70,7 +69,7 @@ jar {
compile 'amazon:aws-java-sdk:1.3.4.1'
compile 'javax.servlet:servlet-api:2.4'
compile 'com.thoughtworks.xstream:xstream:1.4.2'
- compile 'com.netflix.archaius:archaius-core:0.2.2'
+ compile 'com.netflix.archaius:archaius-core:0.3.3'
compile 'javax.ws.rs:jsr311-api:1.1.1'
compile 'com.netflix.servo:servo-core:0.4.13'
compile 'com.sun.jersey:jersey-bundle:1.9.1'
@@ -83,11 +82,6 @@ jar {
project(':eureka-resources') {
-task copy(type: Copy) {
- from '*'
-}
-
-
jar {
manifest {
attributes("Implementation-Title": "eureka-resources", "Implementation-Version": version,'Build-Time-ISO-8601': new Date().format("yyyy-MM-dd'T'HH:mm:ssZ"))
@@ -105,26 +99,41 @@ sourceSets {
srcDir 'test/java'
}
}
-
-task taskX(dependsOn: ':eureka-resources:copy') << {
- println 'Copying resources from eureka-resources'
- }
+}
war {
- from '*' // adds a file-set to the root of the archive
- webXml = file('WEB-INF/web.xml') // copies a file to WEB-INF/web.xml
-}
+
+ from('conf') {
+ include 'eureka-server*'
+ include 'eureka-client*'
+ include 'log4j.properties'
+ into 'WEB-INF/classes/'
+ }
+ from (project(':eureka-resources').file('build/resources/main'))
+ webXml = file('WEB-INF/web.xml') // copies a file to WEB-INF/web.xml
+
+ }
+
+
dependencies {
compile project(':eureka-client')
compile project(':eureka-core')
- compile project(':eureka-resources')
+ runtime 'xerces:xercesImpl:2.4.0'
+ runtime 'asm:asm:3.1'
+ compile 'org.slf4j:slf4j-log4j12:1.6.1'
+ runtime 'org.codehaus.jettison:jettison:1.2'
providedCompile 'javax.servlet:servlet-api:2.4'
}
+delete 'testlibs'
+copy {
+ from zipTree('build/libs/'+ war.archiveName)
+ into 'testlibs'
+ include 'WEB-INF/lib/'
+}
}
-
@@ -355,7 +355,7 @@ public void registerHealthCheckCallback(HealthCheckCallback callback) {
* com.netflix.discovery.shared.LookupService#getNextServerFromEureka(java
* .lang.String, boolean)
*/
- public String getNextServerFromEureka(String virtualHostname, boolean secure) {
+ public InstanceInfo getNextServerFromEureka(String virtualHostname, boolean secure) {
List<InstanceInfo> instanceInfoList = this.getInstancesByVipAddress(
virtualHostname, secure);
if (instanceInfoList == null || instanceInfoList.isEmpty()) {
@@ -366,7 +366,7 @@ public String getNextServerFromEureka(String virtualHostname, boolean secure) {
int index = (int) (apps.getNextIndex(virtualHostname.toUpperCase(),
secure).incrementAndGet() % instanceInfoList.size());
InstanceInfo instanceInfo = instanceInfoList.get(index);
- return instanceInfo.getHostName();
+ return instanceInfo;
}
/**
@@ -22,46 +22,43 @@
import com.netflix.appinfo.InstanceInfo.InstanceStatus;
import com.netflix.discovery.EurekaClientConfig;
-
/**
* Lookup service for finding active instances.
*
* @author Karthik Ranganathan, Greg Kim.
*/
public interface LookupService<T> {
-
-
/**
- * Returns the corresponding {@link Application} object which is basically
- * a container of all registered <code>appName</code> {@link InstanceInfo}s.
- *
- * @param appName
- * @return a {@link Application} or null
- * if we couldn't locate any app of the requested appName
+ * Returns the corresponding {@link Application} object which is basically a
+ * container of all registered <code>appName</code> {@link InstanceInfo}s.
+ *
+ * @param appName
+ * @return a {@link Application} or null if we couldn't locate any app of
+ * the requested appName
*/
Application getApplication(String appName);
-
+
/**
* Returns the {@link Applications} object which is basically a container of
* all currently registered {@link Application}s.
*
- * @param appName
+ * @param appName
* @return {@link Applications}
*/
Applications getApplications();
-
-
+
/**
- * Returns the {@link List} of {@link InstanceInfo}s matching the the passed in
- * id. A single {@link InstanceInfo} can possibly be registered w/ more than one
- * {@link Application}s
+ * Returns the {@link List} of {@link InstanceInfo}s matching the the passed
+ * in id. A single {@link InstanceInfo} can possibly be registered w/ more
+ * than one {@link Application}s
*
* @param id
- * @return {@link List} of {@link InstanceInfo}s or {@link Collections#emptyList()}
+ * @return {@link List} of {@link InstanceInfo}s or
+ * {@link Collections#emptyList()}
*/
List<InstanceInfo> getInstancesById(String id);
-
+
/**
* Gets the next possible server to process the requests from the registry
* information received from eureka.
@@ -81,8 +78,10 @@
* @param secure
* indicates whether this is a HTTP or a HTTPS request - secure
* means HTTPS.
- * @return the public host name of the next server in line to process the
- * request based on the round-robin algorithm.
+ * @return the {@link InstanceInfo} information which contains the public
+ * host name of the next server in line to process the request based
+ * on the round-robin algorithm.
*/
- public String getNextServerFromEureka(String virtualHostname, boolean secure);
+ public InstanceInfo getNextServerFromEureka(String virtualHostname,
+ boolean secure);
}
@@ -548,7 +548,7 @@ void shutdown() {
}
@Override
- public String getNextServerFromEureka(String virtualHostname, boolean secure) {
+ public InstanceInfo getNextServerFromEureka(String virtualHostname, boolean secure) {
// TODO Auto-generated method stub
return null;
}
No changes.
View
@@ -1,20 +1,24 @@
#Availability zones with the format eureka.<region>.availabilityZones,
-eureka.us-east-1.availabilityZones=us-east-1c,us-east-1d,us-east-1e
+#eureka.us-east-1.availabilityZones=us-east-1c,us-east-1d,us-east-1e
+
+eureka.us-east-1.availabilityZones=default
#Service urls for eureka server in each zone
-eureka.serviceUrl.us-east-1c=http://ec2-552-627-568-165.compute-1.amazonaws.com:7001/discovery/v2/,http://ec2-168-101-182-134.compute-1.amazonaws.com:7001/discovery/v2/
-eureka.serviceUrl.us-east-1d=http://ec2-552-627-568-170.compute-1.amazonaws.com:7001/discovery/v2/
-eureka.serviceUrl.us-east-1e=http://ec2-50-179-285-592.compute-1.amazonaws.com:7001/discovery/v2/
+#eureka.serviceUrl.us-east-1c=http://ec2-552-627-568-165.compute-1.amazonaws.com:7001/discovery/v2/,http://ec2-168-101-182-134.compute-1.amazonaws.com:7001/discovery/v2/
+#eureka.serviceUrl.us-east-1d=http://ec2-552-627-568-170.compute-1.amazonaws.com:7001/discovery/v2/
+#eureka.serviceUrl.us-east-1e=http://ec2-50-179-285-592.compute-1.amazonaws.com:7001/discovery/v2/
+
+eureka.serviceUrl.default=http://localhost/eureka/v2/
#Availability zones and serviceUrls for us-west-1 region
-eureka.us-west-1.availabilityZones=us-west-1a,us-west-1b,us-west-1c
-eureka.serviceUrl.us-west-1a=http://ec2-67-45-89-248.us-west-1.compute.amazonaws.com:7001/discovery/v2/
-eureka.serviceUrl.us-west-1b=http://ec2-67-45-89-249.us-west-1.compute.amazonaws.com:7001/discovery/v2/
-eureka.serviceUrl.us-west-1c=http://ec2-67-45-89-250.us-west-1.compute.amazonaws.com:7001/discovery/v2/
+#eureka.us-west-1.availabilityZones=us-west-1a,us-west-1b,us-west-1c
+#eureka.serviceUrl.us-west-1a=http://ec2-67-45-89-248.us-west-1.compute.amazonaws.com:7001/discovery/v2/
+#eureka.serviceUrl.us-west-1b=http://ec2-67-45-89-249.us-west-1.compute.amazonaws.com:7001/discovery/v2/
+#eureka.serviceUrl.us-west-1c=http://ec2-67-45-89-250.us-west-1.compute.amazonaws.com:7001/discovery/v2/
#Availability zones and serviceUrls for eu-west-1 region
-eureka.eu-west-1.availabilityZones=eu-west-1a,eu-west-1b,eu-west-1c
-eureka.serviceUrl.eu-west-1a=http://ec2-59-78-75-193.eu-west-1.compute.amazonaws.com:7001/discovery/v2/
-eureka.serviceUrl.eu-west-1b=http://ec2-59-78-75-199.eu-west-1.compute.amazonaws.com:7001/discovery/v2/
-eureka.serviceUrl.eu-west-1c=http://ec2-59-78-75-212.eu-west-1.compute.amazonaws.com:7001/discovery/v2/
+#eureka.eu-west-1.availabilityZones=eu-west-1a,eu-west-1b,eu-west-1c
+#eureka.serviceUrl.eu-west-1a=http://ec2-59-78-75-193.eu-west-1.compute.amazonaws.com:7001/discovery/v2/
+#eureka.serviceUrl.eu-west-1b=http://ec2-59-78-75-199.eu-west-1.compute.amazonaws.com:7001/discovery/v2/
+#eureka.serviceUrl.eu-west-1c=http://ec2-59-78-75-212.eu-west-1.compute.amazonaws.com:7001/discovery/v2/
View
@@ -1,12 +1,14 @@
-##
+##Eureka Client configuration for Eureka Service
+
#Properties based configuration for eureka client. The properties specified here is mostly what the users
#need to change. All of these can be specified as a java system property with -D option (eg)-Deureka.region=us-east-1
#For additional tuning options refer <url to go here>
#Region where eureka is deployed -For AWS specify one of the AWS regions, for other datacenters specify a arbitrary string
#indicating the region.This is normally specified as a -D option (eg) -Deureka.region=us-east-1
-eureka.region=us-east-1
+#eureka.region=us-east-1
+eureka.region=default
#Name of the application to be identified by other services
No changes.
@@ -1,4 +1,2 @@
-#Specific AWS access key and Id with the right access permissions to query the Amazon autoscaling info.
-#This is only needed if you need to query ASG information to disable/enable your instance on launch
eureka.awsAccessId=ADIIEIFIFPFIKC
eureka.awsSecretKey=dieuilfkfoioljhjhjuTRoIiijc
View
@@ -1,4 +1,3 @@
-#Specific AWS access key and Id with the right access permissions to query the Amazon autoscaling info.
-#This is only needed if you need to query ASG information to disable/enable your instance on launch
+
eureka.awsAccessId=ADIIEIFIFPFIKC
eureka.awsSecretKey=dieuilfkfoioljhjhjuTRoIiijc
View
No changes.
@@ -0,0 +1,4 @@
+log4j.rootCategory=INFO,stdout
+log4j.appender.stdout=org.apache.log4j.ConsoleAppender
+log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
+log4j.appender.stdout.layout.ConversionPattern=%d %-5p %C:%L [%t] [%M] %m%n
@@ -0,0 +1,32 @@
+###Eureka Client configuration for Sample Eureka Client
+
+#Properties based configuration for eureka client. The properties specified here is mostly what the users
+#need to change. All of these can be specified as a java system property with -D option (eg)-Deureka.region=us-east-1
+#For additional tuning options refer <url to go here>
+
+
+#Region where eureka is deployed -For AWS specify one of the AWS regions, for other datacenters specify a arbitrary string
+#indicating the region.This is normally specified as a -D option (eg) -Deureka.region=us-east-1
+eureka.region=default
+
+#Name of the application to be identified by other services
+
+eureka.name=sample-eureka-client
+
+#Virtual host name by which the clients identifies this service
+#eureka.vipAddress=eureka.mydomain.net
+
+#Http port where eureka server will be running
+#eureka.port=80
+
+#For eureka clients running in eureka server, it needs to connect to servers in other zones
+eureka.preferSameZone=true
+
+#Change this if you want to use a DNS based lookup for determining other eureka servers. For example
+#of specifying the DNS entries, check the eureka-client-test.properties, eureka-client-prod.properties
+eureka.shouldUseDns=false
+
+eureka.us-east-1.availabilityZones=default
+
+eureka.serviceUrl.default=http://localhost/eureka/v2/
+
@@ -0,0 +1,4 @@
+log4j.rootCategory=INFO,stdout
+log4j.appender.stdout=org.apache.log4j.ConsoleAppender
+log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
+log4j.appender.stdout.layout.ConversionPattern=%d %-5p %C:%L [%t] [%M] %m%n
@@ -0,0 +1,32 @@
+###Eureka Client configuration for Sample Eureka Service
+
+#Properties based configuration for eureka client. The properties specified here is mostly what the users
+#need to change. All of these can be specified as a java system property with -D option (eg)-Deureka.region=us-east-1
+#For additional tuning options refer <url to go here>
+
+
+#Region where eureka is deployed -For AWS specify one of the AWS regions, for other datacenters specify a arbitrary string
+#indicating the region.This is normally specified as a -D option (eg) -Deureka.region=us-east-1
+eureka.region=default
+
+#Name of the application to be identified by other services
+
+eureka.name=sample-eureka-service
+
+#Virtual host name by which the clients identifies this service
+eureka.vipAddress=sampleservice.mydomain.net
+
+#Http port where eureka server will be running
+eureka.port=8001
+
+#For eureka clients running in eureka server, it needs to connect to servers in other zones
+eureka.preferSameZone=false
+
+#Change this if you want to use a DNS based lookup for determining other eureka servers. For example
+#of specifying the DNS entries, check the eureka-client-test.properties, eureka-client-prod.properties
+eureka.shouldUseDns=false
+
+eureka.us-east-1.availabilityZones=default
+
+eureka.serviceUrl.default=http://localhost/eureka/v2/
+
@@ -0,0 +1,32 @@
+###Eureka Client configuration for Sample Eureka Service
+
+#Properties based configuration for eureka client. The properties specified here is mostly what the users
+#need to change. All of these can be specified as a java system property with -D option (eg)-Deureka.region=us-east-1
+#For additional tuning options refer <url to go here>
+
+
+#Region where eureka is deployed -For AWS specify one of the AWS regions, for other datacenters specify a arbitrary string
+#indicating the region.This is normally specified as a -D option (eg) -Deureka.region=us-east-1
+eureka.region=default
+
+#Name of the application to be identified by other services
+
+eureka.name=sample-eureka-service
+
+#Virtual host name by which the clients identifies this service
+eureka.vipAddress=sampleservice.mydomain.net
+
+#Http port where eureka server will be running
+eureka.port=8001
+
+#For eureka clients running in eureka server, it needs to connect to servers in other zones
+eureka.preferSameZone=false
+
+#Change this if you want to use a DNS based lookup for determining other eureka servers. For example
+#of specifying the DNS entries, check the eureka-client-test.properties, eureka-client-prod.properties
+eureka.shouldUseDns=false
+
+eureka.us-east-1.availabilityZones=default
+
+eureka.serviceUrl.default=http://localhost/eureka/v2
+
@@ -0,0 +1,15 @@
+#!/bin/bash
+#Copy all libraries
+TEST_CLASSPATH=
+for i in testlibs/WEB-INF/lib/*
+do
+ if [ "$TEST_CLASSPATH" = "" ] ; then
+ TEST_CLASSPATH=$i
+ fi
+ TEST_CLASSPATH=$TEST_CLASSPATH:$i
+done
+TEST_CLASSPATH=$TEST_CLASSPATH:build/classes/main:conf/sampleclient
+
+echo CLASSPATH:$TEST_CLASSPATH
+java -Deureka.region=default -Deureka.environment=test -Deureka.client.props=sample-eureka-client -cp $TEST_CLASSPATH com.netflix.eureka.SampleEurekaClient
+
@@ -0,0 +1,15 @@
+#!/bin/bash
+#Copy all libraries
+TEST_CLASSPATH=
+for i in testlibs/WEB-INF/lib/*
+do
+ if [ "$TEST_CLASSPATH" = "" ] ; then
+ TEST_CLASSPATH=$i
+ fi
+ TEST_CLASSPATH=$TEST_CLASSPATH:$i
+done
+TEST_CLASSPATH=$TEST_CLASSPATH:build/classes/main:conf/sampleservice
+
+echo CLASSPATH:$TEST_CLASSPATH
+java -Deureka.region=default -Deureka.environment=test -Deureka.client.props=sample-eureka-service -cp $TEST_CLASSPATH com.netflix.eureka.SampleEurekaService
+
Oops, something went wrong.

0 comments on commit f2f3fcb

Please sign in to comment.