Code Monkey home page Code Monkey logo

karyon's Introduction

===== Karyon 2.0 is no longer supported. We are in the process of retiring Karyon in favor of using Governator for bootstrapping and OSS components with -guice or -governator subprojects.

karyon

Build Status

Karyon in the context of molecular biology is essentially "a part of the cell containing DNA and RNA and responsible for growth and reproduction."

At Netflix, Karyon is a framework and library that essentially contains the blueprint of what it means to implement a cloud ready web service. All the other fine grained web services and applications that form our SOA graph can essentially be thought as being cloned from this basic blueprint.

Karyon can be thought of as a nucleus that contains the following main ingredients.

  • Bootstrapping , dependency and Lifecycle Management (via Governator)
  • Runtime Insights and Diagnostics (via karyon-admin-web module)
  • Configuration Management (via Archaius)
  • Service discovery (via Eureka)
  • Powerful transport module (via RxNetty)

Getting Started

Easiest way to get started with karyon is to see the examples provided with karyon under karyon-examples module.

Documentation

Please see [wiki] (https://github.com/Netflix/karyon/wiki) for detailed documentation.

Have a question?

We have a discussion group for karyon users (i.e. you!) here: https://groups.google.com/forum/?fromgroups#!forum/karyon-users

karyon's People

Contributors

amit-git avatar brharrington avatar cfregly avatar drtechniko avatar elandau avatar filhodanuvem avatar jackofmosttrades avatar jkschneider avatar jmnarloch avatar juniorz avatar majikthys avatar niteshkant avatar qiangdavidliu avatar quidryan avatar randgalt avatar rspieldenner avatar schmitch avatar stonse avatar t-ashraf avatar tcellucci avatar trundle avatar twicksell avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

karyon's Issues

Bug trying to set other jersey properties through archaius

With archaius properties file config of:

com.sun.jersey.config.property.packages=com.acmeair.services.authService
com.sun.jersey.api.json.POJOMappingFeature=true

PropertyBasedResouceConfig initIfRequired exhibit this behavior:

  • PackagesResourceConfig.PROPERTY_PACKAGES code works

Map<String, Object> jerseyProperties = createPropertiesMap()

always comes back an empty map.

It also looks like debugging the code that the code called here:

Properties properties = getConfigInstance().getProperties("com.sun.jersey");

Is wrong. Are you sure the underlying code isn't for getting a multi-value "com.sun.jersey" property vs. getting any property that starts with com.sun.jersey?

Eliminate unnecessary global dependencies from the build

The dependencies such as 'javax.ws.rs:jsr311-api:1.1.1' and 'javax.servlet:servlet-api:2.5' are not required by all sub-projects but are defined globally or in core module.
We should move this to the modules which need them.

Logging with custom appender stops working just before governator is loaded.

Hello,

Having an issue with custom appender that may (?) be related to karyon/netflix oss...

I have a custom appender configured like this:

log4j.debug=true
log4j.rootCategory=DEBUG, stdout, audit
log4j.appender.audit=com.liaison.framework.audit.AuditAppender
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%m%n

It works (gets called for all root category log calls) at the beginning of bootstrapping during server startup (jetty via jettyRun) until these statements appear...

04 [Daemon] INFO com.netflix.config.util.ConfigurationUtils - Loaded properties file file:/Users/rob/git/service-seed/service-implementation/build/resources/main/hello-world-dev.properties
115 [Daemon] INFO com.netflix.karyon.server.ServerBootstrap - Creating a new governator classpath scanner with base packages: [com.netflix, com.liaison]
665 [Daemon] INFO org.hibernate.validator.util.Version - Hibernate Validator 4.1.0.Final
692 [Daemon] INFO com.netflix.karyon.server.HealthCheckModule - No health check invocation strategy specified, using the default strategy com.netflix.karyon.server.eureka.AsyncHe

After this point, the binding between RootCategory and AuditAppender is lost.

Question is, is there anything fancy going on with respect to logging within the NetFlix projects?

Thank you,

Robert Christian

Provide a way to configure HealthCheckHandler in @KaryonBootstrap

Currently, KaryonBootstrapSuite configures the HealthCheckHandler implementation and the only way to override the same is to not use @KaryonBootstrap and use the KaryonBootstrapSuite directly.

If we provide an attribute in @KaryonBootstrap to specify the HealthCheckHandler implementation, it will make this mainline usecase simpler.

Extensions Structure

Shouldn't each extension be a subproject, rather than having them all in a grab bag together? This way you won't end up dragging in dependencies for extensions that you aren't using.

Minimum viable project

Hi Nitesh,

Do you have any plans to simplify further to a github project that is simply hello-world and references karyon-core, karyon-extensions, karyon-spi, and karyon-admin as jar/artifact rather than source?

That's how others are likely to want to use this. (IE non-Netflix folks won't/shouldn't need to modify those modules)

Thanks,

Rob

Karyon Core depends on Karyon Eureka

This results in being forced to pull in eureka dependencies even when you disable the usage of eureka, and should probably be refactored so that this isn't the case.

Health Check Port is sub optimal

The health check should be available on the same port/listener that is handling the service requests. Otherwise you have a condition where firewall rules or the listener dying could cause the service to fail while the healthcheck still passed.

Jersey 2 project and Karyon admin

My project is built with Jersey 2.3, when I try to use Karyon admin, I get the error below and the app won't start properly. It seems that it was caused by a conflict between jax-rs api 1 and 2.

(If I keep jsr311-api-1.1.1 or any jar containing jaxrs-1.x API, my Jersey 2 project wouldn't work, and if I keep only javax.ws.rs-api-2.0.jar, Kayron admin wouldn't start. Both version of jax-rs API has javax.ws.rs.core.UriBuilder.class)

Do you guys know of any way to work around this problem?

    2013-09-25 13:47:15,764 WARN [qtp791589140-42] o.e.j.s.ServletHandler [ServletHandler.java:539] Error for /admin
    java.lang.AbstractMethodError: javax.ws.rs.core.UriBuilder.uri(Ljava/lang/String;)Ljavax/ws/rs/core/UriBuilder;
        at javax.ws.rs.core.UriBuilder.fromUri(UriBuilder.java:119) ~[javax.ws.rs-api-2.0.jar:2.0]
        at com.sun.jersey.spi.container.servlet.ServletContainer.doFilter(ServletContainer.java:879) ~[jersey-bundle-1.9.1.jar:1.9.1]
        at com.sun.jersey.spi.container.servlet.ServletContainer.doFilter(ServletContainer.java:843) ~[jersey-bundle-1.9.1.jar:1.9.1]
        at com.sun.jersey.spi.container.servlet.ServletContainer.doFilter(ServletContainer.java:804) ~[jersey-bundle-1.9.1.jar:1.9.1]
        at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1300) ~[jetty-servlet-7.6.7.v20120910.jar:7.6.7.v20120910]
        at com.netflix.adminresources.RedirectFilter.doFilter(RedirectFilter.java:54) ~[karyon-admin-1.0.20.jar:na]
        at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1300) ~[jetty-servlet-7.6.7.v20120910.jar:7.6.7.v20120910]
        at com.netflix.adminresources.LoggingFilter.doFilter(LoggingFilter.java:64) ~[karyon-admin-1.0.20.jar:na]
        ...

