Skip to content

Latest commit

 

History

History
118 lines (98 loc) · 2.68 KB

File metadata and controls

118 lines (98 loc) · 2.68 KB
description globs alwaysApply
Build and deployment guide for LocalSource application
*.md
docs/**/*.md
true

LocalSource Build Guide

  • Prerequisites

    • Node.js 20.x or later
    • npm 9.x or later
    • Tailscale installed and configured
    • Supabase account and project
    • PM2 (for development)
  • Environment Setup

    # ✅ DO: Clone and setup environment
    git clone <repository-url>
    cd LocalSource
    cp .env.example .env
    
    # ❌ DON'T: Commit .env file or sensitive credentials
    git add .env
    • Configure .env:
    # ✅ DO: Use proper environment variable names
    NEXT_PUBLIC_SUPABASE_URL=your_supabase_url
    NEXT_PUBLIC_SUPABASE_ANON_KEY=your_supabase_anon_key
    TS_AUTHKEY=your_tailscale_authkey
    
    # ❌ DON'T: Use hardcoded values or expose sensitive data
    SUPABASE_URL=https://example.supabase.co
  • Development Setup

    # ✅ DO: Use proper installation commands
    npm install
    sudo pm2 start npm --name "localsource" -- run dev
    
    # ✅ DO: Monitor application
    pm2 logs localsource
    pm2 monit
    
    # ✅ DO: Clean shutdown
    pm2 stop localsource
  • Production Build

    # ✅ DO: Build and verify
    npm run build
    npm run preview
  • Docker Deployment (Future)

    • Development environment with hot-reload
    • Production environment with nginx
    • Test environment for CI/CD
    • See Task #8 for Docker migration details
  • Automated Maintenance

    • Docker Cleanup (Weekly)
      # ✅ DO: Regular cleanup
      docker system prune -af --volumes
      docker image prune -a
    • Log Management
      # ✅ DO: Proper log rotation
      logrotate /etc/logrotate.d/localsource
    • System Health Monitoring
      # ✅ DO: Monitor system resources
      df -h | awk '{ if($5 > "80%") print $0 }'
      free -m | awk '/Mem:/ {print "Memory usage: " $3/$2 * 100 "%"}'
  • Troubleshooting

    # ✅ DO: Fix common permission issues
    sudo usermod -aG docker $USER
    sudo chown -R $USER:$USER ~/.pm2
    
    # ✅ DO: Clean node_modules properly
    rm -rf node_modules
    npm cache clean --force
    npm install
  • Log Locations

    • Application: ~/.pm2/logs/
    • Build: ./logs/build/
    • System: /var/log/
  • Support Resources

    • Documentation
    • Issue Tracker
    • Development Team
  • Contributing

    # ✅ DO: Follow proper branch workflow
    git checkout -b feature/your-feature
    npm test
    git push origin feature/your-feature

See dev_workflow.mdc for task-driven development process.

License

[License details here]