Skip to content

Commit

Permalink
Allow JMX debug (#536)
Browse files Browse the repository at this point in the history
  • Loading branch information
olevitt authored Dec 17, 2024
1 parent 165dbb3 commit 17f946e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,8 @@ Configurable properties :
| `logging.structured.format.console` | `` | Format for structured logging. Valid values : `ecs`, `gelf`, `logstash`. Leave empty for no structured logging (default). See https://docs.spring.io/spring-boot/reference/features/logging.html#features.logging.structured |
| `springdoc.swagger-ui.path` | `/` | Open API (swagger) UI path |
| `springdoc.swagger-ui.oauth.clientId` | `` | clientid used by swagger to authenticate the user, in general the same which is used by onyxia-ui is ok. |
| `DEBUG_JMX` | `` | Enable JMX monitoring. This is useful for profiling the app to improve performance but is not intended for production / daily use. Once enabled (`true`), use `kubectl port-forward` + a profiler (e.g VisualVM) to profile the app. |
| `JMX_PORT` | `10000` | Port used by JMX if enabled. |

## Onyxia API dependency to Helm

Expand Down
7 changes: 6 additions & 1 deletion onyxia-api/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,9 @@ if [[ -n "$CACERTS_DIR" ]]; then
fi

# Run application
java org.springframework.boot.loader.launch.JarLauncher
if [ -n "$DEBUG_JMX" ]; then
JMX_PORT="${JMX_PORT:-10000}"
java -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=$JMX_PORT -Dcom.sun.management.jmxremote.rmi.port=$JMX_PORT -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.local.only=false -Djava.rmi.server.hostname=127.0.0.1 org.springframework.boot.loader.launch.JarLauncher
else
java org.springframework.boot.loader.launch.JarLauncher
fi

0 comments on commit 17f946e

Please sign in to comment.