geonetwork / geonetwork-microservices

GNU General Public License v2.0
13 stars 18 forks source link

Docker composition #16

Closed groldan closed 3 years ago

fxprunayre commented 3 years ago

@groldan should we add the routing app to the composition? https://github.com/geonetwork/geonetwork-microservices/blob/main/modules/services/routing/src/main/java/org/fao/geonet/routing/GnRoutingApp.java With that we could expose GN4, on the same entry point as services ?

Testing it, so far it works well. On GeoNetwork, there is some errors "mapLoadError" probably related to data directory config. I'm checking it.

fxprunayre commented 3 years ago

Testing it, so far it works well. On GeoNetwork, there is some errors "mapLoadError" probably related to data directory config. I'm checking it.

It is because we are using alpha1 for now. Will be fixed when 4.0.0 is released probably next week.

groldan commented 3 years ago

@groldan should we add the routing app to the composition? https://github.com/geonetwork/geonetwork-microservices/blob/main/modules/services/routing/src/main/java/org/fao/geonet/routing/GnRoutingApp.java With that we could expose GN4, on the same entry point as services ?

Done. Renamed as gateway-service and got the routes configured declaratively (see config/gateway-service.yml)

fxprunayre commented 3 years ago

@groldan I'm getting

gateway_1        | 2020-10-21 06:56:42.750 ERROR 1 --- [           main] o.s.boot.SpringApplication               : Application run failed
gateway_1        | 
gateway_1        | java.lang.IllegalStateException: No instances found of configserver (config-service)

I think it was ok the first time I started (not 100% sure) but now I've it. Any idea of what is wrong?

Config service startup looks ok

