Skip to main content

Troubleshooting

This section provides best practices and general guidance for identifying and resolving common issues in Flux CRM. Regular maintenance and monitoring are essential for keeping the system running smoothly.

Best Practices

1. Review Logs Regularly

The Flux CRM system stores detailed logs in the storage/logs/laravel.log file. These logs are essential for diagnosing issues such as failed database migrations, user access problems, and system errors.

  • Tip: Use the tail -f command to live-stream logs and monitor for errors in real-time.

2. Monitor Server Health

Regularly monitor server health using tools like Laravel Forge (for server resource tracking) or other monitoring solutions.

  • Key Metrics: CPU usage, memory consumption, disk space, and server load should all be tracked to avoid performance bottlenecks.
  • Alerts: Set up alerts for high resource usage or unusual activity to proactively resolve server issues.

3. Clear Cache

Caching is essential for optimizing system performance, but sometimes outdated or corrupted cache can cause unexpected behavior.

  • Solution: Run php artisan cache:clear to clear the application cache.
  • Regular Maintenance: Clear cache periodically, especially before and after deployments.

4. Database Optimization

Maintaining an optimized database is crucial for performance and reliability.

  • Index Key Columns: Index frequently queried columns (e.g., email in the users table) to improve query performance.
  • Run Migrations with Caution: Always ensure that migrations are fully tested on a development environment before running them on production.

5. Ensure Correct Environment Settings

The .env file is critical for configuring the application environment, database, and third-party services. Misconfigured environment variables can cause deployment issues or system failure.

  • Key Settings to Check:
    • Database connection details (DB_HOST, DB_DATABASE, etc.)
    • Cache and session drivers (CACHE_DRIVER, SESSION_DRIVER)
    • Mail configuration (MAIL_DRIVER, MAIL_HOST, etc.)

6. Regular Backups

Ensure regular backups are performed to avoid data loss in case of unexpected issues.

  • Database Backups: Use tools like Laravel Forge or third-party services to automate daily database backups.
  • Application Backups: Periodically back up the application files and public resources.

7. Monitor Queue Jobs

Background jobs (e.g., sending emails, processing data) are handled by Laravel queues. Monitor queues to ensure they are running smoothly.

  • Tip: Use php artisan queue:work to check queue status and troubleshoot failed jobs.
  • Job Failures: If jobs are failing, restart the worker and ensure enough resources are allocated for processing.

Common Issues and Resolutions

1. Failed Deployment

If deployment fails, check the following:

  • Composer Issues: Run composer install to resolve dependency issues.
  • Migration Errors: Check the migration status with php artisan migrate:status. Manually run migrations if necessary.
  • NPM Build Errors: Run npm install and npm run prod to ensure the frontend is built correctly.

2. SSL Certificate Issues

If SSL is not functioning:

  • Certificate Expired: Reissue the SSL certificate using Laravel Forge.
  • Nginx Misconfiguration: Review the Nginx configuration file to ensure SSL is correctly set up and port 443 is open.

3. Emails Not Sending

If email notifications aren’t being sent:

  • Mail Configuration: Check the .env file for correct mail settings.
  • Queue Issues: Ensure the queue worker is running and processing jobs correctly.

4. Performance Slowdowns

If the system is slow:

  • Database Optimization: Optimize queries and check for unindexed columns.
  • Caching: Ensure the caching system is working correctly and not overloaded.
  • Server Resources: Monitor server usage for CPU, memory, and disk space.