-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathquick-start.sh
More file actions
executable file
·103 lines (88 loc) · 2.65 KB
/
quick-start.sh
File metadata and controls
executable file
·103 lines (88 loc) · 2.65 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
#!/bin/bash
# Torimemo Quick Start Script
# Automatically sets up demo data and starts the server
set -e
echo "🚀 とりメモ (Torimemo) Quick Start"
echo "=================================="
echo ""
# Check if binary exists
if [ ! -f "./torimemo" ]; then
echo "📦 Building Torimemo..."
./build.sh
echo ""
fi
# Check if database exists
if [ ! -f "./torimemo.db" ]; then
echo "🌱 Setting up demo data..."
if [ ! -f "./seed" ]; then
echo "Building seed tool..."
go build -o seed ./cmd/seed
fi
./seed
echo ""
fi
# Check if port 8080 is available
if lsof -Pi :8080 -sTCP:LISTEN -t >/dev/null 2>&1; then
echo "⚠️ Port 8080 is already in use. Stopping existing process..."
pkill -f torimemo || true
sleep 2
fi
echo "🎯 Starting Torimemo server..."
echo ""
# Start the server in background
./torimemo &
SERVER_PID=$!
echo "✅ Server started with PID: $SERVER_PID"
echo ""
# Wait for server to be ready
echo "⏳ Waiting for server to be ready..."
for i in {1..10}; do
if curl -s http://localhost:8080/api/health > /dev/null 2>&1; then
break
fi
sleep 1
done
# Check if server is responding
if curl -s http://localhost:8080/api/health > /dev/null 2>&1; then
echo "🎉 Torimemo is ready!"
echo ""
echo "📊 Server Info:"
echo " • URL: http://localhost:8080"
echo " • API: http://localhost:8080/api/health"
echo " • Database: ./torimemo.db"
echo " • Process ID: $SERVER_PID"
echo ""
echo "📱 Features Available:"
echo " • 10+ demo bookmarks with tags"
echo " • Full-text search (try 'programming')"
echo " • Interactive tag cloud"
echo " • Advanced search filters"
echo " • Export/import functionality"
echo " • Analytics dashboard"
echo ""
echo "🛑 To stop: pkill -f torimemo"
echo "📖 Documentation: README.md"
echo ""
echo "🌐 Opening browser..."
# Try to open browser (works on most systems)
if command -v xdg-open > /dev/null; then
xdg-open http://localhost:8080
elif command -v open > /dev/null; then
open http://localhost:8080
elif command -v start > /dev/null; then
start http://localhost:8080
else
echo " Please open http://localhost:8080 in your browser"
fi
echo ""
echo "✨ Enjoy your blazingly fast bookmark manager!"
echo ""
# Keep script running to show logs
echo "📋 Server logs (Ctrl+C to exit):"
echo "================================"
wait $SERVER_PID
else
echo "❌ Server failed to start properly"
echo " Check the logs above for errors"
exit 1
fi