Unable to use version karyon 2.0.02 using maven

Setup:
Trying to use karyon 2.0.02 in a Java module using maven build system.

Issue:
Build always fails trying to look for eureka-client artifacts of version "1.+".

My analysis:
Looking into the pom for karyon-eureka version 2.0.02, some versions are specified as "1.+" and "0.+" which to my knowledge these are not valid wild cards in maven. I could figure out that these are dynamic versions in gradle but it is not valid in a maven pom file.

karyon-users conversation:
https://groups.google.com/d/msg/karyon-users/A37Wd0stGJg/RCCzchplTRcJ

Feedback from Google groups:

Yes what you encountered is an issue w.r.t. using karyon with maven. I will try to
figure out a middle ground in which wild card dependency versions can be specified
in karyon interoperably across maven,ivy, gradle. In the meanwhile can you file a git
issue for this?

Karyon 2.0 seems to force Amazon Datacenter for Eureka

On adding in KaryonEurekaModule to my Modules, I get:

  1. Error in custom provider, java.lang.RuntimeException: Your datacenter is defined as cloud but we are not able to get the amazon metadata to register.
    Set the property eureka.validateInstanceId to false to ignore themetadata call
    while locating com.netflix.appinfo.providers.CloudInstanceConfigProvider
    while locating com.netflix.appinfo.CloudInstanceConfig
    while locating com.netflix.appinfo.EurekaInstanceConfig
    for parameter 0 at com.netflix.appinfo.providers.EurekaConfigBasedInstanceInfoProvider.(EurekaConfigBasedInstanceInfoProvider.java:35)
    at com.netflix.appinfo.providers.EurekaConfigBasedInstanceInfoProvider.class(EurekaConfigBasedInstanceInfoProvider.java:26)
    while locating com.netflix.appinfo.providers.EurekaConfigBasedInstanceInfoProvider
    while locating com.netflix.appinfo.InstanceInfo
    for parameter 0 at com.netflix.discovery.DiscoveryClient.(DiscoveryClient.java:198)
    at com.netflix.discovery.DiscoveryClient.class(DiscoveryClient.java:108)
    while locating com.netflix.discovery.DiscoveryClient
    at com.netflix.karyon.eureka.KaryonEurekaModule.configure(KaryonEurekaModule.java:21)
    while locating com.netflix.discovery.shared.LookupService
    Caused by: java.lang.RuntimeException: Your datacenter is defined as cloud but we are not able to get the amazon metadata to register.
    Set the property eureka.validateInstanceId to false to ignore themetadata call
    at com.netflix.appinfo.CloudInstanceConfig.initDataCenterInfo(CloudInstanceConfig.java:83)
    at com.netflix.appinfo.CloudInstanceConfig.initCloudInstanceConfig(CloudInstanceConfig.java:67)
    at com.netflix.appinfo.CloudInstanceConfig.(CloudInstanceConfig.java:57)
    at com.netflix.appinfo.providers.CloudInstanceConfigProvider.get(CloudInstanceConfigProvider.java:27)
    at com.netflix.appinfo.providers.CloudInstanceConfigProvider.get(CloudInstanceConfigProvider.java:15)
    at com.google.inject.internal.InjectorImpl$2.get(InjectorImpl.java:687)
    at com.google.internal.InjectorImpl$3.get(InjectorImpl.java:737)
    at com.google.inject.internal.SingleParameterInjector.inject(SingleParameterInjector.java:38)
    at com.google.inject.internal.SingleParameterInjector.getAll(SingleParameterInjector.java:62)
    at com.google.inject.internal.ConstructorInjector.construct(ConstructorInjector.java:84)
    at com.google.inject.internal.ConstructorBindingImpl$Factory.get(ConstructorBindingImpl.java:254)
    at com.google.inject.internal.ProviderToInternalFactoryAdapter$1.call(ProviderToInternalFactoryAdapter.java:46)
    at com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1031)
    at com.google.inject.internal.ProviderToInternalFactoryAdapter.get(ProviderToInternalFactoryAdapter.java:40)
    at com.google.inject.Scopes$1$1.get(Scopes.java:65)
    at com.google.inject.internal.InternalFactoryToProviderAdapter.get(InternalFactoryToProviderAdapter.java:40)
    at com.google.inject.internal.InjectorImpl$2.get(InjectorImpl.java:684)
    at com.google.inject.internal.SingleParameterInjector.inject(SingleParameterInjector.java:38)
    at com.google.inject.internal.SingleParameterInjector.getAll(SingleParameterInjector.java:62)
    at com.google.inject.internal.ConstructorInjector.construct(ConstructorInjector.java:84)
    at com.google.inject.internal.ConstructorBindingImpl$Factory.get(ConstructorBindingImpl.java:254)
    at com.google.inject.internal.ProviderToInternalFactoryAdapter$1.call(ProviderToInternalFactoryAdapter.java:46)
    at com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1031)
    at com.google.inject.internal.ProviderToInternalFactoryAdapter.get(ProviderToInternalFactoryAdapter.java:40)
    at com.netflix.governator.guice.lazy.FineGrainedLazySingletonScopeImpl$1.get(FineGrainedLazySingletonScopeImpl.java:62)
    at com.google.inject.internal.InternalFactoryToProviderAdapter.get(InternalFactoryToProviderAdapter.java:40)
    at com.google.inject.internal.FactoryProxy.get(FactoryProxy.java:54)
    at com.google.inject.internal.ProviderToInternalFactoryAdapter$1.call(ProviderToInteroryAdapter.java:46)
    at com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1031)
    at com.google.inject.internal.ProviderToInternalFactoryAdapter.get(ProviderToInternalFactoryAdapter.java:40)
    at com.google.inject.Scopes$1$1.get(Scopes.java:65)
    at com.google.inject.internal.InternalFactoryToProviderAdapter.get(InternalFactoryToProviderAdapter.java:40)
    at com.google.inject.internal.InternalInjectorCreator$1.call(InternalInjectorCreator.java:204)
    at com.google.inject.internal.InternalInjectorCreator$1.call(InternalInjectorCreator.java:198)
    at com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1024)
    at com.google.inject.internal.InternalInjectorCreator.loadEagerSingletons(InternalInjectorCreator.java:198)
    at com.google.inject.internal.InternalInjectorCreator.injectDynamically(InternalInjectorCreator.java:179)
    at com.google.inject.internal.InternalInjectorCreator.build(InternalInjectorCreator.java:109)
    at com.google.inject.Guice.createInjector(Guice.java:95)
    at com.netflix.governator.guice.LifecycleInjector.createSimulatedChildInjector(LifecycleInjector.java:371)
    at com.netflix.governator.guice.LifecycleInjector.createChildInjector(LifecycleInjector.java:240)
    at com.netflix.governator.guice.LifecycleInjector.createInjector(LifecycleInjector.java:303)
    at com.netflix.governator.guice.LifecycleInjector.createInjector(LifecycleInjector.java:257)
    at com.netflix.governator.guice.LifecycleInjector.bootstrap(LifecycleInjector.java:160)
    at com.netflix.karyon.KaryonServer.startAndAwait(KaryonServer.java:26)
    at com.netflix.karyon.KaryonServer.main(KaryonServer.java:44)

