AI Deployment Guide

    Deploy Leap.New Applications

    Leap.New has revolutionized the way we build and deploy modern web applications with its AI-powered development platform. Combined with RamNode's reliable VPS hosting, you can deploy your AI-generated applications with optimal performance and security. This guide will walk you through the entire process of deploying a Leap.New application on a RamNode VPS.

    Ubuntu 24.04+
    Leap.New AI Platform
    ⏱️ 30-45 minutes

    Prerequisites

    Before starting, ensure you have:

    Server Requirements

    • • RamNode VPS (Ubuntu 24.04+)
    • • SSH access to server with sudo privileges
    • • Domain name pointed to VPS IP

    Application Requirements

    • • Leap.New application ready for deployment
    • • Basic Linux command line knowledge
    • • Understanding of web deployment basics
    2

    Initial Server Setup

    Connect to your RamNode VPS and update the system:

    Connect via SSH
    ssh root@your-server-ip
    Update System Packages
    apt update && apt upgrade -y

    Create a dedicated user for your application:

    Create Application User
    adduser leapapp
    usermod -aG sudo leapapp
    su - leapapp

    💡 Tip: Replace "your-server-ip" with your actual RamNode VPS IP address.

    3

    Install Required Dependencies

    Install Node.js, Git, and PM2 for your Leap.New application:

    Install Node.js LTS
    curl -fsSL https://deb.nodesource.com/setup_lts.x | sudo -E bash -
    sudo apt-get install -y nodejs
    Verify Node.js Installation
    node --version
    npm --version
    Install Git and PM2
    sudo apt install git -y
    sudo npm install -g pm2

    ✅ All dependencies are now installed and ready for deployment.

    4

    Configure Firewall

    Configure UFW firewall to secure your server:

    Configure UFW Firewall
    sudo ufw allow ssh
    sudo ufw allow 80
    sudo ufw allow 443
    sudo ufw enable
    sudo ufw status

    ⚠️ Warning: Make sure SSH is allowed before enabling UFW to avoid losing access!

    5

    Install and Configure Nginx

    Install Nginx as a reverse proxy for your Leap.New application:

    Install Nginx
    sudo apt install nginx -y
    sudo systemctl start nginx
    sudo systemctl enable nginx

    Create Nginx configuration for your domain:

    Create Nginx Config File
    sudo nano /etc/nginx/sites-available/leapapp

    Add the following configuration (replace your-domain.com with your actual domain):

    Nginx Configuration
    server {
        listen 80;
        server_name your-domain.com www.your-domain.com;
    
        location / {
            proxy_pass http://localhost:3000;
            proxy_http_version 1.1;
            proxy_set_header Upgrade $http_upgrade;
            proxy_set_header Connection 'upgrade';
            proxy_set_header Host $host;
            proxy_set_header X-Real-IP $remote_addr;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_set_header X-Forwarded-Proto $scheme;
            proxy_cache_bypass $http_upgrade;
        }
    }
    Enable Nginx Site
    sudo ln -s /etc/nginx/sites-available/leapapp /etc/nginx/sites-enabled/
    sudo nginx -t
    sudo systemctl reload nginx
    6

    Deploy Your Leap.New Application

    Clone and prepare your Leap.New application for deployment:

    Clone Application Repository
    cd ~
    git clone https://github.com/yourusername/your-leap-app.git
    cd your-leap-app
    Install NPM Dependencies
    npm install

    Create environment configuration:

    Create Environment File
    nano .env
    Environment Variables Configuration
    NODE_ENV=production
    PORT=3000
    DATABASE_URL=your_database_url
    API_KEY=your_api_key
    # Add other Leap.New specific variables
    Build Application
    npm run build

    🔧 Note: Replace repository URL and environment variables with your actual values.

    7

    Set Up SSL with Let's Encrypt

    Secure your application with SSL certificates:

    Install Certbot
    sudo apt install certbot python3-certbot-nginx -y
    Obtain SSL Certificate
    sudo certbot --nginx -d your-domain.com -d www.your-domain.com

    🔒 Certbot will automatically configure SSL and update your Nginx configuration for HTTPS.

    8

    Start Your Application with PM2

    Configure PM2 to manage your application process:

    Create PM2 Ecosystem File
    nano ecosystem.config.js
    PM2 Configuration
    module.exports = {
      apps: [{
        name: 'leap-app',
        script: 'npm',
        args: 'start',
        cwd: '/home/leapapp/your-leap-app',
        env: {
          NODE_ENV: 'production',
          PORT: 3000
        },
        instances: 'max',
        exec_mode: 'cluster',
        watch: false,
        max_memory_restart: '1G',
        error_file: './logs/err.log',
        out_file: './logs/out.log',
        log_file: './logs/combined.log',
        time: true
      }]
    }
    Start Application with PM2
    mkdir logs
    pm2 start ecosystem.config.js
    pm2 save
    pm2 startup

    🚀 Your Leap.New application is now running with PM2 process management!

    9

    Database Setup (if required)

    Set up a database if your Leap.New application requires one:

    PostgreSQL Option

    Install PostgreSQL
    sudo apt install postgresql postgresql-contrib -y
    sudo systemctl start postgresql
    sudo systemctl enable postgresql

    MongoDB Option

    Install MongoDB
    wget -qO - https://www.mongodb.org/static/pgp/server-7.0.asc | sudo apt-key add -
    echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu jammy/mongodb-org/7.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-7.0.list
    sudo apt update && sudo apt install -y mongodb-org
    Create PostgreSQL Database
    sudo -u postgres psql
    CREATE DATABASE leapapp_db;
    CREATE USER leapapp_user WITH PASSWORD 'secure_password';
    GRANT ALL PRIVILEGES ON DATABASE leapapp_db TO leapapp_user;
    \q
    10

    Monitoring and Maintenance

    Set up monitoring and maintenance for your application:

    Create Log Rotation Config
    sudo nano /etc/logrotate.d/leapapp
    Logrotate Configuration
    /home/leapapp/your-leap-app/logs/*.log {
        daily
        missingok
        rotate 52
        compress
        notifempty
        create 644 leapapp leapapp
        postrotate
            pm2 reloadLogs
        endscript
    }
    Monitor with PM2
    pm2 monit
    pm2 logs leap-app
    pm2 status

    Create automated backup script:

    Create Backup Script
    nano ~/backup.sh
    Backup Script Content
    #!/bin/bash
    DATE=$(date +%Y%m%d_%H%M%S)
    BACKUP_DIR="/home/leapapp/backups"
    APP_DIR="/home/leapapp/your-leap-app"
    
    mkdir -p $BACKUP_DIR
    tar -czf $BACKUP_DIR/app_backup_$DATE.tar.gz -C $APP_DIR .
    pg_dump -U leapapp_user -h localhost leapapp_db > $BACKUP_DIR/db_backup_$DATE.sql
    find $BACKUP_DIR -name "*.tar.gz" -mtime +7 -delete
    Schedule Automated Backups
    chmod +x ~/backup.sh
    crontab -e
    # Add: 0 2 * * * /home/leapapp/backup.sh
    11

    Performance Optimization

    Optimize your deployment for better performance:

    Configure Nginx Compression
    sudo nano /etc/nginx/nginx.conf
    Gzip Configuration
    gzip on;
    gzip_vary on;
    gzip_min_length 1024;
    gzip_proxied expired no-cache no-store private must-revalidate auth;
    gzip_types text/plain text/css text/xml text/javascript application/javascript application/xml+rss application/json;

    Add caching headers to your Nginx server block:

    Static Asset Caching
    location ~* \.(jpg|jpeg|png|gif|ico|css|js)$ {
        expires 1M;
        add_header Cache-Control "public, immutable";
    }
    Node.js Memory Optimization
    // In your ecosystem.config.js
    node_args: ['--max-old-space-size=2048']

    ⚡ These optimizations will improve your application's loading speed and reduce server load.

    12

    Troubleshooting Common Issues

    Common issues and their solutions:

    Application Not Starting

    Debug Application Issues
    pm2 logs leap-app
    pm2 status
    npm install
    ls -la /home/leapapp/your-leap-app

    Nginx 502 Bad Gateway

    Debug Nginx Issues
    pm2 status
    sudo nginx -t
    sudo tail -f /var/log/nginx/error.log

    SSL Certificate Problems

    Debug SSL Issues
    sudo certbot certificates
    sudo certbot renew --dry-run
    sudo ufw status
    13

    Security Best Practices

    Essential security practices for production deployment:

    • Regular Updates: Keep Ubuntu, Node.js, and all packages updated
    • Fail2Ban: Install fail2ban to prevent brute force attacks
    • SSH Keys: Disable password authentication for SSH
    • Firewall Rules: Only allow necessary ports (22, 80, 443)
    • Regular Backups: Automate backups and test restore procedures
    • Monitor Logs: Set up log monitoring and alerts for security events

    🔒 Security Tip: Regularly audit your server, use strong passwords, and keep backups in multiple locations.

    Deployment Complete!

    🎉 Congratulations! You've successfully deployed your Leap.New application on a RamNode VPS with Ubuntu 24+. This setup provides you with full control over your hosting environment while leveraging the power of AI-driven development.

    Your application now runs efficiently, securely, and can scale as your needs grow. The combination of Nginx, PM2, SSL encryption, and proper monitoring ensures a production-ready environment.

    💡 Next Steps: Monitor your application's performance, keep your system updated, and maintain regular backups. Consider setting up monitoring alerts and scaling your infrastructure as your user base grows.