Skip to content

iDrv5-MyFR8 Standalone Deployment Guide

This guide explains how to deploy the iDrv5-MyFR8 application on third-party servers instead of Replit.

This guide explains how to deploy the iDrv5-MyFR8 application on third-party servers instead of Replit.

The standalone deployment package includes:

  • main_standalone.py - Standalone application entry point
  • config_standalone.py - Third-party server configuration
  • Dockerfile.standalone - Docker containerization
  • docker-compose.standalone.yml - Multi-container orchestration
  • deploy_standalone.sh - Automated deployment script
  • gunicorn.conf.py - Production WSGI server configuration
Section titled “Option 1: One-Command Deployment (Recommended)”
Terminal window
# Download and run the deployment script
curl -sSL https://raw.githubusercontent.com/your-org/idrv5-myfr8/main/deploy_standalone.sh | bash -s -- \
-d your-domain.com \
-e admin@your-domain.com \
-p SecurePassword123 \
-m docker \
-s
Terminal window
# Clone repository
git clone https://github.com/your-org/idrv5-myfr8.git
cd idrv5-myfr8
# Copy environment template
cp .env.example .env
# Edit environment variables
nano .env
# Start services
docker-compose -f docker-compose.standalone.yml up -d
Terminal window
# Download deployment script
wget https://raw.githubusercontent.com/your-org/idrv5-myfr8/main/deploy_standalone.sh
# Make executable
chmod +x deploy_standalone.sh
# Run deployment
./deploy_standalone.sh -d your-domain.com -e admin@your-domain.com -p SecurePassword123 -m manual

Advantages:

  • Isolated environment
  • Easy scaling
  • Consistent deployment
  • Automatic dependency management

Requirements:

  • Docker 20.10+
  • Docker Compose 2.0+
  • 4GB RAM minimum
  • 20GB storage minimum

Steps:

  1. Install Docker and Docker Compose
  2. Copy application files
  3. Configure environment variables
  4. Run docker-compose up -d

Advantages:

  • Full control over environment
  • Direct system access
  • Custom optimization possible

Requirements:

  • Ubuntu 20.04+ or CentOS 8+
  • Python 3.11+
  • PostgreSQL 14+
  • Nginx
  • 4GB RAM minimum

Steps:

  1. Install system dependencies
  2. Create Python virtual environment
  3. Install application dependencies
  4. Configure database
  5. Setup systemd service
  6. Configure Nginx reverse proxy

Advantages:

  • System integration
  • Automatic startup
  • Process management
  • Logging integration

Requirements:

  • Systemd-based Linux distribution
  • Root access for service creation
  • PostgreSQL database
# Security (Required)
SESSION_SECRET=your_32_character_secret_key_here
JWT_SECRET_KEY=your_32_character_jwt_secret_here
# Database (Required)
DATABASE_URL=postgresql://user:password@host:5432/database
DB_PASSWORD=your_secure_database_password
# Application (Required)
SYSTEM_NAME=iDrv5-MyFR8
COMPANY_NAME=MyFR8 Logistics
SERVER_NAME=your-domain.com
# External Services
TWILIO_ACCOUNT_SID=your_twilio_account_sid
TWILIO_AUTH_TOKEN=your_twilio_auth_token
SENDGRID_API_KEY=your_sendgrid_api_key
OPENAI_API_KEY=your_openai_api_key
# Performance
GUNICORN_WORKERS=4
GUNICORN_WORKER_CLASS=gevent
GUNICORN_TIMEOUT=30
# Feature Flags
ENABLE_RATE_LIMITING=True
ENABLE_CACHING=True
ENABLE_COMPRESSION=True

Ubuntu/Debian:

Terminal window
sudo apt update
sudo apt install postgresql postgresql-contrib
sudo systemctl start postgresql
sudo systemctl enable postgresql

CentOS/RHEL:

Terminal window
sudo dnf install postgresql postgresql-server postgresql-contrib
sudo postgresql-setup --initdb
sudo systemctl start postgresql
sudo systemctl enable postgresql
Terminal window
# Create database and user
sudo -u postgres psql
CREATE USER myfr8_user WITH PASSWORD 'secure_password';
CREATE DATABASE idrv5_myfr8 OWNER myfr8_user;
GRANT ALL PRIVILEGES ON DATABASE idrv5_myfr8 TO myfr8_user;
ALTER USER myfr8_user CREATEDB;
\q
# Import database schema
PGPASSWORD=secure_password psql -U myfr8_user -h localhost -d idrv5_myfr8 -f exports/complete_database_export_fixed.sql

