Installation Guide

This guide provides detailed step-by-step instructions for installing and configuring the Modern Management Ticketing System.

Prerequisites

Before beginning the installation, ensure you have:

System Requirements

Required Access

Installation Methods

Choose one of the following installation methods:

Method 1: Standard Installation

Follow these instructions for a traditional installation directly on a server.

Step 1: Prepare the Server

  1. Update your system packages:

    For Ubuntu/Debian:

    sudo apt update
    sudo apt upgrade -y
    

    For CentOS/RHEL:

    sudo dnf update -y
    
  2. Install required dependencies:

    For Ubuntu/Debian:

    sudo apt install -y nginx postgresql php8.0-fpm php8.0-pgsql php8.0-mbstring \
    php8.0-xml php8.0-curl php8.0-zip php8.0-gd php8.0-bcmath \
    nodejs npm curl unzip git
    

    For CentOS/RHEL:

    sudo dnf install -y nginx postgresql-server php php-pgsql php-mbstring \
    php-xml php-curl php-zip php-gd php-bcmath nodejs npm curl unzip git
    
  3. Configure PostgreSQL:

    sudo systemctl enable postgresql
    sudo systemctl start postgresql
    sudo -u postgres createuser -P ticketing_user
    # Enter a secure password when prompted
    sudo -u postgres createdb -O ticketing_user ticketing_db
    

Step 2: Download and Prepare Application Files

  1. Download the application:

    cd /var/www
    sudo mkdir ticketing
    sudo chown $(whoami):$(whoami) ticketing
    cd ticketing
    curl -LO https://example.com/downloads/ticketing-system-latest.zip
    unzip ticketing-system-latest.zip
    rm ticketing-system-latest.zip
    
  2. Install application dependencies:

    # Backend dependencies
    cd backend
    composer install --no-dev --optimize-autoloader
    
    # Frontend dependencies
    cd ../frontend
    npm install
    npm run build
    

Step 3: Configure the Application

  1. Create environment configuration:

    cd /var/www/ticketing/backend
    cp .env.example .env
    
  2. Edit the .env file with your specific settings:

    nano .env
    

    Update the following values:

    APP_NAME="Modern Management Ticketing System"
    APP_URL=https://your-domain.com
    
    DB_CONNECTION=pgsql
    DB_HOST=127.0.0.1
    DB_PORT=5432
    DB_DATABASE=ticketing_db
    DB_USERNAME=ticketing_user
    DB_PASSWORD=your_secure_password
    
    MAIL_HOST=your_smtp_server
    MAIL_PORT=587
    MAIL_USERNAME=your_smtp_username
    MAIL_PASSWORD=your_smtp_password
    MAIL_ENCRYPTION=tls
    MAIL_FROM_ADDRESS=no-reply@your-domain.com
    
    # Set application encryption key
    
  3. Generate application keys:

    php artisan key:generate
    
  4. Run database migrations:

    php artisan migrate --seed
    
  5. Set proper permissions:

    sudo chown -R www-data:www-data /var/www/ticketing
    sudo chmod -R 755 /var/www/ticketing/storage
    sudo chmod -R 755 /var/www/ticketing/bootstrap/cache
    

Step 4: Configure Web Server

  1. Create Nginx configuration:

    sudo nano /etc/nginx/sites-available/ticketing
    

    Add the following configuration:

    server {
        listen 80;
        server_name your-domain.com;
        root /var/www/ticketing/public;
    
        add_header X-Frame-Options "SAMEORIGIN";
        add_header X-Content-Type-Options "nosniff";
    
        index index.php;
    
        charset utf-8;
    
        location / {
            try_files $uri $uri/ /index.php?$query_string;
        }
    
        location = /favicon.ico { access_log off; log_not_found off; }
        location = /robots.txt  { access_log off; log_not_found off; }
    
        error_page 404 /index.php;
    
        location ~ \.php$ {
            fastcgi_pass unix:/var/run/php/php8.0-fpm.sock;
            fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
            include fastcgi_params;
        }
    
        location ~ /\.(?!well-known).* {
            deny all;
        }
    }
    
  2. Enable the site:

    sudo ln -s /etc/nginx/sites-available/ticketing /etc/nginx/sites-enabled/
    sudo nginx -t
    sudo systemctl restart nginx
    
  3. Configure HTTPS with Let's Encrypt:

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

