Docker Deployment Guide

For licensed GEO Wiki Pro customers. Standard Docker deployment procedure for production environments.

> ⚠️ **Licensed Customers Only** > > This document is for customers who have **purchased a GEO Wiki Pro commercial license**. If you haven't purchased yet, please contact sales first: > > 📧 [[email protected]](mailto:[email protected]) > > After purchase, you'll receive: complete source code package, deployment documentation, technical support, version upgrades, and custom development. --- ## 📋 Prerequisites Ensure your server meets these requirements before deployment: | Requirement | Minimum | Recommended | |------|----------|----------| | OS | Linux (Ubuntu 22.04+ / CentOS 8+ / Debian 11+) | Ubuntu 22.04 LTS | | Docker | 20.10+ | 24.0+ | | Docker Compose | v2.0+ | v2.20+ | | CPU | 1 core | 2 cores+ | | Memory | 1GB | 2GB+ | | Disk Space | 500MB | 5GB+ (including backup) | | Bandwidth | 1 Mbps | 5 Mbps+ (depending on traffic) | > 💡 For server sizing recommendations or cloud provider discounts, contact [[email protected]](mailto:[email protected]). --- ## 🚀 Quick Deployment (4 Steps) ### Step 1: Upload and Extract Source Package Upload the source package you received after purchase to your server (via SFTP or scp), then extract: ```bash # Create project directory sudo mkdir -p /opt/geowiki-pro sudo chown $USER:$USER /opt/geowiki-pro # After uploading the source package, extract it cd /opt/geowiki-pro tar -xzf geowiki-pro-source.tar.gz # Verify extraction ls -la ``` ### Step 2: Configure Environment Variables ```bash # Copy environment template cp .env.example .env # Edit .env (required fields) nano .env ``` **Required configuration**: ```bash # JWT secret (at least 32 characters, generate with openssl) JWT_SECRET=<your-secure-random-secret> # Service port (default 3002, modify as needed) PORT=3002 # Data directory (use absolute path) DATA_DIR=/opt/geowiki-pro/data ``` **Generate a secure JWT secret**: ```bash openssl rand -base64 48 ``` ### Step 3: Start Services ```bash # Start all services (background) docker-compose up -d # Check status docker-compose ps # View real-time logs docker-compose logs -f ``` ### Step 4: Verify Deployment ```bash # Check API health curl https://your-domain.com/api/v1/health # Access admin panel # Open in browser: https://your-domain.com/admin # Default account: admin (you'll be forced to change the password on first login) ``` > ✅ If health check returns `{"success": true}`, deployment is successful! --- ## 🏗️ Architecture ### Service Components | Service | Port | Description | |------|------|------| | Web Frontend | 3002 | React SPA, document display | | API Service | 3002 (same) | Node.js backend, REST API | | Data Storage | - | File system (data/docs/, data/db.json) | Single-container deployment for simplified operations. --- ## ⚙️ Advanced Configuration ### Custom Port To change the default port (3002), edit `.env`: ```bash PORT=8080 ``` Also update port mapping in `docker-compose.yml`: ```yaml ports: - "8080:3002" # external:internal ``` ### Mount Data Directories For data safety and backup convenience, mount data directories to host: ```yaml volumes: - ./data:/app/data - ./public/media:/app/public/media - ./logs:/app/logs ``` ### Configure HTTPS (Recommended) HTTPS is strongly recommended for production. Two options: **Option A: Nginx Reverse Proxy + Let's Encrypt** ```nginx server { listen 443 ssl http2; server_name geowiki.pro; ssl_certificate /path/to/cert.pem; ssl_certificate_key /path/to/key.pem; location / { proxy_pass http://localhost:3002; proxy_set_header Host $host; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; } } ``` **Option B: Cloudflare Reverse Proxy** (zero-config SSL) Point your domain DNS to Cloudflare and enable proxy mode. --- ## 🔒 Security Configuration ### First Login 1. Log in with default account `admin` 2. **System will force you to change the password** (at least 8 characters) 3. Immediately update the default admin email in the admin panel ### Environment Variable Security ```bash # Set .env file permissions (owner read/write only) chmod 600 .env # Never commit .env to Git echo ".env" >> .gitignore ``` ### Rotate JWT Secret Regularly Rotate JWT secret every 90 days. Licensed customers can contact technical support for assistance. --- ## 🐛 Troubleshooting ### Container Startup Failure ```bash # View detailed logs docker-compose logs api # Common causes: # 1. JWT_SECRET not set in .env (must be at least 32 characters) # 2. Port in use: lsof -i :3002 # 3. Docker permission denied: sudo usermod -aG docker $USER ``` ### Data Backup ```bash # Manual backup (recommended with cron schedule) tar -czf backup-$(date +%Y%m%d).tar.gz data/ # Licensed customers: contact technical support for automated backup solutions ``` ### Upgrade to New Version ```bash # 1. Stop current services docker-compose down # 2. Backup data (important!) tar -czf backup-before-upgrade.tar.gz data/ # 3. Extract new source package tar -xzf geowiki-pro-vNEW.tar.gz # 4. Start new version docker-compose up -d # 5. Verify curl https://your-domain.com/api/v1/health ``` > 💡 Licensed customers can contact [[email protected]](mailto:[email protected]) for upgrade guides and compatibility notes. --- ## 📊 Monitoring & Maintenance ### Health Check ```bash # API health curl https://your-domain.com/api/v1/health # Docker container status docker-compose ps ``` ### Log Viewing ```bash # Real-time logs docker-compose logs -f # Last 100 lines docker-compose logs --tail=100 ``` ### Performance Monitoring Recommended tools: - **UptimeRobot** (free): HTTP health check + downtime alerts - **Prometheus + Grafana** (advanced): full metrics monitoring - Licensed customers: contact technical support for custom monitoring solutions --- ## 🆘 Technical Support ### Licensed Customer Support - 📧 **Email**: [[email protected]](mailto:[email protected]) - 📞 **Phone**: (Licensed customers only) - 💬 **WeChat Group**: (Invited after purchase) - 🕐 **Response Time**: 4 hours during business days ### Self-Service Resources - 📖 [User Manual](/docs/geo-wiki-pro-user-manual) - ❓ [FAQ](/docs/faq) - 🛠️ [CLI Tool](/docs/cli-reference) --- ## 📚 Next Steps After deployment, we recommend: 1. **Configure HTTPS** (security requirement) 2. **Set up automated backups** (data safety) 3. **Configure monitoring alerts** (availability) 4. **Join the licensed customer WeChat group** (support + version updates) 5. **Read the [User Manual](/docs/geo-wiki-pro-user-manual)** for more features Welcome to GEO Wiki Pro! Contact the sales team for any questions 🎉