-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdeploy-pair-managed.sh
More file actions
executable file
Β·319 lines (264 loc) Β· 9.31 KB
/
deploy-pair-managed.sh
File metadata and controls
executable file
Β·319 lines (264 loc) Β· 9.31 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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
#!/bin/bash
# Stack Blog MVP Deployment Script for Pair Networks Managed Hosting
# Based on Method 3: Managed Hosting Deployment from INSTALLATION.md
set -e # Exit on any error
echo "π Starting Stack Blog MVP deployment to Pair Networks (Managed Hosting)..."
# Configuration
REMOTE_USER="certifiedhq"
REMOTE_HOST="certifiedhq.pairserver.com"
REMOTE_PATH="~/public_html/cpeio.online"
PASSWORD='&Fc%#%aTgsZ]P"2'
echo "π Deployment Configuration:"
echo " User: $REMOTE_USER"
echo " Host: $REMOTE_HOST"
echo " Remote Path: $REMOTE_PATH"
echo " Method: Managed Hosting (rsync + screen)"
echo "π Pre-deployment checks..."
# Check if we have the latest code
if [[ $(git status --porcelain) ]]; then
echo " β οΈ Warning: Uncommitted changes detected"
fi
# Check dependencies
if [ ! -d "node_modules" ]; then
echo " π¦ Installing local dependencies for build..."
npm install
fi
echo "π¦ Preparing deployment package..."
# Create temporary deployment directory
DEPLOY_DIR="/tmp/stack_blog_deploy_$(date +%s)"
mkdir -p "$DEPLOY_DIR"
# Copy application files (excluding development files)
echo " π Copying application files..."
rsync -av --progress \
--exclude='.git' \
--exclude='node_modules' \
--exclude='.env' \
--exclude='.env.local' \
--exclude='*.log' \
--exclude='__tests__' \
--exclude='.DS_Store' \
--exclude='deploy-*.sh' \
--exclude='.gitignore' \
--exclude='secrets/' \
"./" "$DEPLOY_DIR/"
# Copy production environment file
echo " π§ Setting up production environment..."
cp .env.production "$DEPLOY_DIR/.env"
echo "π Deploying to Pair Networks server..."
# Create deployment script on server
cat > "$DEPLOY_DIR/server-deploy.sh" << 'EOF'
#!/bin/bash
echo "π Setting up directory structure..."
mkdir -p logs content/pages content/media
echo "π¦ Installing production dependencies..."
npm ci --production
echo "π§ Setting file permissions..."
chmod -R 755 .
chmod -R 766 content/ logs/
echo "π― Creating default content if not exists..."
if [ ! -f "content/pages/index.md" ]; then
cat > content/pages/index.md << 'CONTENT'
---
title: "Welcome to Stack Blog MVP"
description: "Modern flat-file CMS with Ghost theme compatibility and RSS monetization"
author: "Stack Blog Team"
date: "2024-12-24"
featured: true
---
# Welcome to Stack Blog MVP π
Stack Blog MVP is now live on Pair Networks with full Ghost theme compatibility and RSS monetization features!
## Key Features
- **Ghost Theme Compatibility**: Use 1000+ existing Ghost themes
- **RSS Monetization**: Built-in sponsorship and analytics platform
- **Zero Database**: Pure flat-file architecture
- **Modern Admin**: Intuitive content management interface
- **Performance Optimized**: Sub-100ms response times
## Getting Started
Visit the [admin panel](/admin) to start creating content!
**Admin Credentials:**
- Username: admin
- Password: StackBlog2025!
CONTENT
fi
if [ ! -f "content/pages/blog/mvp-launch.md" ]; then
mkdir -p content/pages/blog
cat > content/pages/blog/mvp-launch.md << 'CONTENT'
---
title: "Stack Blog MVP Launch - Now with Ghost Themes & RSS Analytics"
description: "Announcing the launch of Stack Blog MVP with revolutionary Ghost theme compatibility and RSS monetization platform"
author: "Stack Blog Team"
date: "2024-12-24"
tags: ["announcement", "launch", "mvp", "ghost-themes", "rss"]
featured: true
---
# Stack Blog MVP is Live! π
We're excited to announce that Stack Blog MVP is now live and running on Pair Networks with groundbreaking features that set it apart from traditional CMS platforms.
## Revolutionary Features
### π¨ Ghost Theme Compatibility
- **1000+ Themes Available**: Use any existing Ghost theme
- **Seamless Migration**: Switch themes without losing content
- **Handlebars Engine**: Full Ghost helper compatibility
- **Theme Validation**: Built-in GScan integration
### π‘ RSS Monetization Platform
- **Sponsor Integration**: Built-in sponsorship management
- **Advanced Analytics**: Custom XML namespaces for tracking
- **Performance Metrics**: Real-time impression and click tracking
- **Revenue Dashboard**: Comprehensive monetization reporting
### β‘ Performance & Security
- **Sub-100ms Response**: Optimized for speed
- **Enterprise Security**: Production-grade protection
- **Template Caching**: LRU cache with TTL
- **Rate Limiting**: API protection built-in
## Technical Innovation
Stack Blog represents a new category of CMS: **Theme-Compatible Flat-File Systems**. We've solved the fundamental challenge of Ghost theme compatibility without requiring a database.
### Core Architecture
- **Dual Template Engines**: Nunjucks + Handlebars
- **Ghost Context Mapping**: Automatic data transformation
- **File-Based Storage**: Zero database dependencies
- **Modern Node.js**: Built on latest technologies
## Try It Now
- **Browse the Site**: You're already here!
- **Check RSS Feed**: [/rss.xml](/rss.xml) with enhanced analytics
- **Admin Interface**: [/admin](/admin) (login required)
- **API Endpoints**: [/api/status](/api/status) for system info
## What's Next
This MVP demonstrates the viability of our approach. We're proving that you can have:
- The theme ecosystem of Ghost
- The simplicity of flat-file systems
- Enterprise-grade monetization features
- All without database complexity
Welcome to the future of content management! π
CONTENT
fi
echo "π Stopping existing application..."
# Kill any existing Stack Blog processes
pkill -f "node.*app.js" || true
pkill -f "npm.*start" || true
# Wait for processes to stop
sleep 3
echo "π Starting Stack Blog MVP..."
# Start application with screen for persistence
screen -dmS stackblog node app.js
# Wait for startup
sleep 5
echo "π Checking application status..."
if pgrep -f "node.*app.js" > /dev/null; then
echo "β
Stack Blog MVP is running!"
echo "π Process info:"
pgrep -f "node.*app.js" | xargs ps -p
else
echo "β Application failed to start!"
echo "π Last 20 lines of log:"
tail -20 logs/app.log 2>/dev/null || echo "No log file found"
exit 1
fi
echo "π Testing connectivity..."
sleep 2
if curl -s -o /dev/null -w "%{http_code}" "http://localhost:3000/" | grep -q "200\|404"; then
echo "β
Application responding on port 3000"
else
echo "β Application not responding properly"
tail -10 logs/app.log 2>/dev/null || echo "No log file found"
fi
echo "β
Stack Blog MVP deployment completed!"
echo ""
echo "π― Important URLs:"
echo " Site: https://cpeio.online"
echo " Admin: https://cpeio.online/admin"
echo " RSS: https://cpeio.online/rss.xml"
echo " API: https://cpeio.online/api/status"
echo ""
echo "π Admin Access:"
echo " Username: admin"
echo " Password: StackBlog2025!"
echo ""
echo "π MVP Features Available:"
echo " β Ghost Theme Compatibility"
echo " β RSS Analytics & Monetization"
echo " β Enhanced Admin Interface"
echo " β Performance Optimization"
echo " β Enterprise Security"
EOF
chmod +x "$DEPLOY_DIR/server-deploy.sh"
# Upload files using rsync with expect for password automation
echo "π€ Uploading files to server..."
# Create expect script for automated password entry
cat > /tmp/deploy-expect.exp << EOF
#!/usr/bin/expect -f
set timeout 30
spawn rsync -avz --delete "$DEPLOY_DIR/" "$REMOTE_USER@$REMOTE_HOST:$REMOTE_PATH/"
expect {
"password:" {
send "$PASSWORD\r"
exp_continue
}
"yes/no" {
send "yes\r"
exp_continue
}
eof
}
EOF
# Check if expect is available
if command -v expect > /dev/null; then
chmod +x /tmp/deploy-expect.exp
/tmp/deploy-expect.exp
rm /tmp/deploy-expect.exp
else
echo "π Expect not available. Please run the following command manually:"
echo "rsync -avz --delete '$DEPLOY_DIR/' '$REMOTE_USER@$REMOTE_HOST:$REMOTE_PATH/'"
echo "Then connect via SSH and run: ./server-deploy.sh"
exit 1
fi
echo "π§ Running server deployment script..."
# Create expect script for SSH deployment
cat > /tmp/ssh-deploy.exp << EOF
#!/usr/bin/expect -f
set timeout 60
spawn ssh "$REMOTE_USER@$REMOTE_HOST" "cd $REMOTE_PATH && ./server-deploy.sh"
expect {
"password:" {
send "$PASSWORD\r"
exp_continue
}
"yes/no" {
send "yes\r"
exp_continue
}
eof
}
EOF
if command -v expect > /dev/null; then
chmod +x /tmp/ssh-deploy.exp
/tmp/ssh-deploy.exp
rm /tmp/ssh-deploy.exp
else
echo "π Please connect via SSH and run the deployment script:"
echo "ssh $REMOTE_USER@$REMOTE_HOST"
echo "cd $REMOTE_PATH"
echo "./server-deploy.sh"
fi
# Clean up deployment directory
echo "π§Ή Cleaning up..."
rm -rf "$DEPLOY_DIR"
echo ""
echo "π Stack Blog MVP Deployment Complete!"
echo ""
echo "π Deployment Summary:"
echo " β Latest MVP code deployed"
echo " β Production dependencies installed"
echo " β Application started with screen"
echo " β Default content created"
echo " β Connectivity verified"
echo ""
echo "π Next Steps:"
echo "1. Test the live site: https://cpeio.online"
echo "2. Access admin panel: https://cpeio.online/admin"
echo "3. Check RSS feed: https://cpeio.online/rss.xml"
echo "4. Run comprehensive testing plan"
echo ""
echo "π Server Management:"
echo " SSH: ssh $REMOTE_USER@$REMOTE_HOST"
echo " Check status: screen -list"
echo " View logs: tail -f $REMOTE_PATH/logs/app.log"
echo " Restart app: screen -S stackblog -X quit && screen -dmS stackblog node app.js"