Let’s Encrypt (Recommended):

Terminal window
sudo apt install certbot python3-certbot-nginx
sudo certbot --nginx -d your-domain.com

Manual Certificate:

Terminal window
# Copy certificate files
sudo cp your-certificate.crt /etc/nginx/ssl/
sudo cp your-private-key.key /etc/nginx/ssl/
sudo chmod 600 /etc/nginx/ssl/*
Terminal window
sudo ufw default deny incoming
sudo ufw default allow outgoing
sudo ufw allow ssh
sudo ufw allow 80/tcp
sudo ufw allow 443/tcp
sudo ufw enable
/etc/nginx/sites-available/idrv5-myfr8
server {
listen 80;
server_name your-domain.com;
return 301 https://$server_name$request_uri;
}
server {
listen 443 ssl http2;
server_name your-domain.com;
ssl_certificate /etc/nginx/ssl/your-certificate.crt;
ssl_certificate_key /etc/nginx/ssl/your-private-key.key;
# Security headers
add_header X-Frame-Options "SAMEORIGIN" always;
add_header X-Content-Type-Options "nosniff" always;
add_header X-XSS-Protection "1; mode=block" always;
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;
# Gzip compression
gzip on;
gzip_vary on;
gzip_min_length 1024;
gzip_types
text/plain
text/css
text/xml
text/javascript
application/javascript
application/xml+rss
application/json;
# Static files
location /static/ {
alias /opt/idrv5-myfr8/static/;
expires 30d;
add_header Cache-Control "public, no-transform";
}
# Main application
location / {
proxy_pass http://127.0.0.1:5000;
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_redirect off;
proxy_buffering off;
}
}
gunicorn.conf.py
import multiprocessing
workers = multiprocessing.cpu_count() * 2 + 1
worker_class = 'gevent'
worker_connections = 1000
max_requests = 1000
max_requests_jitter = 50
preload_app = True
Terminal window
# Application health
curl -f http://localhost:5000/health
# Database health
pg_isready -U myfr8_user -d idrv5_myfr8
# Service status
systemctl status idrv5-myfr8
Terminal window
# Application logs
journalctl -u idrv5-myfr8 -f
# Nginx logs
tail -f /var/log/nginx/access.log
tail -f /var/log/nginx/error.log
# Database logs
tail -f /var/log/postgresql/postgresql-*.log
Terminal window
# Database backup
pg_dump -U myfr8_user -h localhost idrv5_myfr8 > backup_$(date +%Y%m%d_%H%M%S).sql
# Application backup
tar -czf app_backup_$(date +%Y%m%d_%H%M%S).tar.gz /opt/idrv5-myfr8/
  1. Database Connection Failed

    • Check PostgreSQL service status
    • Verify database credentials
    • Ensure database exists
  2. Permission Denied

    • Check file ownership and permissions
    • Verify user has correct privileges
    • Review systemd service configuration
  3. SSL Certificate Issues

    • Verify certificate files exist
    • Check certificate validity
    • Ensure proper Nginx configuration
  4. Port Already in Use

    • Check for existing services on port 5000
    • Modify port configuration if needed
    • Restart services in correct order
Terminal window
# Check service status
systemctl status idrv5-myfr8
# View service logs
journalctl -u idrv5-myfr8 -n 100
# Test database connection
PGPASSWORD=your_password psql -U myfr8_user -h localhost -d idrv5_myfr8 -c "SELECT 1;"
# Test application directly
cd /opt/idrv5-myfr8
source venv/bin/activate
python main_standalone.py

For deployment issues:

  1. Check logs for error messages
  2. Verify all environment variables are set
  3. Ensure database is accessible
  4. Check firewall and network configuration
  5. Review service status and dependencies

To migrate from Replit to standalone deployment:

  1. Export database using pg_dump
  2. Copy application files
  3. Update configuration for new environment
  4. Deploy using one of the methods above
  5. Import database schema and data
  6. Update DNS to point to new server
  7. Test all functionality

The standalone deployment maintains full compatibility with the Replit version while providing better performance and control for production environments.