Skip to content

Commit 48d8923

Browse files
committed
Cleanup startup banners and logging for monolith
1 parent eaadf43 commit 48d8923

5 files changed

Lines changed: 31 additions & 8 deletions

File tree

cache-http/http-clustertools/src/main/java/com/bhf/aeroncache/clustertools/application/ClusterToolsHTTPApplication.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,7 @@ private static void runClusterTool(ClusterToolsRequest request, Context ctx, Str
136136
*/
137137
private static Consumer<JavalinConfig> getHTTPConfig(MicrometerPlugin micrometerPlugin) {
138138
return config -> {
139+
config.showJavalinBanner = false;
139140
config.bundledPlugins.enableCors(cors -> {
140141
cors.addRule(it -> {
141142
it.allowHost("http://localhost:3000",

cache-http/http-server-javalin/src/main/java/com/bhf/aeroncache/http/application/HttpApplication.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -360,6 +360,7 @@ private static Javalin startHTTPServer(int port) {
360360
new MicrometerPlugin(micrometerPluginConfig -> micrometerPluginConfig.registry = registry);
361361
var config = getHTTPConfig(micrometerPlugin);
362362

363+
363364
return Javalin.create(config)
364365
.beforeMatched(HttpApplication::checkClusterConnectivity)
365366
.before(API_PREFIX + "*", _ -> statsTracker.getTotalOpsCount().incrementAndGet())
@@ -546,6 +547,7 @@ private static void handleGetCachesRequest(Context context) {
546547
*/
547548
private static Consumer<JavalinConfig> getHTTPConfig(MicrometerPlugin micrometerPlugin) {
548549
return config -> {
550+
config.showJavalinBanner = false;
549551
config.bundledPlugins.enableCors(cors -> {
550552
cors.addRule(it -> {
551553
it.allowHost("http://localhost:3000",

cache-near/http-server-near-javalin/src/main/java/com/bhf/aeroncache/http/application/NearCacheApplication.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -354,6 +354,7 @@ private static void checkClusterConnectivity(Context ctx) {
354354
*/
355355
private static Consumer<JavalinConfig> getHTTPConfig(MicrometerPlugin micrometerPlugin) {
356356
return config -> {
357+
config.showJavalinBanner = false;
357358
config.bundledPlugins.enableCors(cors -> {
358359
cors.addRule(it -> {
359360
it.allowHost("http://localhost:3000", "http://localhost");

cache-ws/ws-server-javalin/src/main/java/com/bhf/aeroncache/ws/application/WebsocketApplication.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -449,6 +449,7 @@ private static void onMultiCacheConnect(WsConnectContext wsConnectContext) {
449449
*/
450450
private static Consumer<JavalinConfig> getHTTPConfig(MicrometerPlugin micrometerPlugin) {
451451
return config -> {
452+
config.showJavalinBanner = false;
452453
config.bundledPlugins.enableCors(cors -> {
453454
cors.addRule(it -> {
454455
it.allowHost("http://localhost:3000",

packaging/brew-runner.sh

Lines changed: 26 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,22 @@ mkdir -p "$CONFIG_DIR"
2121
PID_FILE="$CONFIG_DIR/runner.pid"
2222
PORT_FILE="$CONFIG_DIR/ui_port"
2323
UI_ENV_FILE="$CONFIG_DIR/aeron-cache-ui.env"
24+
LOG_FILE="$CONFIG_DIR/aeron-cache.log"
25+
26+
print_banner() {
27+
cat << "EOF"
28+
___ __________ ____ _ __ _________ ________ _________
29+
/ | / ____/ __ \/ __ \/ | / / / ____/ | / ____/ / / / ____/
30+
/ /| | / __/ / /_/ / / / / |/ / / / / /| |/ / / /_/ / __/
31+
/ ___ |/ /___/ _, _/ /_/ / /| / / /___/ ___ / /___/ __ / /___
32+
/_/ |_/_____/_/ |_|\____/_/ |_/ \____/_/ |_\____/_/ /_/_____/
33+
34+
https://github.com/bhf/aeron-cache
35+
EOF
36+
}
37+
38+
echo "Initializing Aeron Cache..."
39+
print_banner
2440

2541
if [ -f "$PID_FILE" ] && kill -0 $(cat "$PID_FILE") 2>/dev/null; then
2642
echo "⚡ Aeron Cache is already running (PID $(cat "$PID_FILE"))."
@@ -64,25 +80,26 @@ CLUSTER_FOLDER=node0/cluster/
6480
EOF
6581
fi
6682

67-
# Remove old generator UI env
83+
# Remove old generator UI env and log
6884
rm -f "$UI_ENV_FILE"
85+
rm -f "$LOG_FILE"
6986

70-
echo "🚀 Starting Aeron Cache Monolith backend..."
87+
echo "🚀 Starting Aeron Cache Monolith backend..." >> "$LOG_FILE"
7188
cd "$BACKEND_DIR"
7289
# Pass the user env config, then intercept the UI config output
7390
# Main.java generates aeron-cache-ui.env in the CWD, which is now $BACKEND_DIR
74-
"$BACKEND_DIR/run_with_env.sh" "$USER_ENV_FILE" "$@" &
91+
"$BACKEND_DIR/run_with_env.sh" "$USER_ENV_FILE" "$@" >> "$LOG_FILE" 2>&1 &
7592
BACKEND_PID=$!
7693

77-
echo "⏳ Waiting for UI environment file to be generated at $BACKEND_DIR/aeron-cache-ui.env..."
94+
echo "⏳ Waiting for UI environment file to be generated at $BACKEND_DIR/aeron-cache-ui.env..." >> "$LOG_FILE"
7895
while [ ! -f "$BACKEND_DIR/aeron-cache-ui.env" ]; do
7996
sleep 1
8097
done
8198

8299
# Copy it to our user's config dir so they can inspect it and the frontend can use it
83100
cp "$BACKEND_DIR/aeron-cache-ui.env" "$UI_ENV_FILE"
84101

85-
echo "🚀 Starting Aeron Cache UI frontend..."
102+
echo "🚀 Starting Aeron Cache UI frontend..." >> "$LOG_FILE"
86103
# Export variables for node server
87104
set -a
88105
source "$UI_ENV_FILE"
@@ -91,22 +108,23 @@ set +a
91108
# Find a free port starting from 3000
92109
PORT=3000
93110
while (echo >/dev/tcp/localhost/$PORT) >/dev/null 2>&1; do
94-
echo "⚠️ Port $PORT is in use, trying next..."
111+
echo "⚠️ Port $PORT is in use, trying next..." >> "$LOG_FILE"
95112
PORT=$((PORT + 1))
96113
done
97114

98115
echo $PORT > "$PORT_FILE"
99116

100-
echo "Starting Next.js standalone server on port $PORT..."
117+
echo "Starting Aeron Cache UI on port $PORT..." >> "$LOG_FILE"
101118
cd "$FRONTEND_DIR"
102-
PORT=$PORT node server.js &
119+
PORT=$PORT node server.js >> "$LOG_FILE" 2>&1 &
103120
FRONTEND_PID=$!
104121

105122
echo
106123
echo "✅ Aeron Cache is running!"
107124
echo " UI : http://localhost:$PORT"
108125
echo " Backend : PID $BACKEND_PID"
109126
echo " Config : $CONFIG_DIR"
127+
echo " Log : $LOG_FILE"
110128
echo
111129
echo "Press Ctrl+C to stop."
112130

0 commit comments

Comments
 (0)