Files
multitenetsaas/docs/deployment/getting-started.md
AHMET YILMAZ b3fff546e9
Some checks failed
System Monitoring / Health Checks (push) Has been cancelled
System Monitoring / Performance Monitoring (push) Has been cancelled
System Monitoring / Database Monitoring (push) Has been cancelled
System Monitoring / Cache Monitoring (push) Has been cancelled
System Monitoring / Log Monitoring (push) Has been cancelled
System Monitoring / Resource Monitoring (push) Has been cancelled
System Monitoring / Uptime Monitoring (push) Has been cancelled
System Monitoring / Backup Monitoring (push) Has been cancelled
System Monitoring / Security Monitoring (push) Has been cancelled
System Monitoring / Monitoring Dashboard (push) Has been cancelled
System Monitoring / Alerting (push) Has been cancelled
Security Scanning / Dependency Scanning (push) Has been cancelled
Security Scanning / Code Security Scanning (push) Has been cancelled
Security Scanning / Secrets Scanning (push) Has been cancelled
Security Scanning / Container Security Scanning (push) Has been cancelled
Security Scanning / Compliance Checking (push) Has been cancelled
Security Scanning / Security Dashboard (push) Has been cancelled
Security Scanning / Security Remediation (push) Has been cancelled
project initialization
2025-10-05 02:37:33 +08:00

7.6 KiB

Getting Started Guide

This guide will help you get the Multi-Tenant SaaS Platform up and running quickly.

Prerequisites

System Requirements

  • OS: Linux/Unix (Ubuntu 20.04+ recommended)
  • RAM: Minimum 8GB (16GB recommended)
  • CPU: 4 cores (8 cores recommended)
  • Storage: 100GB free space
  • Network: Stable internet connection

Software Requirements

  • Python: 3.9+
  • Node.js: 16+
  • PostgreSQL: 13+
  • Redis: 6+
  • Docker: 20.10+ (optional)
  • Git: Latest version

Malaysian Specific Requirements

  • Domain: Registered domain name
  • SSL: SSL certificate for HTTPS
  • Payment Gateway: Malaysian payment provider account
  • Data Center: Malaysian data center or cloud region

Quick Setup

1. Clone the Repository

git clone https://github.com/your-org/multi-tenant-saas.git
cd multi-tenant-saas

2. Install System Dependencies

# Ubuntu/Debian
sudo apt update
sudo apt install -y python3-pip python3-venv nodejs npm postgresql redis-server

# CentOS/RHEL
sudo yum install -y python3-pip nodejs npm postgresql-server redis

3. Create Virtual Environment

python3 -m venv venv
source venv/bin/activate

4. Install Python Dependencies

pip install -r requirements.txt
pip install -r requirements-dev.txt

5. Install Node Dependencies

cd frontend
npm install
cd ..

6. Configure Environment

cp .env.example .env
cp frontend/.env.example frontend/.env

Edit the .env files with your configuration:

# Backend .env
DEBUG=False
SECRET_KEY=your-secret-key-here
DATABASE_URL=postgresql://user:password@localhost:5432/multi_tenant_saas
REDIS_URL=redis://localhost:6379/0
ALLOWED_HOSTS=localhost,your-domain.com
CORS_ALLOWED_ORIGINS=http://localhost:3000,https://your-domain.com

# Malaysian Configuration
TIMEZONE=Asia/Kuala_Lumpur
CURRENCY=MYR
SST_RATE=0.06
DEFAULT_COUNTRY=Malaysia

7. Set Up Database

# Create database
sudo -u postgres createdb multi_tenant_saas
sudo -u postgres createuser multi_tenant_user

# Set database password
sudo -u postgres psql -c "ALTER USER multi_tenant_user PASSWORD 'your-password';"

# Run migrations
python manage.py migrate

# Create superuser
python manage.py createsuperuser

8. Set Up Redis

# Start Redis service
sudo systemctl start redis
sudo systemctl enable redis

9. Load Initial Data

# Load initial data
python manage.py load_initial_data

# Create sample tenant
python manage.py create_sample_tenant

10. Start Development Servers

# Start backend
python manage.py runserver

# In another terminal, start frontend
cd frontend
npm start

11. Access the Application

Docker Quick Start

1. Using Docker Compose

# Copy environment files
cp .env.example .env
cp frontend/.env.example frontend/.env

