Skip to content

Installation Guide

VetheonGames edited this page Sep 20, 2025 · 2 revisions

Installation Guide

Complete installation instructions for Source-License on all supported platforms.

📋 Prerequisites

System Requirements

Minimum Requirements:

  • Ruby: 3.4.4 or higher
  • Database: MySQL 5.7+, PostgreSQL 9.6+, or SQLite 3.8+ (development only)
  • Memory: 512MB RAM minimum, 1GB+ recommended
  • Storage: 1GB available disk space
  • Git: For cloning the repository

Recommended for Production:

  • Ruby: Latest stable version (3.4.4+)
  • Database: MySQL 8.0+ or PostgreSQL 12+
  • Memory: 2GB+ RAM
  • Storage: SSD storage with regular backups
  • Web Server: Nginx or Apache for SSL termination

Platform Support

Source-License supports the following platforms:

  • Windows: Windows 10/11 with PowerShell 5.1+
  • Linux: Ubuntu 18.04+, Debian 9+, CentOS 7+, RHEL 7+
  • macOS: macOS 10.14+ (Mojave)

🚀 Quick Installation

The fastest way to get Source-License running is using the automated installers:

1. Clone the Repository

git clone https://github.com/PixelRidgeSoftworks/Source-License.git
cd Source-License

2. Run the Installer

Windows (PowerShell):

.\install.ps1

Linux/macOS:

chmod +x install.sh
./install.sh

3. Deploy the Application

Windows (PowerShell):

.\deploy.ps1

Linux/macOS:

chmod +x deploy.sh
./deploy.sh

4. Access the Application

The installer automatically:

  • ✅ Verifies Ruby version compatibility
  • 📦 Installs required gems via Bundler
  • 🗄️ Sets up and migrates the database
  • ⚙️ Creates configuration files from templates
  • 🚀 Launches the application server

📝 Manual Installation

For customized installations or troubleshooting, follow these manual steps:

Step 1: Install Ruby

Windows:

  1. Download Ruby from rubyinstaller.org
  2. Run the installer and select "Add Ruby to PATH"
  3. Verify installation: ruby --version

Linux (Ubuntu/Debian):

sudo apt update
sudo apt install ruby ruby-dev build-essential

Linux (CentOS/RHEL):

sudo yum install ruby ruby-devel gcc make

macOS:

# Using Homebrew
brew install ruby

# Using rbenv (recommended)
brew install rbenv
rbenv install 3.4.4
rbenv global 3.4.4

Step 2: Install Database

MySQL:

# Ubuntu/Debian
sudo apt install mysql-server mysql-client libmysqlclient-dev

# CentOS/RHEL
sudo yum install mysql-server mysql-devel

# macOS
brew install mysql

PostgreSQL:

# Ubuntu/Debian
sudo apt install postgresql postgresql-contrib libpq-dev

# CentOS/RHEL
sudo yum install postgresql postgresql-server postgresql-devel

# macOS
brew install postgresql

Step 3: Clone and Setup

# Clone repository
git clone https://github.com/PixelRidgeSoftworks/Source-License.git
cd Source-License

# Install gems
bundle install

# Copy environment template
cp .env.example .env

Step 4: Configure Environment

Edit the .env file with your specific settings:

# Database Configuration
DATABASE_ADAPTER=mysql # or postgresql, sqlite
DATABASE_HOST=localhost
DATABASE_PORT=3306 # 5432 for PostgreSQL
DATABASE_NAME=source_license
DATABASE_USER=your_username
DATABASE_PASSWORD=your_password

# Security Settings
APP_SECRET=your_long_secure_secret_key_here
JWT_SECRET=your_jwt_secret_here

# Admin Account
ADMIN_EMAIL=admin@yourdomain.com
ADMIN_PASSWORD=your_secure_admin_password

Step 5: Database Setup

# Create database (MySQL example)
mysql -u root -p -e "CREATE DATABASE source_license;"

# Run migrations
ruby -r './lib/database.rb' -e "Database.setup; Database.migrate"

# Create initial admin account
ruby -r './lib/database.rb' -r './lib/models.rb' -e "
Database.setup
Admin.create_secure_admin(ENV['ADMIN_EMAIL'], ENV['ADMIN_PASSWORD'])
"

Step 6: Launch Application

ruby launch.rb

🗄️ Database Configuration

MySQL Setup

  1. Install MySQL Server:

    # Ubuntu/Debian
    sudo apt install mysql-server
    
    # Start and enable service
    sudo systemctl start mysql
    sudo systemctl enable mysql
  2. Secure Installation:

    sudo mysql_secure_installation
  3. Create Database and User:

    CREATE DATABASE source_license CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
    CREATE USER 'source_license'@'localhost' IDENTIFIED BY 'secure_password';
    GRANT ALL PRIVILEGES ON source_license.* TO 'source_license'@'localhost';
    FLUSH PRIVILEGES;
  4. Configure .env:

    DATABASE_ADAPTER=mysql
    DATABASE_HOST=localhost
    DATABASE_PORT=3306
    DATABASE_NAME=source_license
    DATABASE_USER=source_license
    DATABASE_PASSWORD=secure_password

PostgreSQL Setup

  1. Install PostgreSQL:

    # Ubuntu/Debian
    sudo apt install postgresql postgresql-contrib
    
    # Start and enable service
    sudo systemctl start postgresql
    sudo systemctl enable postgresql
  2. Create Database and User:

    sudo -u postgres psql
    CREATE DATABASE source_license;
    CREATE USER source_license WITH PASSWORD 'secure_password';
    GRANT ALL PRIVILEGES ON DATABASE source_license TO source_license;
    \q
  3. Configure .env:

    DATABASE_ADAPTER=postgresql
    DATABASE_HOST=localhost
    DATABASE_PORT=5432
    DATABASE_NAME=source_license
    DATABASE_USER=source_license
    DATABASE_PASSWORD=secure_password