Attaching to gncloud_config_1
config_1         | Setting Active Processor Count to 8
config_1         | WARNING: Container memory limit unset. Configuring JVM for 1G container.
config_1         | Calculated JVM Memory Configuration: -XX:MaxDirectMemorySize=10M -Xmx410829K -XX:MaxMetaspaceSize=125746K -XX:ReservedCodeCacheSize=240M -Xss1M (Total Memory: 1G, Thread Count: 250, Loaded Class Count: 19787, Headroom: 0%)
config_1         | Adding 127 container CA certificates to JVM truststore
config_1         | Spring Cloud Bindings Enabled
config_1         | Picked up JAVA_TOOL_OPTIONS: -Djava.security.properties=/layers/paketo-buildpacks_bellsoft-liberica/java-security-properties/java-security.properties -agentpath:/layers/paketo-buildpacks_bellsoft-liberica/jvmkill/jvmkill-1.16.0-RELEASE.so=printHeapHistogram=1 -XX:ActiveProcessorCount=8 -XX:MaxDirectMemorySize=10M -Xmx410829K -XX:MaxMetaspaceSize=125746K -XX:ReservedCodeCacheSize=240M -Xss1M -Dorg.springframework.cloud.bindings.boot.enable=true
config_1         | 2020-10-21 06:03:16.311  WARN 1 --- [           main] o.s.boot.actuate.endpoint.EndpointId     : Endpoint ID 'bus-env' contains invalid characters, please migrate to a valid format.
config_1         | 2020-10-21 06:03:18.668  WARN 1 --- [           main] o.s.boot.actuate.endpoint.EndpointId     : Endpoint ID 'bus-refresh' contains invalid characters, please migrate to a valid format.
config_1         | 2020-10-21 06:03:19.780  WARN 1 --- [           main] o.s.boot.actuate.endpoint.EndpointId     : Endpoint ID 'service-registry' contains invalid characters, please migrate to a valid format.
config_1         | 2020-10-21 06:03:25.419  WARN 1 --- [           main] c.n.c.sources.URLConfigurationSource     : No URLs will be polled as dynamic configuration sources.
config_1         | 2020-10-21 06:03:25.431  WARN 1 --- [           main] c.n.c.sources.URLConfigurationSource     : No URLs will be polled as dynamic configuration sources.
config_1         | 2020-10-21 06:03:29.313  WARN 1 --- [           main] iguration$LoadBalancerCaffeineWarnLogger : Spring Cloud LoadBalancer is currently working with the default cache. You can switch to using Caffeine cache, by adding it to the classpath.
config_1         | WARNING: An illegal reflective access operation has occurred
config_1         | WARNING: Illegal reflective access by com.thoughtworks.xstream.core.util.Fields (file:/workspace/BOOT-INF/lib/xstream-1.4.11.1.jar) to field java.util.TreeMap.comparator
config_1         | WARNING: Please consider reporting this to the maintainers of com.thoughtworks.xstream.core.util.Fields
config_1         | WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
config_1         | WARNING: All illegal access operations will be denied in a future release
config_1         | 2020-10-21 06:03:31.766  WARN 1 --- [           main] c.n.discovery.InstanceInfoReplicator     : Ignoring onDemand update due to rate limiter
config_1         | Setting Active Processor Count to 8
config_1         | WARNING: Container memory limit unset. Configuring JVM for 1G container.
config_1         | Calculated JVM Memory Configuration: -XX:MaxDirectMemorySize=10M -Xmx410829K -XX:MaxMetaspaceSize=125746K -XX:ReservedCodeCacheSize=240M -Xss1M (Total Memory: 1G, Thread Count: 250, Loaded Class Count: 19787, Headroom: 0%)
config_1         | Adding 127 container CA certificates to JVM truststore
config_1         | Spring Cloud Bindings Enabled
config_1         | Picked up JAVA_TOOL_OPTIONS: -Djava.security.properties=/layers/paketo-buildpacks_bellsoft-liberica/java-security-properties/java-security.properties -agentpath:/layers/paketo-buildpacks_bellsoft-liberica/jvmkill/jvmkill-1.16.0-RELEASE.so=printHeapHistogram=1 -XX:ActiveProcessorCount=8 -XX:MaxDirectMemorySize=10M -Xmx410829K -XX:MaxMetaspaceSize=125746K -XX:ReservedCodeCacheSize=240M -Xss1M -Dorg.springframework.cloud.bindings.boot.enable=true
config_1         | 2020-10-21 06:56:07.489  WARN 1 --- [           main] o.s.boot.actuate.endpoint.EndpointId     : Endpoint ID 'bus-env' contains invalid characters, please migrate to a valid format.
config_1         | 2020-10-21 06:56:09.468  WARN 1 --- [           main] o.s.boot.actuate.endpoint.EndpointId     : Endpoint ID 'bus-refresh' contains invalid characters, please migrate to a valid format.
config_1         | 2020-10-21 06:56:10.279  WARN 1 --- [           main] o.s.boot.actuate.endpoint.EndpointId     : Endpoint ID 'service-registry' contains invalid characters, please migrate to a valid format.
config_1         | 2020-10-21 06:56:21.884  WARN 1 --- [           main] c.n.c.sources.URLConfigurationSource     : No URLs will be polled as dynamic configuration sources.
config_1         | 2020-10-21 06:56:21.968  WARN 1 --- [           main] c.n.c.sources.URLConfigurationSource     : No URLs will be polled as dynamic configuration sources.
config_1         | 2020-10-21 06:56:38.239  WARN 1 --- [           main] iguration$LoadBalancerCaffeineWarnLogger : Spring Cloud LoadBalancer is currently working with the default cache. You can switch to using Caffeine cache, by adding it to the classpath.
config_1         | WARNING: An illegal reflective access operation has occurred
config_1         | WARNING: Illegal reflective access by com.thoughtworks.xstream.core.util.Fields (file:/workspace/BOOT-INF/lib/xstream-1.4.11.1.jar) to field java.util.TreeMap.comparator
config_1         | WARNING: Please consider reporting this to the maintainers of com.thoughtworks.xstream.core.util.Fields
config_1         | WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
config_1         | WARNING: All illegal access operations will be denied in a future release
config_1         | 2020-10-21 06:56:45.289  WARN 1 --- [           main] c.n.discovery.InstanceInfoReplicator     : Ignoring onDemand update due to rate limiter

Also trying to run services manually, I can't get the config service to start - see https://github.com/groldan/geonetwork-microservices/commit/66464a533d37509e3726f1a503dd25114b694e16

groldan commented 3 years ago

I think it was ok the first time I started (not 100% sure) but now I've it. Any idea of what is wrong?

With all that's going during a full startup, the config-service just wasn't ready when a dependant service tried to contact it and timed out. You can just run docker-compose up -d again to relaunch all the ones that exited. Usually I use dockerize in the service command in docker-compose.yml to wait for required services to be ready before launching a given one. See for example https://github.com/camptocamp/geoserver-microservices/blob/master/docker-compose.yml#L121 Only trouble is since we're using the new buildpacks support in spring boot 2.3 to build the docker images instead of a regular Dockerfile, I don't yet know how to install dockerize in the target images.

fxprunayre commented 3 years ago

You can just run docker-compose up -d again to relaunch all the ones that exited.

Yes indeed. It works.

Also for starting another service as local, I've been using

SERVER_PORT=9901 mvn spring-boot:run -Dspring-boot.run.profiles=dev,local -f modules/services/searching

because it was trying to startup on 8080 which is used by geonetwork container.