It looks like Amazon is assumed by

ApplicationInfoManager initialization to EurekaInstanceConfig -> implemented by CloudInstanceConfig. This seems like this is the Amazon one. I tried to do the older Karyon 1.0 approach of com.netflix.karyon.eureka.datacenter.type=MyOwn in my config properties and as a -D parameter, but neither avoided the issue.

Build error when using Karyon as a dependency in Maven

Hey, this may be due to me being an idiot, but I'm running into a dependency error when I add Karyon to my project in Maven. The exact error is:

Could not resolve dependencies for project com.trottercashion.karyon-test:karyon-test:jar:0.0.1-SNAPSHOT: Failure to find com.google.code.findbugs:annotations:jar:1.3+ in http://repo.maven.apache.org/maven2

The only change I've made to my pom.xml from when it was working was adding the following to my <dependencies> element:

<dependency>
  <groupId>com.netflix.karyon</groupId>
  <artifactId>karyon-core</artifactId>
  <version>1.0.2</version>
</dependency>
<dependency>
  <groupId>com.netflix.karyon</groupId>
  <artifactId>karyon-admin-web</artifactId>
  <version>1.0.2</version>
</dependency>

Any ideas?

Consider making admin-ui hosting via embedded jetty an optional feature

Embedded Jetty may not always be the ideal way to host the admin ui. Consider dependencies on the jetty servlet api, colliding ports, etc.

