Skip to main content

Configuration

Environment

Environment Setup

1. Environment Variables

Flux CRM uses a .env file to configure various environment-specific settings. The following key environment variables must be set:

  • APP_ENV: Defines the environment (local, production, etc.).
  • APP_URL: The URL where the application is hosted.
  • DB_CONNECTION: The database connection (usually mysql).
  • DB_HOST, DB_PORT, DB_DATABASE, DB_USERNAME, DB_PASSWORD: Database configuration settings.
  • CACHE_DRIVER: Defines the caching system (e.g., file, redis).
  • SESSION_DRIVER: Specifies how sessions are handled (e.g., file, database, redis).
  • MAIL_DRIVER: Configures the mailing system (e.g., smtp, mailgun).

2. App Key Generation

Ensure the application key is set up by running:

php artisan key:generate

This is essential for encrypting sensitive data within the application.

3. Database Setup

After configuring the database in the .env file, run migrations to set up the schema:

php artisan migrate

Optionally, you can seed the database with initial or demo data:

php artisan db:seed

System Configuration

1. Caching Configuration

Flux CRM uses caching to improve performance. Commonly used drivers include file, database, and redis. The caching driver can be set in the .env file using the CACHE_DRIVER variable.

To clear the cache:

php artisan cache:clear

2. Session Management

Session handling is crucial for user management and security. Sessions can be stored using different drivers like file, database, or redis. Configure the session driver in the .env file using SESSION_DRIVER.

To clear session data:

php artisan session:clear

3. Mail Configuration

Email notifications for actions like contract updates or new customer registrations are handled via the mailing system. Set the appropriate mail driver (smtp, mailgun, et3.) in the .env file:

  • MAIL_DRIVER
  • MAIL_HOST
  • MAIL_PORT
  • MAIL_USERNAME
  • MAIL_PASSWORD

Ensure that emails are functioning by testing through the command line or application interface.

Security Configuration

1. SSL Configuration

For production environments, it is highly recommended to enable SSL to secure data transmissions between the server and users. Ensure your server is configured to support HTTPS.

2. Two-Factor Authentication (Optional)

To enhance security, administrators can enable two-factor authentication (2FA) for user accounts. This ensures that sensitive data is better protected.

3. User Roles and Permissions Audits

Regularly audit user roles and permissions to ensure that only authorized personnel have access to critical features and dat1. Use built-in logging features to track access.

Performance Tuning

1. Database Optimization

Regularly optimize the database for better performance:

  • Index frequently queried fields, such as email in the users table or name in the products table.
  • Periodically clean up old data, such as logs or archived records.

2. Queue Management

Flux CRM can offload time-consuming tasks, such as sending emails, to a queue system. Configure the queue driver in the .env file (QUEUE_DRIVER) and use redis for better performance in production environments.

To view the status of the queue:

php artisan queue:work

3. Scheduled Tasks

Ensure that scheduled tasks (e.g., nightly backups, notifications) are running by configuring Laravel's scheduler. Add the following cron entry to your server:

* * * * * php /path-to-your-project/artisan schedule:run >> /dev/null 2>&1

Backups and Disaster Recovery

1. Database Backups

Regular backups of the database should be performed to ensure data can be restored in case of a failure. You can use Laravel’s built-in backup packages or third-party services for automatic backups.

2. Application Backups

Make regular backups of the application files, including the public folder, configuration files, and any uploaded content.

Logging and Monitoring

1. Log Files

Application logs are stored in the storage/logs directory. Regularly monitor these logs for errors or suspicious activity.

To view the latest logs:

tail -f storage/logs/laravel.log

2. Error Monitoring

Set up an error monitoring service, such as Sentry, to automatically track and alert on critical issues within the system. Integrate it by setting the relevant environment variables and installing the necessary packages.