@@ -21,6 +21,22 @@ mkdir -p "$CONFIG_DIR"
2121PID_FILE=" $CONFIG_DIR /runner.pid"
2222PORT_FILE=" $CONFIG_DIR /ui_port"
2323UI_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
2541if [ -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/
6480EOF
6581fi
6682
67- # Remove old generator UI env
83+ # Remove old generator UI env and log
6884rm -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 "
7188cd " $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 &
7592BACKEND_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 "
7895while [ ! -f " $BACKEND_DIR /aeron-cache-ui.env" ]; do
7996 sleep 1
8097done
8198
8299# Copy it to our user's config dir so they can inspect it and the frontend can use it
83100cp " $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
87104set -a
88105source " $UI_ENV_FILE "
@@ -91,22 +108,23 @@ set +a
91108# Find a free port starting from 3000
92109PORT=3000
93110while (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 ))
96113done
97114
98115echo $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 "
101118cd " $FRONTEND_DIR "
102- PORT=$PORT node server.js &
119+ PORT=$PORT node server.js >> " $LOG_FILE " 2>&1 &
103120FRONTEND_PID=$!
104121
105122echo
106123echo " ✅ Aeron Cache is running!"
107124echo " UI : http://localhost:$PORT "
108125echo " Backend : PID $BACKEND_PID "
109126echo " Config : $CONFIG_DIR "
127+ echo " Log : $LOG_FILE "
110128echo
111129echo " Press Ctrl+C to stop."
112130
0 commit comments