create-lego-one 2.0.12 → 2.0.13
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/dist/index.cjs +34 -0
- package/dist/index.cjs.map +1 -1
- package/package.json +1 -1
- package/template/.cursor/rules/rules.mdc +639 -0
- package/template/.dockerignore +58 -0
- package/template/.env.example +18 -0
- package/template/.eslintignore +5 -0
- package/template/.eslintrc.js +28 -0
- package/template/.prettierignore +6 -0
- package/template/.prettierrc +11 -0
- package/template/CLAUDE.md +634 -0
- package/template/Dockerfile +67 -0
- package/template/PROMPT.md +457 -0
- package/template/README.md +325 -0
- package/template/docker-compose.yml +48 -0
- package/template/docker-entrypoint.sh +23 -0
- package/template/docs/checkpoints/.template.md +64 -0
- package/template/docs/checkpoints/framework/01-infrastructure-setup.md +132 -0
- package/template/docs/checkpoints/framework/02-pocketbase-setup.md +155 -0
- package/template/docs/checkpoints/framework/03-host-kernel.md +170 -0
- package/template/docs/checkpoints/framework/04-auth-system.md +163 -0
- package/template/docs/checkpoints/framework/phase-05-multitenancy-rbac.md +223 -0
- package/template/docs/checkpoints/framework/phase-06-ui-components.md +260 -0
- package/template/docs/checkpoints/framework/phase-07-communication-system.md +276 -0
- package/template/docs/checkpoints/framework/phase-08-plugin-system.md +91 -0
- package/template/docs/checkpoints/framework/phase-09-dashboard-plugin.md +111 -0
- package/template/docs/checkpoints/framework/phase-10-todo-plugin.md +169 -0
- package/template/docs/checkpoints/framework/phase-11-testing.md +264 -0
- package/template/docs/checkpoints/framework/phase-12-deployment.md +294 -0
- package/template/docs/checkpoints/framework/phase-13-documentation.md +312 -0
- package/template/docs/framework/plans/00-index.md +164 -0
- package/template/docs/framework/plans/01-infrastructure-setup.md +855 -0
- package/template/docs/framework/plans/02-pocketbase-setup.md +1374 -0
- package/template/docs/framework/plans/03-host-kernel.md +1518 -0
- package/template/docs/framework/plans/04-auth-system.md +1466 -0
- package/template/docs/framework/plans/05-multitenancy-rbac.md +1527 -0
- package/template/docs/framework/plans/06-ui-components.md +1478 -0
- package/template/docs/framework/plans/07-communication-system.md +1106 -0
- package/template/docs/framework/plans/08-plugin-system.md +1179 -0
- package/template/docs/framework/plans/09-dashboard-plugin.md +1137 -0
- package/template/docs/framework/plans/10-todo-plugin.md +1343 -0
- package/template/docs/framework/plans/11-testing.md +935 -0
- package/template/docs/framework/plans/12-deployment.md +896 -0
- package/template/docs/framework/prompts/0-boilerplate-modernjs.md +151 -0
- package/template/docs/framework/research/00-modernjs-audit.md +488 -0
- package/template/docs/framework/research/01-system-blueprint.md +721 -0
- package/template/docs/framework/research/02-data-migration-protocol.md +699 -0
- package/template/docs/framework/research/03-host-setup.md +714 -0
- package/template/docs/framework/research/04-plugin-architecture.md +645 -0
- package/template/docs/framework/research/05-slot-injection-pattern.md +671 -0
- package/template/docs/framework/research/06-cli-strategy.md +615 -0
- package/template/docs/framework/research/07-deployment.md +629 -0
- package/template/docs/framework/research/README.md +282 -0
- package/template/docs/framework/setup/00-index.md +210 -0
- package/template/docs/framework/setup/01-framework-structure.md +308 -0
- package/template/docs/framework/setup/02-development-workflow.md +405 -0
- package/template/docs/framework/setup/03-environment-setup.md +215 -0
- package/template/docs/framework/setup/04-kernel-architecture.md +499 -0
- package/template/docs/framework/setup/05-plugin-system.md +620 -0
- package/template/docs/framework/setup/06-communication-patterns.md +451 -0
- package/template/docs/framework/setup/07-plugin-development.md +582 -0
- package/template/docs/framework/setup/08-component-library.md +658 -0
- package/template/docs/framework/setup/09-data-integration.md +609 -0
- package/template/docs/framework/setup/10-auth-rbac.md +497 -0
- package/template/docs/framework/setup/11-hooks-api.md +393 -0
- package/template/docs/framework/setup/12-components-api.md +665 -0
- package/template/docs/framework/setup/13-deployment-guide.md +566 -0
- package/template/docs/framework/setup/README.md +548 -0
- package/template/host/package.json +1 -1
- package/template/nginx.conf +72 -0
- package/template/package.json +1 -1
- package/template/packages/plugins/@lego/plugin-dashboard/package.json +1 -1
- package/template/packages/plugins/@lego/plugin-todo/package.json +1 -1
- package/template/pocketbase/CHANGELOG.md +911 -0
- package/template/pocketbase/LICENSE.md +17 -0
- package/template/scripts/create-plugin.js +221 -0
- package/template/scripts/deploy.sh +56 -0
- package/template/tsconfig.base.json +26 -0
|
@@ -0,0 +1,566 @@
|
|
|
1
|
+
# Deployment Guide
|
|
2
|
+
|
|
3
|
+
**Production Deployment Instructions**
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Overview
|
|
8
|
+
|
|
9
|
+
This guide covers deploying the Lego-One SaaS boilerplate to various platforms. Lego-One can be deployed as Docker containers, directly to cloud platforms, or via traditional hosting.
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
## Prerequisites
|
|
14
|
+
|
|
15
|
+
Before deploying, ensure you have:
|
|
16
|
+
|
|
17
|
+
- Node.js 20+ installed
|
|
18
|
+
- pnpm package manager
|
|
19
|
+
- Docker (for containerized deployment)
|
|
20
|
+
- Git (for version control)
|
|
21
|
+
- Domain name (for production)
|
|
22
|
+
- SSL certificate (for HTTPS)
|
|
23
|
+
|
|
24
|
+
---
|
|
25
|
+
|
|
26
|
+
## Environment Setup
|
|
27
|
+
|
|
28
|
+
### Environment Variables
|
|
29
|
+
|
|
30
|
+
Create a `.env.production` file:
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
# PocketBase Configuration
|
|
34
|
+
VITE_POCKETBASE_URL=https://pb.yourdomain.com
|
|
35
|
+
|
|
36
|
+
# Application Configuration
|
|
37
|
+
VITE_APP_NAME=Your App Name
|
|
38
|
+
VITE_APP_URL=https://yourdomain.com
|
|
39
|
+
|
|
40
|
+
# Plugin Configuration
|
|
41
|
+
VITE_PLUGINS_ENABLED=true
|
|
42
|
+
|
|
43
|
+
# Feature Flags
|
|
44
|
+
VITE_ENABLE_DEVTOOLS=false
|
|
45
|
+
VITE_ENABLE_ANALYTICS=true
|
|
46
|
+
|
|
47
|
+
# External Services (Optional)
|
|
48
|
+
VITE_SENTRY_DSN=https://your-sentry-dsn
|
|
49
|
+
VITE_GA_ID=G-XXXXXXXXXX
|
|
50
|
+
VITE_STRIPE_PUBLIC_KEY=pk_live_xxxxx
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
### Build Configuration
|
|
54
|
+
|
|
55
|
+
Update `host/tsconfig.json` to exclude test files from production:
|
|
56
|
+
|
|
57
|
+
```json
|
|
58
|
+
{
|
|
59
|
+
"exclude": [
|
|
60
|
+
"node_modules",
|
|
61
|
+
"dist",
|
|
62
|
+
"**/__tests__",
|
|
63
|
+
"**/*.test.ts",
|
|
64
|
+
"**/*.test.tsx",
|
|
65
|
+
"**/*.spec.ts",
|
|
66
|
+
"**/*.spec.tsx",
|
|
67
|
+
"src/test"
|
|
68
|
+
]
|
|
69
|
+
}
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
---
|
|
73
|
+
|
|
74
|
+
## Docker Deployment
|
|
75
|
+
|
|
76
|
+
### Build Docker Image
|
|
77
|
+
|
|
78
|
+
```bash
|
|
79
|
+
docker build -t lego-one:latest .
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
### Run Container
|
|
83
|
+
|
|
84
|
+
```bash
|
|
85
|
+
docker run -d \
|
|
86
|
+
--name lego-one \
|
|
87
|
+
-p 80:80 \
|
|
88
|
+
-p 8090:8090 \
|
|
89
|
+
-v lego_pb_data:/data/pb \
|
|
90
|
+
-e VITE_POCKETBASE_URL=http://localhost:8090 \
|
|
91
|
+
lego-one:latest
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
### Docker Compose
|
|
95
|
+
|
|
96
|
+
```bash
|
|
97
|
+
# Start services
|
|
98
|
+
docker-compose up -d
|
|
99
|
+
|
|
100
|
+
# View logs
|
|
101
|
+
docker-compose logs -f
|
|
102
|
+
|
|
103
|
+
# Stop services
|
|
104
|
+
docker-compose down
|
|
105
|
+
|
|
106
|
+
# Rebuild and restart
|
|
107
|
+
docker-compose up -d --build
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
### Production Docker Compose
|
|
111
|
+
|
|
112
|
+
Create `docker-compose.prod.yml`:
|
|
113
|
+
|
|
114
|
+
```yaml
|
|
115
|
+
version: '3.8'
|
|
116
|
+
|
|
117
|
+
services:
|
|
118
|
+
app:
|
|
119
|
+
image: lego-one:latest
|
|
120
|
+
ports:
|
|
121
|
+
- "80:80"
|
|
122
|
+
- "8090:8090"
|
|
123
|
+
environment:
|
|
124
|
+
- VITE_POCKETBASE_URL=https://pb.yourdomain.com
|
|
125
|
+
- VITE_APP_NAME=Your App
|
|
126
|
+
- VITE_APP_URL=https://yourdomain.com
|
|
127
|
+
- VITE_ENABLE_DEVTOOLS=false
|
|
128
|
+
volumes:
|
|
129
|
+
- pb_data:/data/pb
|
|
130
|
+
restart: always
|
|
131
|
+
healthcheck:
|
|
132
|
+
test: ["CMD", "wget", "-q", "--spider", "http://localhost/80"]
|
|
133
|
+
interval: 30s
|
|
134
|
+
timeout: 10s
|
|
135
|
+
retries: 3
|
|
136
|
+
|
|
137
|
+
volumes:
|
|
138
|
+
pb_data:
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
---
|
|
142
|
+
|
|
143
|
+
## Cloud Platforms
|
|
144
|
+
|
|
145
|
+
### Vercel (Frontend Only)
|
|
146
|
+
|
|
147
|
+
Deploy the host application and plugins to Vercel:
|
|
148
|
+
|
|
149
|
+
```bash
|
|
150
|
+
# Install Vercel CLI
|
|
151
|
+
pnpm add -g vercel
|
|
152
|
+
|
|
153
|
+
# Deploy
|
|
154
|
+
vercel --prod
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
**vercel.json** configuration:
|
|
158
|
+
|
|
159
|
+
```json
|
|
160
|
+
{
|
|
161
|
+
"buildCommand": "pnpm run build",
|
|
162
|
+
"outputDirectory": "host/dist",
|
|
163
|
+
"rewrites": [
|
|
164
|
+
{ "source": "/api/:path*", "destination": "https://pb.yourdomain.com/:path*" }
|
|
165
|
+
]
|
|
166
|
+
}
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
### Railway (Full Stack)
|
|
170
|
+
|
|
171
|
+
1. Create a new project on Railway
|
|
172
|
+
2. Connect your GitHub repository
|
|
173
|
+
3. Configure environment variables
|
|
174
|
+
4. Deploy
|
|
175
|
+
|
|
176
|
+
**railway.json** configuration:
|
|
177
|
+
|
|
178
|
+
```json
|
|
179
|
+
{
|
|
180
|
+
"build": {
|
|
181
|
+
"builder": "NIXPACKS"
|
|
182
|
+
},
|
|
183
|
+
"deploy": {
|
|
184
|
+
"startCommand": "pnpm run start",
|
|
185
|
+
"healthcheckPath": "/"
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
### Render (Full Stack)
|
|
191
|
+
|
|
192
|
+
1. Create a new Web Service on Render
|
|
193
|
+
2. Connect your GitHub repository
|
|
194
|
+
3. Set build command: `pnpm run build`
|
|
195
|
+
4. Set start command: `pnpm run start`
|
|
196
|
+
5. Add environment variables
|
|
197
|
+
6. Deploy
|
|
198
|
+
|
|
199
|
+
### DigitalOcean App Platform
|
|
200
|
+
|
|
201
|
+
1. Create a new app
|
|
202
|
+
2. Choose your GitHub repository
|
|
203
|
+
3. Configure build and run settings
|
|
204
|
+
4. Add environment variables
|
|
205
|
+
5. Deploy
|
|
206
|
+
|
|
207
|
+
---
|
|
208
|
+
|
|
209
|
+
## Production Checklist
|
|
210
|
+
|
|
211
|
+
### Security
|
|
212
|
+
|
|
213
|
+
- [ ] Environment variables are set (not using defaults)
|
|
214
|
+
- [ ] HTTPS/SSL is enabled
|
|
215
|
+
- [ ] CORS is properly configured
|
|
216
|
+
- [ ] Rate limiting is enabled
|
|
217
|
+
- [ ] Security headers are set
|
|
218
|
+
- [ ] Database credentials are strong
|
|
219
|
+
- [ ] API tokens are rotated
|
|
220
|
+
- [ ] Sensitive data is encrypted
|
|
221
|
+
|
|
222
|
+
### Performance
|
|
223
|
+
|
|
224
|
+
- [ ] Static assets are cached
|
|
225
|
+
- [ ] Gzip/brotli compression is enabled
|
|
226
|
+
- [ ] Bundle size is optimized
|
|
227
|
+
- [ ] Images are optimized
|
|
228
|
+
- [ ] CDN is configured
|
|
229
|
+
- [ ] Database queries are optimized
|
|
230
|
+
- [ ] Caching strategy is implemented
|
|
231
|
+
|
|
232
|
+
### Monitoring
|
|
233
|
+
|
|
234
|
+
- [ ] Error tracking (Sentry) is configured
|
|
235
|
+
- [ ] Analytics (Google Analytics) is set up
|
|
236
|
+
- [ ] Logging is enabled
|
|
237
|
+
- [ ] Health checks are configured
|
|
238
|
+
- [ ] Uptime monitoring is active
|
|
239
|
+
- [ ] Performance monitoring is set up
|
|
240
|
+
|
|
241
|
+
### Backup
|
|
242
|
+
|
|
243
|
+
- [ ] Database backups are scheduled
|
|
244
|
+
- [ ] Backup restoration is tested
|
|
245
|
+
- [ ] Disaster recovery plan is documented
|
|
246
|
+
- [ ] Backups are stored off-site
|
|
247
|
+
|
|
248
|
+
### Documentation
|
|
249
|
+
|
|
250
|
+
- [ ] API documentation is up to date
|
|
251
|
+
- [ ] Deployment runbook is written
|
|
252
|
+
- [ ] On-call procedures are documented
|
|
253
|
+
- [ ] Architecture diagrams are current
|
|
254
|
+
|
|
255
|
+
---
|
|
256
|
+
|
|
257
|
+
## Monitoring & Maintenance
|
|
258
|
+
|
|
259
|
+
### Health Checks
|
|
260
|
+
|
|
261
|
+
Create a health check endpoint:
|
|
262
|
+
|
|
263
|
+
```typescript
|
|
264
|
+
// host/src/routes/HealthPage.tsx
|
|
265
|
+
export function HealthPage() {
|
|
266
|
+
return Response.json({
|
|
267
|
+
status: 'ok',
|
|
268
|
+
timestamp: new Date().toISOString(),
|
|
269
|
+
uptime: process.uptime(),
|
|
270
|
+
});
|
|
271
|
+
}
|
|
272
|
+
```
|
|
273
|
+
|
|
274
|
+
### Logging
|
|
275
|
+
|
|
276
|
+
Use structured logging:
|
|
277
|
+
|
|
278
|
+
```typescript
|
|
279
|
+
// host/src/lib/logger.ts
|
|
280
|
+
export const logger = {
|
|
281
|
+
info: (message: string, meta?: any) => {
|
|
282
|
+
console.log(JSON.stringify({ level: 'info', message, ...meta }));
|
|
283
|
+
},
|
|
284
|
+
error: (message: string, error?: Error) => {
|
|
285
|
+
console.error(JSON.stringify({
|
|
286
|
+
level: 'error',
|
|
287
|
+
message,
|
|
288
|
+
error: error?.stack,
|
|
289
|
+
}));
|
|
290
|
+
},
|
|
291
|
+
};
|
|
292
|
+
```
|
|
293
|
+
|
|
294
|
+
### Error Tracking
|
|
295
|
+
|
|
296
|
+
Set up Sentry:
|
|
297
|
+
|
|
298
|
+
```typescript
|
|
299
|
+
// host/src/sentry.ts
|
|
300
|
+
import * as Sentry from '@sentry/react';
|
|
301
|
+
|
|
302
|
+
Sentry.init({
|
|
303
|
+
dsn: import.meta.env.VITE_SENTRY_DSN,
|
|
304
|
+
environment: import.meta.env.MODE,
|
|
305
|
+
tracesSampleRate: 1.0,
|
|
306
|
+
});
|
|
307
|
+
```
|
|
308
|
+
|
|
309
|
+
### Performance Monitoring
|
|
310
|
+
|
|
311
|
+
Use Web Vitals:
|
|
312
|
+
|
|
313
|
+
```typescript
|
|
314
|
+
// host/src/lib/web-vitals.ts
|
|
315
|
+
import { onCLS, onFID, onFCP, onLCP, onTTFB } from 'web-vitals';
|
|
316
|
+
|
|
317
|
+
export function reportWebVitals() {
|
|
318
|
+
onCLS(console.log);
|
|
319
|
+
onFID(console.log);
|
|
320
|
+
onFCP(console.log);
|
|
321
|
+
onLCP(console.log);
|
|
322
|
+
onTTFB(console.log);
|
|
323
|
+
}
|
|
324
|
+
```
|
|
325
|
+
|
|
326
|
+
---
|
|
327
|
+
|
|
328
|
+
## Scaling Strategies
|
|
329
|
+
|
|
330
|
+
### Horizontal Scaling
|
|
331
|
+
|
|
332
|
+
Deploy multiple app instances behind a load balancer:
|
|
333
|
+
|
|
334
|
+
```nginx
|
|
335
|
+
upstream app {
|
|
336
|
+
server app1:80;
|
|
337
|
+
server app2:80;
|
|
338
|
+
server app3:80;
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
server {
|
|
342
|
+
location / {
|
|
343
|
+
proxy_pass http://app;
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
```
|
|
347
|
+
|
|
348
|
+
### Database Scaling
|
|
349
|
+
|
|
350
|
+
For high-traffic applications:
|
|
351
|
+
|
|
352
|
+
1. **External PostgreSQL** - Replace SQLite with PostgreSQL
|
|
353
|
+
2. **Connection Pooling** - Use PgBouncer
|
|
354
|
+
3. **Read Replicas** - Offload read queries
|
|
355
|
+
4. **Caching** - Add Redis for session/cache
|
|
356
|
+
|
|
357
|
+
### Caching Strategy
|
|
358
|
+
|
|
359
|
+
```typescript
|
|
360
|
+
// Cache API responses
|
|
361
|
+
const { data } = useQuery({
|
|
362
|
+
queryKey: ['todos'],
|
|
363
|
+
queryFn: fetchTodos,
|
|
364
|
+
staleTime: 5 * 60 * 1000, // 5 minutes
|
|
365
|
+
cacheTime: 10 * 60 * 1000, // 10 minutes
|
|
366
|
+
});
|
|
367
|
+
```
|
|
368
|
+
|
|
369
|
+
---
|
|
370
|
+
|
|
371
|
+
## CI/CD Pipeline
|
|
372
|
+
|
|
373
|
+
### GitHub Actions
|
|
374
|
+
|
|
375
|
+
Create `.github/workflows/deploy.yml`:
|
|
376
|
+
|
|
377
|
+
```yaml
|
|
378
|
+
name: Deploy
|
|
379
|
+
|
|
380
|
+
on:
|
|
381
|
+
push:
|
|
382
|
+
branches: [main]
|
|
383
|
+
|
|
384
|
+
jobs:
|
|
385
|
+
deploy:
|
|
386
|
+
runs-on: ubuntu-latest
|
|
387
|
+
steps:
|
|
388
|
+
- uses: actions/checkout@v3
|
|
389
|
+
|
|
390
|
+
- name: Setup Node.js
|
|
391
|
+
uses: actions/setup-node@v3
|
|
392
|
+
with:
|
|
393
|
+
node-version: '20'
|
|
394
|
+
|
|
395
|
+
- name: Install pnpm
|
|
396
|
+
uses: pnpm/action-setup@v2
|
|
397
|
+
with:
|
|
398
|
+
version: 8
|
|
399
|
+
|
|
400
|
+
- name: Install dependencies
|
|
401
|
+
run: pnpm install
|
|
402
|
+
|
|
403
|
+
- name: Run tests
|
|
404
|
+
run: pnpm test --run
|
|
405
|
+
|
|
406
|
+
- name: Build
|
|
407
|
+
run: pnpm run build
|
|
408
|
+
|
|
409
|
+
- name: Deploy to production
|
|
410
|
+
run: ./scripts/deploy.sh production
|
|
411
|
+
```
|
|
412
|
+
|
|
413
|
+
---
|
|
414
|
+
|
|
415
|
+
## Security Best Practices
|
|
416
|
+
|
|
417
|
+
### Keep Dependencies Updated
|
|
418
|
+
|
|
419
|
+
```bash
|
|
420
|
+
pnpm update
|
|
421
|
+
pnpm audit
|
|
422
|
+
```
|
|
423
|
+
|
|
424
|
+
### Use HTTPS Everywhere
|
|
425
|
+
|
|
426
|
+
- Redirect HTTP to HTTPS
|
|
427
|
+
- Use HSTS headers
|
|
428
|
+
|
|
429
|
+
### Implement Rate Limiting
|
|
430
|
+
|
|
431
|
+
```typescript
|
|
432
|
+
// Rate limit API endpoints
|
|
433
|
+
app.use('/api', rateLimit({
|
|
434
|
+
windowMs: 15 * 60 * 1000, // 15 minutes
|
|
435
|
+
max: 100 // limit each IP to 100 requests per windowMs
|
|
436
|
+
}));
|
|
437
|
+
```
|
|
438
|
+
|
|
439
|
+
### Sanitize User Input
|
|
440
|
+
|
|
441
|
+
```typescript
|
|
442
|
+
// Validate and sanitize input
|
|
443
|
+
const schema = z.object({
|
|
444
|
+
title: z.string().max(200).transform(s => s.trim())
|
|
445
|
+
});
|
|
446
|
+
```
|
|
447
|
+
|
|
448
|
+
### Implement CSRF Protection
|
|
449
|
+
|
|
450
|
+
- Use SameSite cookies
|
|
451
|
+
- Verify request origins
|
|
452
|
+
|
|
453
|
+
---
|
|
454
|
+
|
|
455
|
+
## Rollback Procedures
|
|
456
|
+
|
|
457
|
+
### Quick Rollback
|
|
458
|
+
|
|
459
|
+
```bash
|
|
460
|
+
# Docker
|
|
461
|
+
docker-compose down
|
|
462
|
+
docker-compose up -d --build
|
|
463
|
+
|
|
464
|
+
# Or revert to previous image
|
|
465
|
+
docker tag lego-one:previous lego-one:latest
|
|
466
|
+
docker-compose up -d
|
|
467
|
+
```
|
|
468
|
+
|
|
469
|
+
### Database Rollback
|
|
470
|
+
|
|
471
|
+
```bash
|
|
472
|
+
# Restore from backup
|
|
473
|
+
docker cp backup/pb_data/ container:/data/pb/
|
|
474
|
+
docker restart container
|
|
475
|
+
```
|
|
476
|
+
|
|
477
|
+
---
|
|
478
|
+
|
|
479
|
+
## Troubleshooting
|
|
480
|
+
|
|
481
|
+
### Build Issues
|
|
482
|
+
|
|
483
|
+
**Problem:** Build fails with TypeScript errors
|
|
484
|
+
|
|
485
|
+
**Solution:**
|
|
486
|
+
```bash
|
|
487
|
+
# Check TypeScript config
|
|
488
|
+
pnpm run typecheck
|
|
489
|
+
|
|
490
|
+
# Fix errors before building
|
|
491
|
+
```
|
|
492
|
+
|
|
493
|
+
### Runtime Issues
|
|
494
|
+
|
|
495
|
+
**Problem:** App loads but PocketBase connection fails
|
|
496
|
+
|
|
497
|
+
**Solution:**
|
|
498
|
+
1. Check `VITE_POCKETBASE_URL` is correct
|
|
499
|
+
2. Verify PocketBase is accessible
|
|
500
|
+
3. Check CORS settings on PocketBase
|
|
501
|
+
|
|
502
|
+
### Performance Issues
|
|
503
|
+
|
|
504
|
+
**Problem:** Slow page load times
|
|
505
|
+
|
|
506
|
+
**Solution:**
|
|
507
|
+
1. Analyze bundle size
|
|
508
|
+
2. Enable code splitting
|
|
509
|
+
3. Optimize images
|
|
510
|
+
4. Enable CDN
|
|
511
|
+
|
|
512
|
+
---
|
|
513
|
+
|
|
514
|
+
## Maintenance Tasks
|
|
515
|
+
|
|
516
|
+
### Daily
|
|
517
|
+
|
|
518
|
+
- Monitor error rates
|
|
519
|
+
- Check system health
|
|
520
|
+
- Review logs for issues
|
|
521
|
+
|
|
522
|
+
### Weekly
|
|
523
|
+
|
|
524
|
+
- Review analytics
|
|
525
|
+
- Check backup integrity
|
|
526
|
+
- Update dependencies
|
|
527
|
+
|
|
528
|
+
### Monthly
|
|
529
|
+
|
|
530
|
+
- Review and rotate secrets
|
|
531
|
+
- Audit user access
|
|
532
|
+
- Update documentation
|
|
533
|
+
- Performance review
|
|
534
|
+
|
|
535
|
+
### Quarterly
|
|
536
|
+
|
|
537
|
+
- Security audit
|
|
538
|
+
- Disaster recovery test
|
|
539
|
+
- Architecture review
|
|
540
|
+
- Cost optimization
|
|
541
|
+
|
|
542
|
+
---
|
|
543
|
+
|
|
544
|
+
## Cost Optimization
|
|
545
|
+
|
|
546
|
+
### Right-Sizing Resources
|
|
547
|
+
|
|
548
|
+
- Start with minimum resources
|
|
549
|
+
- Scale based on actual usage
|
|
550
|
+
- Use spot instances where possible
|
|
551
|
+
|
|
552
|
+
### Database Optimization
|
|
553
|
+
|
|
554
|
+
- Index frequently queried fields
|
|
555
|
+
- Archive old data
|
|
556
|
+
- Use connection pooling
|
|
557
|
+
|
|
558
|
+
### CDN Usage
|
|
559
|
+
|
|
560
|
+
- Cache static assets
|
|
561
|
+
- Use CDN for API responses
|
|
562
|
+
- Implement edge functions
|
|
563
|
+
|
|
564
|
+
---
|
|
565
|
+
|
|
566
|
+
**End of Deployment Guide**
|