AI Systems Deployment

    Deploy Base44 on RamNode VPS

    Complete guide to deploying a Base44 application on RamNode VPS, from initial server setup to production deployment with SSL, PM2 process management, and Nginx reverse proxy configuration.

    Node.js 20+
    PM2 & Nginx
    ⏱️ 30-40 minutes

    Prerequisites

    • RamNode VPS account with a provisioned server
    • SSH access to your VPS
    • Domain name (optional, but recommended)
    • Base44 application code repository

    Recommended VPS Plans

    For optimal Base44 application performance, we recommend:

    Standard VPS

    Perfect for development and small production deployments

    2GB RAM or higher

    Premium VPS

    Best for production workloads with high traffic

    4GB RAM or higher
    1

    Initial Server Setup

    Connect to Your VPS

    SSH Connection
    ssh root@your_server_ip

    Update System Packages

    System Update
    apt update && apt upgrade -y

    Create a Non-Root User

    Create User
    adduser base44deploy
    usermod -aG sudo base44deploy

    Set Up SSH Key Authentication (Recommended)

    On your local machine:

    Copy SSH Key
    ssh-copy-id base44deploy@your_server_ip
    2

    Install Required Dependencies

    Install Node.js and npm

    Node.js Installation
    curl -fsSL https://deb.nodesource.com/setup_20.x | sudo -E bash -
    sudo apt install -y nodejs

    Verify installation:

    Verify Node.js
    node --version
    npm --version

    Install Git

    Git Installation
    sudo apt install -y git

    Install PM2 (Process Manager)

    PM2 Installation
    sudo npm install -g pm2

    Install Nginx (Web Server)

    Nginx Installation
    sudo apt install -y nginx
    3

    Configure Firewall

    Configure UFW firewall to secure your VPS while allowing necessary traffic:

    Firewall Configuration
    sudo ufw allow OpenSSH
    sudo ufw allow 'Nginx Full'
    sudo ufw enable
    4

    Deploy Your Base44 Application

    Clone Your Repository

    Clone Repository
    cd /home/base44deploy
    git clone https://github.com/yourusername/your-base44-app.git
    cd your-base44-app

    Install Application Dependencies

    Install Dependencies
    npm install

    Set Up Environment Variables

    Create a .env file:

    Create .env File
    nano .env

    Add your environment variables:

    .env Configuration
    NODE_ENV=production
    PORT=3000
    DATABASE_URL=your_database_connection_string
    API_KEY=your_api_key

    Build Your Application (if needed)

    Build Application
    npm run build

    Start Application with PM2

    Start with PM2
    pm2 start npm --name "base44-app" -- start
    pm2 save
    pm2 startup

    This ensures your app restarts automatically after server reboots.

    5

    Configure Nginx as Reverse Proxy

    Create Nginx Configuration

    Create Config File
    sudo nano /etc/nginx/sites-available/base44-app

    Add the following configuration:

    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_cache_bypass $http_upgrade;
            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;
        }
    }

    Enable the Site

    Enable Nginx Site
    sudo ln -s /etc/nginx/sites-available/base44-app /etc/nginx/sites-enabled/
    sudo nginx -t
    sudo systemctl restart nginx
    6

    Set Up SSL with Let's Encrypt

    Install Certbot

    Install Certbot
    sudo apt install -y certbot python3-certbot-nginx

    Obtain SSL Certificate

    Get SSL Certificate
    sudo certbot --nginx -d your_domain.com -d www.your_domain.com

    Follow the prompts to complete SSL setup. Certbot will automatically configure Nginx for HTTPS.

    Set Up Auto-Renewal

    Test Auto-Renewal
    sudo certbot renew --dry-run
    7

    Database Setup (if applicable)

    Install PostgreSQL

    PostgreSQL Installation
    sudo apt install -y postgresql postgresql-contrib

    Create Database and User

    Create Database
    sudo -u postgres psql
    CREATE DATABASE base44_db;
    CREATE USER base44_user WITH ENCRYPTED PASSWORD 'your_secure_password';
    GRANT ALL PRIVILEGES ON DATABASE base44_db TO base44_user;
    \q

    Update your .env file with the database connection string.

    8

    Monitoring and Maintenance

    Monitor Application with PM2

    PM2 Monitoring
    pm2 status
    pm2 logs base44-app
    pm2 monit

    Set Up Log Rotation

    PM2 handles log rotation automatically, but you can configure it:

    Configure Log Rotation
    pm2 install pm2-logrotate
    pm2 set pm2-logrotate:max_size 10M
    pm2 set pm2-logrotate:retain 7

    Monitor Server Resources

    Resource Monitoring
    htop
    df -h
    free -m

    Deployment Updates

    Pull latest changes and restart:

    Update Application
    cd /home/base44deploy/your-base44-app
    git pull origin main
    npm install
    npm run build
    pm2 restart base44-app

    Automated Deployment Script

    Create a deployment script (deploy.sh):

    Deployment Script
    #!/bin/bash
    cd /home/base44deploy/your-base44-app
    git pull origin main
    npm install
    npm run build
    pm2 restart base44-app
    echo "Deployment completed successfully!"

    Make it executable:

    Make Script Executable
    chmod +x deploy.sh

    Database Backups

    Create a backup script (backup.sh):

    Backup Script
    #!/bin/bash
    BACKUP_DIR="/home/base44deploy/backups"
    DATE=$(date +%Y%m%d_%H%M%S)
    mkdir -p $BACKUP_DIR
    
    pg_dump -U base44_user base44_db > $BACKUP_DIR/db_backup_$DATE.sql
    find $BACKUP_DIR -name "db_backup_*.sql" -mtime +7 -delete

    Schedule with cron:

    Crontab Configuration
    0 2 * * * /home/base44deploy/backup.sh

    Troubleshooting

    Application Won't Start

    Check PM2 logs:

    View Logs
    pm2 logs base44-app --lines 100

    Nginx Configuration Issues

    Test configuration:

    Test Nginx
    sudo nginx -t

    Check error logs:

    View Error Logs
    sudo tail -f /var/log/nginx/error.log

    Port Already in Use

    Find process using the port:

    Check Port
    sudo lsof -i :3000

    Database Connection Issues

    Verify PostgreSQL is running:

    Check PostgreSQL
    sudo systemctl status postgresql

    Test connection:

    Test Connection
    psql -U base44_user -d base44_db -h localhost

    Security Best Practices

    • Keep system packages updated regularly
    • Use strong passwords and SSH keys
    • Configure fail2ban to prevent brute force attacks
    • Regularly backup your data
    • Monitor server logs for suspicious activity
    • Keep Node.js and application dependencies updated
    • Use environment variables for sensitive data
    • Implement rate limiting in your application

    Ready to Deploy Base44?

    Your Base44 application should now be successfully deployed and running on your RamNode VPS!