chore: improve startup script and remove debug logging

- Use fuser instead of lsof for port cleanup
- Add wait loop for port release with timeout
- Properly disown background processes
- Redirect app output to log file
- Remove verbose TTS request logging

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Sunny 2026-01-26 06:56:22 +00:00
parent 9824a544b7
commit c286e3825f
2 changed files with 21 additions and 6 deletions

View file

@ -14,12 +14,27 @@ source "$SCRIPT_DIR/.env"
export GROQ_API_KEY
# Stop existing services
lsof -ti:8880 | xargs -r kill -9 2>/dev/null || true
lsof -ti:3003 | xargs -r kill -9 2>/dev/null || true
sleep 1
fuser -k 8880/tcp 2>/dev/null || true
fuser -k 3003/tcp 2>/dev/null || true
# Wait for ports to be released
for i in {1..10}; do
if ! fuser 3003/tcp 2>/dev/null; then
break
fi
echo "Waiting for port 3003 to be released..."
sleep 1
done
# Final check
if fuser 3003/tcp 2>/dev/null; then
echo "ERROR: Port 3003 still in use after 10 seconds"
exit 1
fi
# Start Groq TTS proxy (adds /voices endpoint for OpenReader)
nohup python3 "$SCRIPT_DIR/groq-tts-proxy.py" > /tmp/groq-proxy.log 2>&1 &
disown
sleep 2
# Verify proxy is running
@ -38,8 +53,10 @@ export API_KEY=none
export API_BASE=http://localhost:8880/v1
# Start the app
pnpm start &
nohup pnpm start > /tmp/openreader.log 2>&1 &
disown
echo "OpenReader WebUI started at http://localhost:3003"
echo "Groq TTS proxy running on port 8880"
echo "Available voices: troy, austin, daniel, autumn, diana, hannah"
echo "Logs: /tmp/openreader.log and /tmp/groq-proxy.log"

View file

@ -135,7 +135,6 @@ export async function POST(req: NextRequest) {
const body = (await req.json()) as TTSRequestPayload;
const { text, voice, speed, format, model: req_model, instructions } = body;
console.log('Received TTS request:', { provider, req_model, voice, speed, format, hasInstructions: Boolean(instructions) });
if (!text || !voice || !speed) {
const errorBody: TTSError = {
@ -222,7 +221,6 @@ export async function POST(req: NextRequest) {
}
});
}
console.log('TTS cache HIT for key:', cacheKey.slice(0, 8));
return new NextResponse(cachedBuffer, {
headers: {
'Content-Type': contentType,