Commit 9b506638 by Spencer Gibb

moved zuul to io.spring.platform.zuul;

added turbine
parent 103bc777
......@@ -37,3 +37,25 @@ eureka:
The default application name, virtual host and non-secure port are taken from the `Environment` is
`${spring.application.name}`, `${spring.application.name}.mydomain.net` and `${server.port}` respectively.
# TODO List
- [x] Example front end app (currently in sandbox)
- [x] Example back end service (currently in sandbox)
- [x] Use platform config
- [x] Hystrix integration (hystrix-javanica)
- [x] Feign use spring message converters
- [x] Ribbon (static server list)
- [x] Eureka boot app (Service registration)
- [x] Eureka (apache -> tomcat) see https://github.com/cfregly/fluxcapacitor/wiki/NetflixOSS-FAQ#eureka-service-discovery-load-balancer and https://groups.google.com/forum/?fromgroups#!topic/eureka_netflix/g3p2r7gHnN0
- [x] Archaius bridge to spring environment
- [x] Ribbon (Client side load balancing) (Eureka integration)
- [x] Remove need for *-eureka.properties
- [ ] Use spring boot values as defaults where appropriate
- [x] Synchronous removal of service from eureka on shutdown
- [x] Refresh log levels dynamically
- [x] Router (Zuul) integrated using hystrix/ribbon/eureka
- [ ] Better observable example
- [ ] Distributed refresh environment via platform bus
- [x] Metrics aggregation (turbine)
- [ ] Use Eureka for instance discovery rather than static list see https://github.com/Netflix/Turbine/blob/master/turbine-contrib/src/main/java/com/netflix/turbine/discovery/EurekaInstanceDiscovery.java
......@@ -21,6 +21,7 @@
<modules>
<module>spring-platform-netflix-core</module>
<module>spring-platform-netflix-hystrix</module>
<module>spring-platform-netflix-turbine</module>
<module>spring-platform-netflix-zuul</module>
</modules>
......@@ -119,8 +120,12 @@
<version>${turbine.version}</version>
<exclusions>
<exclusion>
<artifactId>log4j</artifactId>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
</exclusion>
<exclusion>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
</exclusion>
</exclusions>
</dependency>
......
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<artifactId>spring-platform-netflix-turbine</artifactId>
<packaging>war</packaging>
<name>Spring Platform Netflix Turbine</name>
<url>http://projects.spring.io/spring-platform/</url>
<parent>
<groupId>org.springframework.platform</groupId>
<artifactId>spring-platform-netflix</artifactId>
<version>1.0.0.BUILD-SNAPSHOT</version>
<relativePath>..</relativePath>
</parent>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
<properties>
<spring-platform-config.version>1.0.0.BUILD-SNAPSHOT</spring-platform-config.version>
</properties>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.platform</groupId>
<artifactId>spring-platform-config</artifactId>
<version>${spring-platform-config.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.platform</groupId>
<artifactId>spring-platform-netflix-core</artifactId>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.platform</groupId>
<artifactId>spring-platform-config-client</artifactId>
</dependency>
<dependency>
<groupId>com.netflix.turbine</groupId>
<artifactId>turbine-core</artifactId>
</dependency>
</dependencies>
</project>
package io.spring.platform.netflix.turbine;
import com.netflix.turbine.init.TurbineInit;
import com.netflix.turbine.streaming.servlet.TurbineStreamServlet;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.context.embedded.ServletRegistrationBean;
import org.springframework.boot.context.web.SpringBootServletInitializer;
import org.springframework.context.SmartLifecycle;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
/**
* Created by sgibb on 7/11/14.
*/
@Configuration
@ComponentScan
@EnableAutoConfiguration
public class Application extends SpringBootServletInitializer implements SmartLifecycle {
@Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
return application.sources(Application.class).web(true);
}
public static void main(String[] args) {
new SpringApplicationBuilder(Application.class).web(true).run(args);
}
@Bean
public ServletRegistrationBean mockStreamServlet() {
return new ServletRegistrationBean(new TurbineStreamServlet(), "/turbine.stream");
}
private boolean running;
@Override
public boolean isAutoStartup() {
return true;
}
@Override
public void stop(Runnable callback) {
callback.run();
}
@Override
public void start() {
TurbineInit.init();
}
@Override
public void stop() {
running = false;
}
@Override
public boolean isRunning() {
return running;
}
@Override
public int getPhase() {
return 0;
}
}
#org.springframework.context.ApplicationListener=\
#org.springframework.platform.netflix.eureka.EurekaStartingListener,\
#org.springframework.platform.netflix.eureka.EurekaUpListener,\
#org.springframework.platform.netflix.eureka.EurekaOutOfServiceListener
#org.springframework.boot.autoconfigure.EnableAutoConfiguration=\
#org.springframework.platform.netflix.archaius.ArchaiusAutoConfiguration,\
#org.springframework.platform.netflix.feign.FeignAutoConfiguration
info:
component: Turbine
endpoints:
restart:
enabled: true
shutdown:
enabled: true
server:
port: 8989
context-path: /turbine
logging:
level: INFO
eureka:
client:
#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
region: default
#For eureka clients running in eureka server, it needs to connect to servers in other zones
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
#shouldUseDns: false
us-east-1:
availabilityZones: default
serviceUrl:
default: http://localhost:8080/eureka/v2/
defaultZone: http://localhost:8080/eureka/v2/
instance:
#Virtual host name by which the clients identifies this service
virtualHostName: ${spring.application.name}
spring:
application:
name: turbine
platform:
config:
uri: http://localhost:${config.port:8888}
\ No newline at end of file
package org.springframework.platform.netflix.zuul;
package io.spring.platform.netflix.zuul;
import com.netflix.zuul.context.ContextLifecycleFilter;
import org.springframework.boot.SpringApplication;
......
package org.springframework.platform.netflix.zuul;
package io.spring.platform.netflix.zuul;
import com.netflix.zuul.FilterFileManager;
import com.netflix.zuul.FilterLoader;
......
package org.springframework.platform.netflix.zuul;
package io.spring.platform.netflix.zuul;
import com.netflix.client.http.HttpRequest;
import com.netflix.client.http.HttpResponse;
......
package org.springframework.platform.netflix.zuul;
package io.spring.platform.netflix.zuul;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
......
package org.springframework.platform.netflix.zuul;
package io.spring.platform.netflix.zuul;
import com.netflix.zuul.ZuulFilter;
import org.springframework.web.context.WebApplicationContext;
......
package org.springframework.platform.netflix.zuul;
package io.spring.platform.netflix.zuul;
import com.netflix.zuul.http.ZuulServlet;
import org.springframework.platform.util.AbstractServletWrappingController;
import io.spring.platform.util.AbstractServletWrappingController;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;
......
package org.springframework.platform.netflix.zuul;
package io.spring.platform.netflix.zuul;
import org.springframework.boot.context.properties.ConfigurationProperties;
......
package org.springframework.platform.util;
package io.spring.platform.util;
import org.springframework.beans.BeansException;
import org.springframework.beans.factory.InitializingBean;
......
......@@ -3,8 +3,8 @@ package filters.pre
import com.netflix.zuul.context.RequestContext
import org.slf4j.Logger
import org.slf4j.LoggerFactory
import org.springframework.platform.netflix.zuul.Routes
import org.springframework.platform.netflix.zuul.SpringFilter
import io.spring.platform.netflix.zuul.Routes
import io.spring.platform.netflix.zuul.SpringFilter
class PreDecorationFilter extends SpringFilter {
private static Logger LOG = LoggerFactory.getLogger(PreDecorationFilter.class);
......
......@@ -15,7 +15,7 @@ import com.netflix.zuul.util.HTTPRequestUtils
import com.sun.jersey.core.util.MultivaluedMapImpl
import org.slf4j.Logger
import org.slf4j.LoggerFactory
import org.springframework.platform.netflix.zuul.RibbonCommand
import io.spring.platform.netflix.zuul.RibbonCommand
import javax.servlet.http.HttpServletRequest
import javax.ws.rs.core.MultivaluedMap
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment