Development Platform Migration

    Deploy Your Replit App to RamNode VPS

    Move from Replit's hosted environment to your own VPS for greater control, better performance, and more deployment flexibility. This guide covers the complete migration process from Replit to a production RamNode VPS environment.

    Ubuntu 24.04 LTS
    Multi-Language Support
    ⏱️ 30-45 minutes

    Prerequisites

    Before starting the migration, ensure you have:

    Server Requirements

    • • RamNode VPS (Ubuntu 24.04 LTS+)
    • • SSH access (root/sudo privileges)
    • • Basic Linux command line knowledge
    • • Domain name (optional)

    Application Requirements

    • • Replit application ready for deployment
    • • Application dependencies documented
    • • Access to source code
    • • Environment variables list
    2

    Preparing Your RamNode VPS

    Set up your RamNode VPS environment for hosting your Replit application:

    Connect via SSH
    ssh root@your-server-ip
    Update System Packages
    apt update && apt upgrade -y
    Install Essential Packages
    apt install -y curl wget git unzip software-properties-common apt-transport-https ca-certificates gnupg lsb-release
    Create Non-Root User
    adduser appuser
    usermod -aG sudo appuser
    su - appuser

    💡 Security: Using a non-root user for application deployment follows security best practices.

    3

    Install Required Runtime Environment

    Install the appropriate runtime based on your Replit application's technology stack:

    For Node.js Applications:

    Install Node.js 20.x
    curl -fsSL https://deb.nodesource.com/setup_20.x | sudo -E bash -
    sudo apt-get install -y nodejs
    Verify Installation
    node --version
    npm --version

    For Python Applications:

    Install Python 3 and pip
    sudo apt install -y python3 python3-pip python3-venv python3-dev
    python3 --version
    pip3 --version

    For Java Applications:

    Install OpenJDK
    sudo apt install -y openjdk-17-jdk
    java --version
    javac --version

    For C++ Applications:

    Install Build Tools
    sudo apt install -y build-essential gcc g++ make
    gcc --version

    For Go Applications:

    Install Go
    wget https://golang.org/dl/go1.21.0.linux-amd64.tar.gz
    sudo tar -C /usr/local -xzf go1.21.0.linux-amd64.tar.gz
    echo 'export PATH=$PATH:/usr/local/go/bin' >> ~/.bashrc
    source ~/.bashrc
    go version

    ✅ Runtime environment is now installed and ready for your application.

    4

    Migrate Your Application

    Transfer your Replit application code to your VPS:

    Method 1: Git Clone (Recommended):

    Clone from Repository
    cd /home/appuser
    git clone https://github.com/your-username/your-replit-app.git
    cd your-replit-app

    Method 2: Download from Replit:

    Download and Extract
    wget https://replit.com/@your-username/your-project/archive/main.zip
    unzip main.zip
    cd your-project-main

    Method 3: SCP Upload:

    Upload Files (from local machine)
    scp -r /path/to/your/replit-app appuser@your-server-ip:/home/appuser/

    Install Dependencies:

    Node.js:

    npm install
    npm install

    Python:

    pip install
    pip3 install -r requirements.txt

    Build Application (if needed):

    Build Command
    # For Node.js applications
    npm run build
    
    # For Java applications
    javac *.java
    
    # For Go applications
    go build

    💡 Note: Ensure all dependencies from your Replit environment are included in your project files.

    5

    Database Setup

    Set up databases if your Replit application uses them:

    PostgreSQL Setup:

    Install PostgreSQL
    sudo apt install -y postgresql postgresql-contrib
    sudo systemctl start postgresql
    sudo systemctl enable postgresql
    Create Database and User
    sudo -u postgres psql
    CREATE DATABASE your_app_db;
    CREATE USER your_app_user WITH PASSWORD 'secure_password';
    GRANT ALL PRIVILEGES ON DATABASE your_app_db TO your_app_user;
    \q

    MySQL/MariaDB Setup:

    Install MySQL
    sudo apt install -y mysql-server
    sudo systemctl start mysql
    sudo systemctl enable mysql
    sudo mysql_secure_installation
    Create Database
    sudo mysql
    CREATE DATABASE your_app_db;
    CREATE USER 'your_app_user'@'localhost' IDENTIFIED BY 'secure_password';
    GRANT ALL PRIVILEGES ON your_app_db.* TO 'your_app_user'@'localhost';
    FLUSH PRIVILEGES;
    EXIT;

    MongoDB Setup:

    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
    sudo systemctl start mongod
    sudo systemctl enable mongod

    Redis Setup (for caching):

    Install Redis
    sudo apt install -y redis-server
    sudo systemctl start redis-server
    sudo systemctl enable redis-server
    redis-cli ping

    💡 Migration: Export your data from Replit's database and import it into your VPS database using appropriate tools.

    6

    Process Management Setup

    Set up process management to keep your application running:

    For Node.js - Install PM2:

    Install PM2
    sudo npm install -g pm2
    Create PM2 Ecosystem File
    nano ecosystem.config.js
    PM2 Configuration
    module.exports = {
      apps: [{
        name: 'replit-app',
        script: './main.js', // or your main file
        instances: 1,
        autorestart: true,
        watch: false,
        max_memory_restart: '1G',
        env: {
          NODE_ENV: 'production',
          PORT: 3000
        }
      }]
    };
    Start with PM2
    pm2 start ecosystem.config.js
    pm2 save
    pm2 startup

    For Python - Create Systemd Service:

    Create Service File
    sudo nano /etc/systemd/system/replit-app.service
    Systemd Service Configuration
    [Unit]
    Description=Replit Python Application
    After=network.target
    
    [Service]
    Type=simple
    User=appuser
    WorkingDirectory=/home/appuser/your-replit-app
    Environment=PATH=/home/appuser/your-replit-app/venv/bin
    ExecStart=/home/appuser/your-replit-app/venv/bin/python main.py
    Restart=always
    
    [Install]
    WantedBy=multi-user.target
    Enable and Start Service
    sudo systemctl daemon-reload
    sudo systemctl enable replit-app
    sudo systemctl start replit-app

    For Java Applications:

    Create Java Service
    sudo nano /etc/systemd/system/replit-java-app.service
    Java Service Configuration
    [Unit]
    Description=Replit Java Application
    After=network.target
    
    [Service]
    Type=simple
    User=appuser
    WorkingDirectory=/home/appuser/your-replit-app
    ExecStart=/usr/bin/java -jar your-app.jar
    Restart=always
    
    [Install]
    WantedBy=multi-user.target

    🚀 Success: Your application will now automatically restart if it crashes and start on system boot.

    7

    Nginx Configuration

    Configure Nginx as a reverse proxy for your application:

    Install Nginx:

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

    Create Site Configuration:

    Create Config File
    sudo nano /etc/nginx/sites-available/replit-app
    Nginx Configuration
    server {
        listen 80;
        server_name your-domain.com www.your-domain.com;
    
        location / {
            proxy_pass http://localhost:3000;  # Adjust port as needed
            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;
            proxy_read_timeout 86400;
        }
    
        # Handle static files
        location /static/ {
            alias /home/appuser/your-replit-app/static/;
            expires 30d;
            add_header Cache-Control "public, no-transform";
        }
    
        # Security headers
        add_header X-Frame-Options "SAMEORIGIN" always;
        add_header X-XSS-Protection "1; mode=block" always;
        add_header X-Content-Type-Options "nosniff" always;
        add_header Referrer-Policy "no-referrer-when-downgrade" always;
    }

    Enable Site:

    Enable and Test Configuration
    sudo ln -s /etc/nginx/sites-available/replit-app /etc/nginx/sites-enabled/
    sudo nginx -t
    sudo systemctl reload nginx

    💡 Port Configuration: Make sure the proxy_pass port matches the port your Replit application runs on.

    8

    SSL Certificate Setup

    Secure your application with SSL certificates:

    Install Certbot:

    Install Certbot
    sudo apt install -y snapd
    sudo snap install --classic certbot
    sudo ln -s /snap/bin/certbot /usr/bin/certbot

    Obtain SSL Certificate:

    Get SSL Certificate
    sudo certbot --nginx -d your-domain.com -d www.your-domain.com

    Test Auto-Renewal:

    Test Certificate Renewal
    sudo certbot renew --dry-run

    Configure Firewall:

    Configure UFW
    sudo ufw allow ssh
    sudo ufw allow 'Nginx Full'
    sudo ufw enable

    🔒 Secured: Your application is now accessible via HTTPS with automatic certificate renewal.

    9

    Environment Configuration

    Configure environment variables and application settings:

    Create Environment File:

    Create .env File
    nano /home/appuser/your-replit-app/.env
    Sample Environment Configuration
    # Application Settings
    NODE_ENV=production
    PORT=3000
    HOST=0.0.0.0
    
    # Database Configuration
    DATABASE_URL=postgresql://user:password@localhost:5432/your_app_db
    REDIS_URL=redis://localhost:6379
    
    # API Keys and Secrets
    API_KEY=your_api_key
    SECRET_KEY=your_secret_key
    
    # Replit-specific variables
    REPL_ID=your_repl_id
    REPL_SLUG=your_repl_slug

    Secure Environment File:

    Set Proper Permissions
    chmod 600 .env
    chown appuser:appuser .env

    Load Environment in Application:

    For Node.js applications, ensure you load environment variables:

    Load Environment (Node.js)
    // At the top of your main.js file
    require('dotenv').config();
    
    // Or for ES modules
    import 'dotenv/config';

    Update Process Manager Configuration:

    Update PM2 with Environment
    module.exports = {
      apps: [{
        name: 'replit-app',
        script: './main.js',
        instances: 1,
        autorestart: true,
        watch: false,
        max_memory_restart: '1G',
        env_file: '.env',  // Load environment file
        env: {
          NODE_ENV: 'production'
        }
      }]
    };

    🔐 Security: Never commit .env files to version control. Keep sensitive data secure and use different values for production.

    10

    Monitoring and Logging

    Set up monitoring and logging for your migrated application:

    Application Monitoring:

    • • Monitor application performance
    • • Track memory and CPU usage
    • • Monitor response times
    • • Set up error tracking

    Server Monitoring:

    • • Monitor disk space usage
    • • Track server resources
    • • Monitor database performance
    • • Set up uptime monitoring

    Essential Monitoring Commands:

    System and Application Monitoring
    # Check system resources
    htop
    
    # Check disk usage
    df -h
    
    # Monitor PM2 applications (Node.js)
    pm2 status
    pm2 logs replit-app
    pm2 monit
    
    # Check systemd services (Python/Java)
    sudo systemctl status replit-app
    sudo journalctl -u replit-app -f
    
    # Monitor Nginx
    sudo tail -f /var/log/nginx/access.log
    sudo tail -f /var/log/nginx/error.log
    
    # Check database status
    sudo systemctl status postgresql
    sudo systemctl status mysql
    sudo systemctl status mongod

    Set Up Log Rotation:

    Configure Log Rotation
    # For PM2 logs
    pm2 install pm2-logrotate
    pm2 set pm2-logrotate:max_size 10M
    pm2 set pm2-logrotate:retain 30
    
    # For custom application logs
    sudo nano /etc/logrotate.d/replit-app

    Troubleshooting Common Migration Issues

    🎉 Migration Complete!

    Congratulations! You've successfully migrated your Replit application to your RamNode VPS. Your application now has greater control, better performance, and more deployment flexibility compared to the hosted Replit environment.

    ✅ App Migrated
    ✅ Database Setup
    ✅ SSL Secured
    ✅ Production Ready