odpi / egeria

Egeria core
https://egeria-project.org
Apache License 2.0
806 stars 261 forks source link

helm charts need to support developer debug #668

Closed planetf1 closed 5 years ago

planetf1 commented 5 years ago

When debugging a VDC environment we needed to attach to the debugger in one of the containers.

To do this we needed to modify a docker image to add appropriate JVM config, and add a service definition to expose the port outside the pod.

The process for doing this should be documented, and ideally we could add a simple configuration option to enable debug on a per-container basis. This is not for production, but rather to support the internal development usecase

planetf1 commented 5 years ago

Adding this for the egeria image

  1. New values:
    
    # Debug support for Egeria - set to true to enable JVM debug for Egeria images on port 5005
    debug:
    egeriaJVM: false

Logging level - affects all spring components by setting LOG_LEVEL_ROOT. Default to no DEBUG - Auditlog only

logging: level: NONE


2. Added support in Egeria Dockerfile to set JAVA_TOOL_OPTS if JAVA_DEBUG is set, hardcoded to port 5005, which is also exposed in Docker image

3. Updated helm templates to inject JAVA_DEBUG into the environment if the values setting is set.

The idea here is to
 * Ensure that by default we only show AUDIT log entries from kubectl logs - as debugging should be possible at this level
 * Allow for more logging to be enabled 
 * Make it easier to enable JVM debug -- for egeria only - to aid in the development process
cmgrote commented 5 years ago

Adding myself so I can remember to include in optimised images...

planetf1 commented 5 years ago

The launching of OMAG server has been modified to use an entrypoint script, since we need to evaluate environment variables at container run time.

With this in place, if no command is passed, the egeria server chassis is passed. However other commands can be used instead.

First with no parm and no debug

10:47 $ docker run -p 8080:8080 -p 5005:5005 planetf1/egeria-egeriavdc:1.1-SNAPSHOT
Picked up JAVA_TOOL_OPTIONS:
^[[B ODPi Egeria
    ____   __  ___ ___    ______   _____                                 ____   _         _     ___
   / __ \ /  |/  //   |  / ____/  / ___/ ___   ____ _   __ ___   ____   / _  \ / / __    / /  / _ /__   ____ _  _
  / / / // /|_/ // /| | / / __    \__ \ / _ \ / __/| | / // _ \ / __/  / /_/ // //   |  / _\ / /_ /  | /  _// || |
 / /_/ // /  / // ___ |/ /_/ /   ___/ //  __// /   | |/ //  __// /    /  __ // // /  \ / /_ /  _// / // /  / / / /
 \____//_/  /_//_/  |_|\____/   /____/ \___//_/    |___/ \___//_/    /_/    /_/ \__/\//___//_/   \__//_/  /_/ /_/

 :: Powered by Spring Boot (v2.1.2.RELEASE) ::

[0] 0:docker*

Here's an example with debug:

10:45 $ docker run -p 8080:8080 -p 5005:5005 -e JAVA_DEBUG=1 planetf1/egeria-egeriavdc:1.1-SNAPSHOT
Picked up JAVA_TOOL_OPTIONS: -agentlib:jdwp=transport=dt_socket,address=5005,server=y,suspend=n
Listening for transport dt_socket at address: 5005
 ODPi Egeria
    ____   __  ___ ___    ______   _____                                 ____   _         _     ___
   / __ \ /  |/  //   |  / ____/  / ___/ ___   ____ _   __ ___   ____   / _  \ / / __    / /  / _ /__   ____ _  _
  / / / // /|_/ // /| | / / __    \__ \ / _ \ / __/| | / // _ \ / __/  / /_/ // //   |  / _\ / /_ /  | /  _// || |
 / /_/ // /  / // ___ |/ /_/ /   ___/ //  __// /   | |/ //  __// /    /  __ // // /  \ / /_ /  _// / // /  / / / /
 \____//_/  /_//_/  |_|\____/   /____/ \___//_/    |___/ \___//_/    /_/    /_/ \__/\//___//_/   \__//_/  /_/ /_/

 :: Powered by Spring Boot (v2.1.2.RELEASE) ::

^C^CThu Feb 28 10:46:23 GMT 2019 OMAG server platform ready for configuration

And we can also run something else in the container if needed (like the UI directly)

10:52 $ docker run -p 8080:8080 -p 5005:5005 planetf1/egeria-egeriavdc:1.1-SNAPSHOT ls
CNAME
CODEOWNERS
CODE_OF_CONDUCT.md
CONTRIBUTING.md
Community-Guide.md
Content-Organization.md
Egeria-Operations.md
GOVERNANCE.md
LICENSE
MAINTAINERS.md
NOTICE
README.md
_config.yml
_layouts
assets
developer-resources
index.md
open-metadata-conformance-suite
open-metadata-distribution
open-metadata-implementation
open-metadata-publication
open-metadata-resources
open-metadata-test
pom.xml
repo
target
✔ ~/src/egeria/open-metadata-resources/open-metadata-deployment/docker/egeria [helm21|✚ 1…1⚑ 3]

See dist/docker-entrypoint.sh for the simple launch script, that so far only examines the JAVA_DEBUG variable, but could be enhanced in future

cmgrote commented 5 years ago

Working now / can be closed?

planetf1 commented 5 years ago

Yes. closing