Невозможно запустить ZUUL (шлюз netflix) в GCP в качестве док-контейнера - PullRequest
0 голосов
/ 20 сентября 2019

Я пытаюсь собрать ZUUL с использованием Jenkins и развернуть его в док-контейнере в GCP compute engine.Я успешно запустил и собрал образ в Docker и смог запустить образ через несколько минут после выхода из контейнера, найти приведенный ниже журнал, я не могу получить ни одного журнала ошибок.

,2019-09-20 18:07:32.688  INFO 1 --- [           main] f.a.AutowiredAnnotationBeanPostProcessor : JSR-330 'javax.inject.Inject' annotation found and supported for autowiring
,2019-09-20 18:07:32.904  INFO 1 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'configurationPropertiesRebinderAutoConfiguration' of type [org.springframework.cloud.autoconfigure.ConfigurationPropertiesRebinderAutoConfiguration$$EnhancerBySpringCGLIB$$9cc787e7] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
,
,  .   ____          _            __ _ _
, /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
,( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
, \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
,  '  |____| .__|_| |_|_| |_\__, | / / / /
, =========|_|==============|___/=/_/_/_/
, :: Spring Boot ::        (v2.0.1.RELEASE)
,
,2019-09-20 18:07:34.356  INFO 1 --- [           main] i.s.b.ZuulGatewayExampleApplication      : No active profile set, falling back to default profiles: default
,2019-09-20 18:07:34.427  INFO 1 --- [           main] ConfigServletWebServerApplicationContext : Refreshing org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext@5e955596: startup date [Fri Sep 20 18:07:34 GMT 2019]; parent: org.springframework.context.annotation.AnnotationConfigApplicationContext@71f2a7d5
,2019-09-20 18:07:36.967  INFO 1 --- [           main] o.s.b.f.s.DefaultListableBeanFactory     : Overriding bean definition for bean 'counterFactory' with a different definition: replacing [Root bean: class [null]; scope=; abstract=false; lazyInit=false; autowireMode=3; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=org.springframework.cloud.netflix.zuul.ZuulServerAutoConfiguration$ZuulMetricsConfiguration; factoryMethodName=counterFactory; initMethodName=null; destroyMethodName=(inferred); defined in class path resource [org/springframework/cloud/netflix/zuul/ZuulServerAutoConfiguration$ZuulMetricsConfiguration.class]] with [Root bean: class [null]; scope=; abstract=false; lazyInit=false; autowireMode=3; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=org.springframework.cloud.netflix.zuul.ZuulServerAutoConfiguration$ZuulCounterFactoryConfiguration; factoryMethodName=counterFactory; initMethodName=null; destroyMethodName=(inferred); defined in class path resource [org/springframework/cloud/netflix/zuul/ZuulServerAutoConfiguration$ZuulCounterFactoryConfiguration.class]]
,2019-09-20 18:07:37.972  INFO 1 --- [           main] o.s.cloud.context.scope.GenericScope     : BeanFactory id=c886e3ef-417b-3505-aabf-ccd428d6a56b
,2019-09-20 18:07:38.046  INFO 1 --- [           main] f.a.AutowiredAnnotationBeanPostProcessor : JSR-330 'javax.inject.Inject' annotation found and supported for autowiring
,2019-09-20 18:07:38.858  INFO 1 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.cloud.autoconfigure.ConfigurationPropertiesRebinderAutoConfiguration' of type [org.springframework.cloud.autoconfigure.ConfigurationPropertiesRebinderAutoConfiguration$$EnhancerBySpringCGLIB$$9cc787e7] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
,2019-09-20 18:07:39.885  INFO 1 --- [           main] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat initialized with port(s): 8082 (http)
,2019-09-20 18:07:39.970  INFO 1 --- [           main] o.apache.catalina.core.StandardService   : Starting service [Tomcat]
,2019-09-20 18:07:39.971  INFO 1 --- [           main] org.apache.catalina.core.StandardEngine  : Starting Servlet Engine: Apache Tomcat/8.5.29
,2019-09-20 18:07:40.018  INFO 1 --- [ost-startStop-1] o.a.catalina.core.AprLifecycleListener   : The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: [/usr/lib/jvm/java-1.8-openjdk/jre/lib/amd64/server:/usr/lib/jvm/java-1.8-openjdk/jre/lib/amd64:/usr/lib/jvm/java-1.8-openjdk/jre/../lib/amd64:/usr/java/packages/lib/amd64:/usr/lib64:/lib64:/lib:/usr/lib]
,2019-09-20 18:07:40.264  INFO 1 --- [ost-startStop-1] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring embedded WebApplicationContext
,2019-09-20 18:07:40.270  INFO 1 --- [ost-startStop-1] o.s.web.context.ContextLoader            : Root WebApplicationContext: initialization completed in 5845 ms
,2019-09-20 18:07:41.229  WARN 1 --- [ost-startStop-1] c.n.c.sources.URLConfigurationSource     : No URLs will be polled as dynamic configuration sources.
,2019-09-20 18:07:41.235  INFO 1 --- [ost-startStop-1] c.n.c.sources.URLConfigurationSource     : To enable URLs as dynamic configuration sources, define System property archaius.configurationSource.additionalUrls or make config.properties available on classpath.
,2019-09-20 18:07:41.311  INFO 1 --- [ost-startStop-1] c.netflix.config.DynamicPropertyFactory  : DynamicPropertyFactory is initialized with configuration sources: com.netflix.config.ConcurrentCompositeConfiguration@5bed22e4
,2019-09-20 18:07:44.808  INFO 1 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'characterEncodingFilter' to: [/*]
,2019-09-20 18:07:44.811  INFO 1 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'hiddenHttpMethodFilter' to: [/*]
,2019-09-20 18:07:44.812  INFO 1 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'httpPutFormContentFilter' to: [/*]
,2019-09-20 18:07:44.812  INFO 1 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'requestContextFilter' to: [/*]
,2019-09-20 18:07:44.815  INFO 1 --- [ost-startStop-1] .s.DelegatingFilterProxyRegistrationBean : Mapping filter: 'springSecurityFilterChain' to: [/*]
,2019-09-20 18:07:44.817  INFO 1 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'httpTraceFilter' to: [/*]
,2019-09-20 18:07:44.817  INFO 1 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'webMvcMetricsFilter' to: [/*]
,2019-09-20 18:07:44.819  INFO 1 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'corsFilter' to: [/*]
,2019-09-20 18:07:44.820  INFO 1 --- [ost-startStop-1] o.s.b.w.servlet.ServletRegistrationBean  : Servlet dispatcherServlet mapped to [/]
,2019-09-20 18:07:44.822  INFO 1 --- [ost-startStop-1] o.s.b.w.servlet.ServletRegistrationBean  : Servlet zuulServlet mapped to [/zuul/*]
,2019-09-20 18:07:45.136  WARN 1 --- [           main] c.n.c.sources.URLConfigurationSource     : No URLs will be polled as dynamic configuration sources.
,2019-09-20 18:07:45.145  INFO 1 --- [           main] c.n.c.sources.URLConfigurationSource     : To enable URLs as dynamic configuration sources, define System property archaius.configurationSource.additionalUrls or make config.properties available on classpath.
,2019-09-20 18:07:45.434  INFO 1 --- [           main] o.s.w.s.handler.SimpleUrlHandlerMapping  : Mapped URL path [/**/favicon.ico] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
,2019-09-20 18:07:46.101  INFO 1 --- [           main] s.w.s.m.m.a.RequestMappingHandlerAdapter : Looking for @ControllerAdvice: org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext@5e955596: startup date [Fri Sep 20 18:07:34 GMT 2019]; parent: org.springframework.context.annotation.AnnotationConfigApplicationContext@71f2a7d5,

Найти код Dockerfileниже.

FROM openjdk:8-jdk-alpine

ADD target/zuul-gateway.jar zuul-gateway.jar
CMD ["java","-jar","/zuul-gateway.jar"]

EXPOSE 8082/tcp

Найдите код Java ниже

@SpringBootApplication
@EnableDiscoveryClient

@ Открытый класс EnableZuulProxy ZuulGatewayExampleApplication {

public static void main(String[] args) {
    SpringApplication.run(ZuulGatewayExampleApplication.class, args);
}@Bean
public WebServerFactoryCustomizer<TomcatServletWebServerFactory> 
    containerCustomizer(){
    return new EmbeddedTomcatCustomizer();
}

private static class EmbeddedTomcatCustomizer implements 
WebServerFactoryCustomizer<TomcatServletWebServerFactory> {

    @Override
    public void customize(TomcatServletWebServerFactory factory) {
        factory.addConnectorCustomizers((TomcatConnectorCustomizer) connector -> {
            connector.setAttribute("relaxedPathChars", "<>[\\]^`{|}");
            connector.setAttribute("relaxedQueryChars", "<>[\\]^`{|}");
        });
    }
}

Найдите файл YML

server:
tomcat:
max-threads: 7000
port: 8082 

пружина: приложение: имя: zuul-gateway

 eureka:
     client:
       serviceUrl:
          defaultZone: http://eureka:8082/eureka
 instance:
     prefer-ip-address: true
        jmx:
         enabled: false
           servlet:
             multipart:
            max-file-size: 45Mb
            max-request-size: 45Mb
     ribbon:
        eureka:
          enabled: true
            ReadTimeout: 10000
             ConnectTimeout: 10000         
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...