Feature request: Make Jetty optional, and provide a second option for hosting via juice servlet instead. Would you accept a pull request for something like this?

Thanks,

Rob

Eliminate the necessity of using HealthCheckModule

Currently, the guice module HealthCheckModule is required to be used to bind an implementation of HealthCheckInvocationStrategy and HealthCheckHandler.
It will be nice to provide @ImplementedBy in both these interfaces pointing to default implementations.

Karyon manually creates ServerBootstrap via service locator pattern

Karyon currently requires the ServerBootstrap class to be specified via a property. It then internally allocates this via Class.newInstance(). Seeing as Karyon is already Guice-based it would be much better to have Guice inject the ServerBootstrap. This way, Karyon users can have injections into their ServerBootstrap instance.

Project should not use jersey-bundle

From the jersey-bundle description:

Such a bundle is only intended for developers that do not use Maven's dependency system.

Consider specifying exactly which Jersey dependencies are required.

Build on master is broken

Does this maybe have to do with the transition from 1.x to 2.0? It seems like some things from 2.0 have been merged but this may have gotten missed.

warning: [options] bootstrap class path not set in conjunction with -source 1.6
/Users/gorzell/dev/git/oss/gorzell-karyon/karyon-core/src/main/java/com/netflix/karyon/server/ServerBootstrap.java:34: error: package com.netflix.karyon.server.eureka does not exist
import com.netflix.karyon.server.eureka.EurekaHandler;
                                       ^
