@gv-sh/specgen-app 0.13.3 → 0.15.0

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  # SpecGen App - Complete Platform
2
2
 
3
- [![Version](https://img.shields.io/badge/version-0.13.3-blue.svg)](https://github.com/gv-sh/specgen-app)
3
+ [![Version](https://img.shields.io/badge/version-0.15.0-blue.svg)](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 80 deployment with low memory usage.**
6
6
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gv-sh/specgen-app",
3
- "version": "0.13.3",
3
+ "version": "0.15.0",
4
4
  "description": "Complete SpecGen application with server, admin, and user interfaces",
5
5
  "main": "index.js",
6
6
  "bin": {
@@ -11,6 +11,18 @@ EC2_KEY="debanshu.pem"
11
11
  REPO_URL="https://github.com/gv-sh/specgen-app.git"
12
12
  APP_DIR="/home/ubuntu/specgen-app"
13
13
 
14
+ # Prompt for public IP address
15
+ echo "📡 Enter the public IP address or domain for your EC2 instance:"
16
+ echo " (e.g., 52.66.251.12 or your-domain.com)"
17
+ read -p "Public IP/Domain: " PUBLIC_IP
18
+
19
+ if [ -z "$PUBLIC_IP" ]; then
20
+ echo "❌ Public IP/Domain is required for proper frontend configuration!"
21
+ exit 1
22
+ fi
23
+
24
+ echo "✅ Using public address: $PUBLIC_IP"
25
+
14
26
  echo "🚀 SpecGen EC2 Remote Deployment Starting..."
15
27
  echo "📡 Target: $EC2_HOST"
16
28
 
@@ -46,24 +58,35 @@ echo "📦 Setting up dependencies..."
46
58
  run_on_ec2 "
47
59
  cd '$APP_DIR'
48
60
  npm run setup
49
-
50
- # Install cross-env in user directory
51
- cd user && npm install cross-env --save-dev && cd ..
52
61
  "
53
62
 
54
63
  echo "🏗️ Building applications..."
55
64
  run_on_ec2 "
56
65
  cd '$APP_DIR'
57
66
 
58
- # Build admin interface with correct public URL
67
+ # Build admin interface with correct public URL (admin appends /api to base URL)
59
68
  echo 'Building admin interface...'
60
- cd admin && PUBLIC_URL=/admin npm run build && cd ..
69
+ cd admin && PUBLIC_URL=/admin REACT_APP_API_URL='http://$PUBLIC_IP' npm run build && cd ..
61
70
 
62
- # Build user interface with production API URL
71
+ # Build user interface with production API URL (user interface appends /api to base URL)
63
72
  echo 'Building user interface...'
64
- cd user && cross-env REACT_APP_API_URL=/api npm run build && cd ..
73
+ cd user
74
+ # Install devDependencies including cross-env
75
+ npm install --include=dev
76
+ # Temporarily modify package.json to use correct base URL for production
77
+ sed -i 's|\"build\": \"cross-env REACT_APP_API_URL=/api react-scripts build\"|\"build\": \"cross-env REACT_APP_API_URL=http://$PUBLIC_IP react-scripts build\"|' package.json
78
+ npm run build
79
+ # Restore original package.json
80
+ git checkout package.json 2>/dev/null || true
81
+ cd ..
82
+
83
+ # Copy builds to server directory where Express expects them
84
+ echo 'Copying builds to server directory...'
85
+ mkdir -p server/admin server/user
86
+ cp -r admin/build server/admin/
87
+ cp -r user/build server/user/
65
88
 
66
- echo '✅ Builds completed'
89
+ echo '✅ Builds completed and copied to server'
67
90
  "
68
91
 
69
92
  echo "🔧 Configuring environment..."
@@ -103,7 +126,13 @@ EOF
103
126
  echo "🚀 Starting application..."
104
127
  run_on_ec2 "
105
128
  cd '$APP_DIR/server'
106
- npx pm2 start ecosystem.config.js
129
+
130
+ # Check if ecosystem.config.js exists in deploy directory, if not use index.js
131
+ if [ -f deploy/ecosystem.config.js ]; then
132
+ npx pm2 start deploy/ecosystem.config.js
133
+ else
134
+ npx pm2 start index.js --name specgen
135
+ fi
107
136
  "
108
137
 
109
138
  echo "⏳ Waiting for startup..."
@@ -116,10 +145,10 @@ if [ "$HEALTH_CHECK" = "healthy" ]; then
116
145
  echo "✅ Deployment successful!"
117
146
  echo ""
118
147
  echo "🌐 Access your application:"
119
- echo " User Interface: http://52.66.251.12/"
120
- echo " Admin Panel: http://52.66.251.12/admin"
121
- echo " API Documentation: http://52.66.251.12/api-docs"
122
- echo " Health Check: http://52.66.251.12/api/health"
148
+ echo " User Interface: http://$PUBLIC_IP/"
149
+ echo " Admin Panel: http://$PUBLIC_IP/admin"
150
+ echo " API Documentation: http://$PUBLIC_IP/api-docs"
151
+ echo " Health Check: http://$PUBLIC_IP/api/health"
123
152
  echo ""
124
153
  echo "📊 Server status:"
125
154
  run_on_ec2 "cd '$APP_DIR/server' && npx pm2 status"