SQLite Setup (Development Only)

Warning: SQLite should never be used in production environments due to concurrency limitations.

DATABASE_ADAPTER=sqlite
DATABASE_NAME=source_license.db

🔧 Configuration Files

Environment Variables (.env)

The .env file contains all configuration settings. Key sections:

Application Settings:

APP_ENV=development
APP_SECRET=your_secret_key_here
APP_HOST=localhost
APP_PORT=4567

Security Settings:

JWT_SECRET=your_jwt_secret_here
FORCE_SSL=false # true for production
ALLOWED_HOSTS=yourdomain.com,www.yourdomain.com

Payment Gateways:

# Stripe
STRIPE_PUBLISHABLE_KEY=pk_test_your_key
STRIPE_SECRET_KEY=sk_test_your_key
STRIPE_WEBHOOK_SECRET=whsec_your_secret

# PayPal
PAYPAL_CLIENT_ID=your_client_id
PAYPAL_CLIENT_SECRET=your_client_secret
PAYPAL_ENVIRONMENT=sandbox # or production

Email Configuration:

SMTP_HOST=smtp.gmail.com
SMTP_PORT=587
SMTP_USERNAME=your_email@gmail.com
SMTP_PASSWORD=your_app_password
SMTP_TLS=true

Gemfile Dependencies

Source-License uses these key gems:

# Core framework
gem 'sinatra'
gem 'sinatra-contrib'

# Database
gem 'sequel'
gem 'mysql2' # or 'pg' for PostgreSQL

# Security
gem 'bcrypt'
gem 'jwt'

# Payment processing
gem 'stripe'

# Email
gem 'mail'

🚢 Production Deployment

Using Nginx + Puma

  1. Install Nginx:

    sudo apt install nginx
  2. Configure Nginx:

    server {
        listen 80;
        server_name yourdomain.com;
        
        location / {
            proxy_pass http://localhost:4567;
            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;
        }
    }
  3. SSL with Let's Encrypt:

    sudo apt install certbot python3-certbot-nginx
    sudo certbot --nginx -d yourdomain.com
  4. Configure Puma:

    # puma.rb
    workers 2
    threads 1, 6
    
    bind "tcp://127.0.0.1:4567"
    
    environment ENV.fetch("APP_ENV") { "production" }

Using Docker

  1. Create Dockerfile:

    FROM ruby:3.4.4-alpine
    
    WORKDIR /app
    
    COPY Gemfile Gemfile.lock ./
    RUN bundle install --deployment --without development test
    
    COPY . .
    
    EXPOSE 4567
    
    CMD ["ruby", "launch.rb"]
  2. Docker Compose:

    version: '3.8'
    services:
      app:
        build: .
        ports:
          - "4567:4567"
        environment:
          - DATABASE_ADAPTER=mysql
          - DATABASE_HOST=db
        depends_on:
          - db
      
      db:
        image: mysql:8.0
        environment:
          - MYSQL_ROOT_PASSWORD=rootpassword
          - MYSQL_DATABASE=source_license

🔍 Verification

After installation, verify everything is working:

1. Check Application Health

Visit http://localhost:4567 and verify:

  • ✅ Homepage loads without errors
  • ✅ Admin panel accessible at /admin
  • ✅ Database connection working

2. Test Admin Login

  1. Go to http://localhost:4567/admin
  2. Login with credentials from .env file
  3. Verify dashboard loads with system statistics

3. Test API Endpoints

# Test license validation endpoint
curl http://localhost:4567/api/license/test-key/validate

# Should return JSON response (even if license doesn't exist)

4. Check Logs

# Application logs
tail -f logs/application.log

# Error logs
tail -f logs/error.log

🔧 Troubleshooting

Common Issues

Ruby Version Error:

Source-License requires Ruby 3.4.4 or higher

Solution: Install correct Ruby version using rbenv or RVM

Database Connection Failed:

Sequel::DatabaseConnectionError

Solution:

  • Verify database server is running
  • Check credentials in .env file
  • Ensure database exists

Port Already in Use:

Address already in use - bind(2)

Solution:

  • Kill existing process: lsof -ti:4567 | xargs kill
  • Or change port in .env: APP_PORT=4568

Permission Denied (Linux/macOS):

Permission denied - ./install.sh

Solution: Make scripts executable: chmod +x *.sh

Installation Logs

Check installation logs for detailed error information:

  • Windows: installer-logs\install-YYYY-MM-DD-HHMMSS.log
  • Linux/macOS: installer-logs/install-YYYY-MM-DD-HHMMSS.log

Getting Help

If you encounter issues:

  1. Check the logs in the logs/ directory
  2. Review the troubleshooting guide in this wiki
  3. Search existing issues on GitHub
  4. Create a new issue with:
    • Operating system and version
    • Ruby version
    • Complete error message
    • Installation log file

🔄 Updating

To update Source-License to the latest version:

# Pull latest changes
git pull origin main

# Update dependencies
bundle install

# Run any new migrations
ruby -r './lib/database.rb' -e "Database.setup; Database.migrate"

# Restart application

🧪 Development Installation

For development and testing:

# Clone repository
git clone https://github.com/PixelRidgeSoftworks/Source-License.git
cd Source-License

# Install development dependencies
bundle install

# Use SQLite for development
cp .env.example .env
# Edit .env to use sqlite adapter

# Run tests
ruby run_tests.rb

# Start development server
ruby launch.rb

Next Steps: Once installation is complete, continue with the Configuration Guide to set up payment gateways, email, and other integrations.

Clone this wiki locally