# Start all services
docker-compose up -d

# View logs
docker-compose logs -f

2. Access Services

Production Setup

1. Environment Configuration

# Production environment
cp .env.production .env
cp frontend/.env.production frontend/.env

# Edit with production settings
vim .env
vim frontend/.env

2. Database Setup

# Production database
sudo -u postgres createdb multi_tenant_saas_prod
sudo -u postgres createuser multi_tenant_prod_user

# Set strong password
sudo -u postgres psql -c "ALTER USER multi_tenant_prod_user PASSWORD 'strong-password';"

# Run production migrations
python manage.py migrate --settings=config.production

3. SSL Configuration

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

# Obtain SSL certificate
sudo certbot --nginx -d your-domain.com -d www.your-domain.com

4. Web Server Setup

# Install Nginx
sudo apt install nginx

# Configure Nginx
sudo cp deployment/nginx.conf /etc/nginx/sites-available/multi-tenant-saas
sudo ln -s /etc/nginx/sites-available/multi-tenant-saas /etc/nginx/sites-enabled/

# Test and restart Nginx
sudo nginx -t
sudo systemctl restart nginx

5. Process Management

# Install Gunicorn
pip install gunicorn

# Create systemd service
sudo cp deployment/gunicorn.service /etc/systemd/system/
sudo systemctl daemon-reload
sudo systemctl enable gunicorn
sudo systemctl start gunicorn

Malaysian Configuration

1. Payment Gateway Setup

# Configure Malaysian payment gateways
# Edit settings/local.py or environment variables

PAYMENT_GATEWAYS = {
    'touch_n_go': {
        'enabled': True,
        'api_key': 'your-touch-n-go-api-key',
        'secret': 'your-touch-n-go-secret'
    },
    'grabpay': {
        'enabled': True,
        'api_key': 'your-grabpay-api-key',
        'secret': 'your-grabpay-secret'
    }
}

2. Timezone Configuration

# Set Malaysian timezone
sudo timedatectl set-timezone Asia/Kuala_Lumpur

3. SST Configuration

# Configure SST settings
SST_SETTINGS = {
    'rate': 0.06,
    'enabled': True,
    'tax_id': 'your-sst-registration-number'
}

Verification

1. Health Checks

# Backend health check
curl http://localhost:8000/health/

# Database connectivity
python manage.py dbshell --command="SELECT 1;"

# Redis connectivity
redis-cli ping

2. Application Testing

# Run tests
python manage.py test

# Frontend tests
cd frontend
npm test

3. Production Readiness

# Check security
python manage.py check --deploy

# Check performance
python manage.py check --settings=config.performance

Troubleshooting

Common Issues

  1. Database Connection Errors

    # Check PostgreSQL status
    sudo systemctl status postgresql
    
    # Check database logs
    sudo tail -f /var/log/postgresql/postgresql-13-main.log
    
  2. Port Conflicts

    # Check running services
    sudo netstat -tlnp | grep :8000
    sudo netstat -tlnp | grep :3000
    
  3. Permission Issues

    # Fix file permissions
    sudo chown -R $USER:$USER /path/to/project
    sudo chmod -R 755 /path/to/project
    
  4. Memory Issues

    # Check memory usage
    free -h
    
    # Check process memory
    ps aux --sort=-%mem | head
    

Support Resources

Documentation

  • API Documentation: /docs/api/
  • Module Documentation: /docs/modules/
  • Deployment Guides: /docs/deployment/

Community Support

Professional Support

Next Steps

  1. Customize Modules: Enable and configure specific industry modules
  2. Set Up Monitoring: Configure monitoring and alerting
  3. Configure Backups: Set up automated backup procedures
  4. Deploy to Production: Follow production deployment guide
  5. Configure Security: Set up SSL, firewall, and security measures

Malaysian SME Setup

1. Business Registration

  • Register your business with SSM
  • Obtain necessary licenses and permits
  • Set up business bank account

2. Tax Registration

  • Register for SST with LHDN
  • Obtain SST registration number
  • Set up tax accounting procedures

3. Payment Gateway

  • Sign up with Malaysian payment providers
  • Complete KYC verification
  • Configure payment methods

4. Compliance Setup

  • PDPA compliance procedures
  • Data protection policies
  • Privacy policy creation