Step 5: Configure Background Jobs

  1. Set up cron job for scheduled tasks:

    sudo crontab -e
    

    Add the following line:

    * * * * * cd /var/www/ticketing && php artisan schedule:run >> /dev/null 2>&1
    
  2. Set up queue worker as a service:

    sudo nano /etc/systemd/system/ticketing-queue.service
    

    Add the following:

    [Unit]
    Description=Ticketing System Queue Worker
    After=network.target
    
    [Service]
    User=www-data
    Group=www-data
    WorkingDirectory=/var/www/ticketing
    ExecStart=/usr/bin/php artisan queue:work --sleep=3 --tries=3
    Restart=always
    
    [Install]
    WantedBy=multi-user.target
    

    Enable and start the service:

    sudo systemctl enable ticketing-queue
    sudo systemctl start ticketing-queue
    

Method 2: Docker Installation

For containerized deployment using Docker:

  1. Ensure Docker and Docker Compose are installed:

    curl -fsSL https://get.docker.com -o get-docker.sh
    sudo sh get-docker.sh
    sudo curl -L "https://github.com/docker/compose/releases/download/v2.12.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
    sudo chmod +x /usr/local/bin/docker-compose
    
  2. Download the Docker Compose configuration:

    mkdir ticketing-system && cd ticketing-system
    curl -O https://example.com/downloads/docker-compose.yml
    curl -O https://example.com/downloads/.env.example
    mv .env.example .env
    
  3. Edit the .env file with your configuration:

    nano .env
    
  4. Run the application:

    docker-compose up -d
    
  5. Initialize the database:

    docker-compose exec app php artisan migrate --seed
    

Post-Installation Steps

After completing the installation, follow these steps to finish setting up the system:

Initial Configuration

  1. Access the system at https://your-domain.com

  2. Log in with the default administrator account:

  3. Change the default password immediately.

  4. Complete the following initial setup:

Security Recommendations

  1. Update the server's firewall:

    sudo ufw allow 'Nginx Full'
    sudo ufw allow 22/tcp
    sudo ufw enable
    
  2. Set up regular backups:

    # Create backup script
    sudo nano /usr/local/bin/backup-ticketing.sh
    

    Add the following:

    #!/bin/bash
    TIMESTAMP=$(date +"%Y%m%d%H%M%S")
    BACKUP_DIR="/var/backups/ticketing"
    
    # Create backup directory if it doesn't exist
    mkdir -p $BACKUP_DIR
    
    # Backup database
    pg_dump ticketing_db -U ticketing_user -h localhost > $BACKUP_DIR/db_$TIMESTAMP.sql
    
    # Backup application files
    tar -czf $BACKUP_DIR/files_$TIMESTAMP.tar.gz -C /var/www ticketing
    
    # Remove backups older than 7 days
    find $BACKUP_DIR -type f -name "*.sql" -mtime +7 -delete
    find $BACKUP_DIR -type f -name "*.tar.gz" -mtime +7 -delete
    

    Set permissions and create cron job:

    sudo chmod +x /usr/local/bin/backup-ticketing.sh
    sudo crontab -e
    

    Add:

    0 2 * * * /usr/local/bin/backup-ticketing.sh
    
  3. Set up monitoring (optional but recommended):

    # Install monitoring agent (example for Netdata)
    bash <(curl -Ss https://my-netdata.io/kickstart.sh)
    

Troubleshooting

Common Issues

  1. Database Connection Errors

  2. Web Server Issues

  3. Application Errors

Getting Help

If you encounter issues during installation, you can:

Upgrading

For instructions on upgrading to newer versions, please refer to the Upgrade Guide.

Next Steps

After installation, refer to the following resources:

Back to Top