/Users/gorzell/dev/git/oss/gorzell-karyon/karyon-core/src/main/java/com/netflix/karyon/server/ServerBootstrap.java:153: error: cannot find symbol
            return EurekaHandler.class;
                   ^
  symbol:   class EurekaHandler
  location: class ServerBootstrap
2 errors
1 warning
:karyon-core:compileJava FAILED

Provide a way to use other ServiceRegistries instead of eureka

Currently, karyon is tightly coupled with eureka and there is no way to define a custom service registry.
It will help if the ServiceRegistry is abstracted and plugged in.

The basic idea will be a way to register/unregister with the registry, rest of the operations , if any, can be directly invoked by the application.

sensitive system and env properties may be exposed through karyon admin console

the jyst of the issue is that sensitive system properties are exposed . this is definitely a user error that can be locked down through AWS security groups and such, but i think it's significant enough to address with a workaround - perhaps a filtering mechanism to allow a developer to specify certain properties that are not accessible from this admin interface - or any REST interfaces into this admin service.

i noticed this when i went to open up port 8077 for the /healthcheck functionality. unfortunately, once i open that port, my AWS credentials are exposed because i pass them in as System props.

the other option is to allow a developer to lock down particular endpoints of the server listening at port 8077. in this case, i would allow /heathcheck, but not /adminres, for example.

i've documented this on the wiki at the following location: https://github.com/Netflix/karyon/wiki/Karyon-admin#access-control

Provide a way to intercept phases in karyon's initialization

There should be a way inside karyon to be able to do certain custom tasks at certain points in the initialization of karyon. eg: there is no way to do some custom logic between the time configuration is loaded and ServerBootstrap is initiated.
It will be nice to be able to define various phases in the initialization of karyon that the users can intercept and do custom bootstrapping/initialization.

Since, the initialization happens much before governator is initialized & karyon server itself does not get instantiated/managed by governator, governator's lifecycle listeners can not help here.

AdminResourceTest.testBasic() intermittently fails due to race condition...

response = client.execute(healthGet); can throw HttpHostConnectException because the servlet is not always available when the test is run. I need to get around this quickly, and was able to stopgap-fix with the following sleep hack. Ideally we can guard on "HealthServlet.isReady()" ... alternatively, perhaps the initializer can provide something like isReady() ?

@test
public void testBasic() throws Exception {
startServer();
HttpClient client = new DefaultHttpClient();
HttpGet healthGet = new HttpGet("http://localhost:" + AdminResourcesContainer.LISTEN_PORT_DEFAULT + "/healthcheck");

    HttpResponse response = null;
    try {
        response = client.execute(healthGet);
    } catch (HttpHostConnectException e) {
        Thread.sleep(1000);  // HACK!
        try {
            response = client.execute(healthGet);
        } catch (HttpHostConnectException e2) {
            throw e;
        }

    }

    Assert.assertEquals("admin resource health check failed.", 200, response.getStatusLine().getStatusCode());
}

Support executable jar's in Karyon 2.0

To support running Karyon based applications in environments like Docker containers it would be useful to package the application as either an executable jar, or as an archive containing a startup script and all the jars on which the application depends.

This means we would need an embedded container inside the application rather than deploying the app inside a container. As long as there is a main class which bootstraps the application, there are various ways of achieving the packaging -
a. Gradle's application plugin
b. Maven's shaded jar
c. Leiningen's uber-jar
d. One-Jar

@Component class not automatically @Singleton?

While developing my webapp using Karyon, I've noticed that component classes must also be marked as @Singleton to avoid being instantiated for each injection.

Is this intended behavior?

Thanks!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.