@gv-sh/specgen-app 0.6.4 โ 0.6.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/package.json +1 -1
- package/scripts/deploy.sh +74 -23
package/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# SpecGen App - Complete Platform
|
2
2
|
|
3
|
-
[](https://github.com/gv-sh/specgen-app)
|
4
4
|
|
5
5
|
A unified deployment package for the SpecGen speculative fiction generator platform. **Optimized for port 8080 deployment with low memory usage.**
|
6
6
|
|
package/package.json
CHANGED
package/scripts/deploy.sh
CHANGED
@@ -11,10 +11,9 @@ if [ "$1" = "--dry-run" ] || [ "$1" = "-d" ]; then
|
|
11
11
|
echo "๐ฅ๏ธ Platform: $(uname -s) $(uname -m)"
|
12
12
|
else
|
13
13
|
echo "๐ Deploying SpecGen to production on port 8080..."
|
14
|
+
echo "๐ฆ This is a complete deployment - no separate setup needed!"
|
14
15
|
fi
|
15
16
|
|
16
|
-
echo "๐ฆ This is a complete deployment - no separate setup needed!"
|
17
|
-
|
18
17
|
# Function to check if port is available
|
19
18
|
check_port() {
|
20
19
|
local port=$1
|
@@ -26,7 +25,13 @@ check_port() {
|
|
26
25
|
}
|
27
26
|
|
28
27
|
# Get absolute path of current working directory
|
29
|
-
|
28
|
+
# In dry-run, use the actual working directory, not NPX cache
|
29
|
+
if [ "$DRY_RUN" = true ]; then
|
30
|
+
PROJECT_DIR=$(pwd)
|
31
|
+
else
|
32
|
+
PROJECT_DIR=$(pwd)
|
33
|
+
fi
|
34
|
+
|
30
35
|
echo "๐ Project directory: $PROJECT_DIR"
|
31
36
|
|
32
37
|
# ========================================
|
@@ -74,6 +79,7 @@ if [ "$DRY_RUN" = false ]; then
|
|
74
79
|
rm -rf logs/* 2>/dev/null || true
|
75
80
|
else
|
76
81
|
echo "๐งช DRY RUN: Skipping cleanup (existing processes will remain)"
|
82
|
+
echo " This is a safe test that won't affect your system"
|
77
83
|
fi
|
78
84
|
|
79
85
|
# ========================================
|
@@ -82,18 +88,35 @@ fi
|
|
82
88
|
|
83
89
|
echo "๐ Checking prerequisites..."
|
84
90
|
|
85
|
-
# Check Node.js version
|
91
|
+
# Check Node.js version (more lenient for dry-run)
|
86
92
|
NODE_VERSION=$(node --version | sed 's/v//' | cut -d. -f1)
|
87
|
-
if [ "$
|
88
|
-
|
89
|
-
if [ "$
|
90
|
-
echo "
|
93
|
+
if [ "$DRY_RUN" = true ]; then
|
94
|
+
# More lenient for dry-run testing
|
95
|
+
if [ "$NODE_VERSION" -lt 18 ]; then
|
96
|
+
echo "โ Node.js 18+ required for testing. Current version: $(node --version)"
|
97
|
+
if [ "$PLATFORM" = "Darwin" ]; then
|
98
|
+
echo "Install with: brew install node"
|
99
|
+
fi
|
100
|
+
exit 1
|
91
101
|
else
|
92
|
-
echo "
|
102
|
+
echo "โ
Node.js version: $(node --version) (sufficient for testing)"
|
103
|
+
if [ "$NODE_VERSION" -lt 20 ]; then
|
104
|
+
echo " โ ๏ธ Note: Production deployment requires Node.js 20+"
|
105
|
+
fi
|
93
106
|
fi
|
94
|
-
exit 1
|
95
107
|
else
|
96
|
-
|
108
|
+
# Strict for production
|
109
|
+
if [ "$NODE_VERSION" -lt 20 ]; then
|
110
|
+
echo "โ Node.js 20+ required for production. Current version: $(node --version)"
|
111
|
+
if [ "$PLATFORM" = "Darwin" ]; then
|
112
|
+
echo "Install with: brew install node@20"
|
113
|
+
else
|
114
|
+
echo "Install with: curl -fsSL https://deb.nodesource.com/setup_20.x | sudo -E bash - && sudo apt-get install -y nodejs"
|
115
|
+
fi
|
116
|
+
exit 1
|
117
|
+
else
|
118
|
+
echo "โ
Node.js version: $(node --version)"
|
119
|
+
fi
|
97
120
|
fi
|
98
121
|
|
99
122
|
# Check npm
|
@@ -114,13 +137,19 @@ elif [ "$PLATFORM" = "Linux" ]; then
|
|
114
137
|
fi
|
115
138
|
fi
|
116
139
|
|
140
|
+
# Check if we have required tools
|
141
|
+
echo "โ
Platform tools:"
|
142
|
+
echo " curl: $(which curl >/dev/null && echo "available" || echo "missing")"
|
143
|
+
echo " tar: $(which tar >/dev/null && echo "available" || echo "missing")"
|
144
|
+
echo " lsof: $(which lsof >/dev/null && echo "available" || echo "missing")"
|
145
|
+
|
117
146
|
# ========================================
|
118
147
|
# SETUP OPENAI API KEY
|
119
148
|
# ========================================
|
120
149
|
|
121
150
|
echo "๐ Setting up OpenAI API key..."
|
122
151
|
|
123
|
-
# In dry-run mode, use a test key
|
152
|
+
# In dry-run mode, always use a test key
|
124
153
|
if [ "$DRY_RUN" = true ]; then
|
125
154
|
echo "๐งช DRY RUN: Using test API key"
|
126
155
|
mkdir -p "$PROJECT_DIR/server"
|
@@ -136,7 +165,7 @@ elif [ ! -f "$PROJECT_DIR/server/.env" ] || grep -q "your_openai_api_key_here" "
|
|
136
165
|
echo "PORT=8080" >> "$PROJECT_DIR/server/.env"
|
137
166
|
else
|
138
167
|
echo "โ ๏ธ OpenAI API key required for SpecGen to work."
|
139
|
-
echo "Enter your OpenAI API key (or press Enter to use test key
|
168
|
+
echo "Enter your OpenAI API key (or press Enter to use test key): "
|
140
169
|
read -r OPENAI_KEY
|
141
170
|
|
142
171
|
if [ -z "$OPENAI_KEY" ]; then
|
@@ -327,32 +356,42 @@ if [ "$DRY_RUN" = true ]; then
|
|
327
356
|
# Copy environment
|
328
357
|
cp "$PROJECT_DIR/server/.env" "$PROJECT_DIR/.env" 2>/dev/null || true
|
329
358
|
|
330
|
-
|
359
|
+
# Check if port 8080 is available for testing
|
360
|
+
if ! check_port 8080; then
|
361
|
+
echo " โ ๏ธ Port 8080 is in use, testing on port 8081 instead"
|
362
|
+
TEST_PORT=8081
|
363
|
+
sed -i.bak 's/PORT=8080/PORT=8081/' "$PROJECT_DIR/server/.env"
|
364
|
+
else
|
365
|
+
TEST_PORT=8080
|
366
|
+
fi
|
367
|
+
|
368
|
+
echo " Starting test server on port $TEST_PORT for 10 seconds..."
|
331
369
|
|
332
370
|
# Start server in background
|
333
|
-
(cd server && NODE_ENV=production PORT
|
371
|
+
(cd server && NODE_ENV=production PORT=$TEST_PORT node index.js) &
|
334
372
|
SERVER_PID=$!
|
335
373
|
|
336
374
|
# Wait a bit for server to start
|
337
375
|
sleep 3
|
338
376
|
|
339
377
|
# Test the endpoints
|
340
|
-
echo " Testing endpoints:"
|
378
|
+
echo " Testing endpoints on port $TEST_PORT:"
|
341
379
|
|
342
|
-
if curl -s http://localhost
|
380
|
+
if curl -s http://localhost:$TEST_PORT/api/health >/dev/null 2>&1; then
|
343
381
|
echo " โ
Health endpoint: OK"
|
344
|
-
|
382
|
+
HEALTH_RESPONSE=$(curl -s http://localhost:$TEST_PORT/api/health)
|
383
|
+
echo " Status: $(echo $HEALTH_RESPONSE | grep -o '"status":"[^"]*"' | cut -d'"' -f4)"
|
345
384
|
else
|
346
385
|
echo " โ Health endpoint: FAILED"
|
347
386
|
fi
|
348
387
|
|
349
|
-
HTTP_CODE=$(curl -s -o /dev/null -w "%{http_code}" http://localhost
|
388
|
+
HTTP_CODE=$(curl -s -o /dev/null -w "%{http_code}" http://localhost:$TEST_PORT/ 2>/dev/null || echo "000")
|
350
389
|
echo " ๐ Main page: HTTP $HTTP_CODE"
|
351
390
|
|
352
|
-
HTTP_CODE=$(curl -s -o /dev/null -w "%{http_code}" http://localhost
|
391
|
+
HTTP_CODE=$(curl -s -o /dev/null -w "%{http_code}" http://localhost:$TEST_PORT/admin 2>/dev/null || echo "000")
|
353
392
|
echo " โ๏ธ Admin page: HTTP $HTTP_CODE"
|
354
393
|
|
355
|
-
HTTP_CODE=$(curl -s -o /dev/null -w "%{http_code}" http://localhost
|
394
|
+
HTTP_CODE=$(curl -s -o /dev/null -w "%{http_code}" http://localhost:$TEST_PORT/app 2>/dev/null || echo "000")
|
356
395
|
echo " ๐ค User page: HTTP $HTTP_CODE"
|
357
396
|
|
358
397
|
# Stop test server
|
@@ -360,6 +399,11 @@ if [ "$DRY_RUN" = true ]; then
|
|
360
399
|
kill $SERVER_PID 2>/dev/null || true
|
361
400
|
wait $SERVER_PID 2>/dev/null || true
|
362
401
|
|
402
|
+
# Restore original .env if we changed it
|
403
|
+
if [ -f "$PROJECT_DIR/server/.env.bak" ]; then
|
404
|
+
mv "$PROJECT_DIR/server/.env.bak" "$PROJECT_DIR/server/.env"
|
405
|
+
fi
|
406
|
+
|
363
407
|
echo ""
|
364
408
|
echo "๐ DRY RUN COMPLETED!"
|
365
409
|
echo ""
|
@@ -369,10 +413,17 @@ if [ "$DRY_RUN" = true ]; then
|
|
369
413
|
echo " โ
React apps built successfully"
|
370
414
|
echo " โ
Server can start and respond"
|
371
415
|
echo ""
|
416
|
+
if [ "$NODE_VERSION" -lt 20 ]; then
|
417
|
+
echo "โ ๏ธ Note for AWS deployment:"
|
418
|
+
echo " Your Mac has Node.js $(node --version)"
|
419
|
+
echo " AWS deployment requires Node.js 20+"
|
420
|
+
echo " Make sure your AWS server has the right version"
|
421
|
+
echo ""
|
422
|
+
fi
|
372
423
|
echo "๐ Ready for production deployment!"
|
373
|
-
echo "
|
424
|
+
echo " Deploy to AWS with: npx @gv-sh/specgen-app deploy"
|
374
425
|
echo ""
|
375
|
-
echo "๐ง To test locally:"
|
426
|
+
echo "๐ง To test locally right now:"
|
376
427
|
echo " cd server && npm start"
|
377
428
|
echo " Open http://localhost:8080/"
|
378
429
|
|