Aug 25, 2024 3 min read

SuiteCRM: The Ultimate Guide to Self-Hosting

SuiteCRM: The Ultimate Guide to Self-Hosting
Table of Contents

SuiteCRM is a powerful, open-source customer relationship management (CRM) solution designed for businesses that require customization, control over their data, and the ability to self-host. With its feature-rich functionality and flexibility, SuiteCRM is an excellent alternative to proprietary systems. In this guide, we’ll cover everything from deploying SuiteCRM to configuring it for production, ensuring security, and leveraging its advanced features.

Installing SuiteCRM

πŸ“¦ Docker/Docker Compose Setup

Using Docker simplifies the deployment process by encapsulating SuiteCRM and its dependencies. Create a docker-compose.yml file to set up SuiteCRM with ease.


version: '3.8'

services:

suitecrm:

image: salesagility/suitecrm

container_name: suitecrm

ports:

- "8080:80"

volumes:

- suitecrm-data:/var/www/html

environment:

- DB_HOST=db

- DB_PORT=3306

- DB_DATABASE=suitecrm

- DB_USERNAME=suitecrm_user

- DB_PASSWORD=suitecrm_password

depends_on:

- db

db:

image: mysql:5.7

container_name: suitecrm-db

volumes:

- db-data:/var/lib/mysql

environment:

- MYSQL_ROOT_PASSWORD=root_password

- MYSQL_DATABASE=suitecrm

- MYSQL_USER=suitecrm_user

- MYSQL_PASSWORD=suitecrm_password

volumes:

suitecrm-data:

db-data:

Run the following commands to deploy SuiteCRM:


docker-compose up -d

πŸš€ Manual Installation

For a manual installation on a Linux server, follow these steps:

  1. Install dependencies:

sudo apt update

sudo apt install apache2 php libapache2-mod-php php-mysql mariadb-server unzip -y

  1. Download SuiteCRM:

wget https://suitecrm.com/files/159/SuiteCRM-8.3/752/SuiteCRM-8.3.0.zip

unzip SuiteCRM-8.3.0.zip -d /var/www/html/suitecrm

cd /var/www/html/suitecrm

  1. Set permissions:

sudo chown -R www-data:www-data /var/www/html/suitecrm

sudo chmod -R 775 /var/www/html/suitecrm

Configuring Nginx as a Reverse Proxy

🌐 Nginx Configuration

Nginx acts as a reverse proxy to route traffic to SuiteCRM. Create a server block configuration file:


server {

listen 80;

server_name suitecrm.example.com;

location / {

proxy_pass http://localhost:8080;

proxy_set_header Host $host;

proxy_set_header X-Real-IP $remote_addr;

proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

}

error_log /var/log/nginx/suitecrm_error.log;

access_log /var/log/nginx/suitecrm_access.log;

}

Save the file as /etc/nginx/sites-available/suitecrm and enable it:


sudo ln -s /etc/nginx/sites-available/suitecrm /etc/nginx/sites-enabled/

sudo nginx -t

sudo systemctl reload nginx

πŸ”’ SSL/TLS Setup

Secure your Nginx server with Let's Encrypt:


sudo apt install certbot python3-certbot-nginx -y

sudo certbot --nginx -d suitecrm.example.com

Automate certificate renewals:


sudo crontab -e

0 0 * * * /usr/bin/certbot renew --quiet

Logging and Debugging SuiteCRM

πŸ—ƒοΈ Enabling Debug Logs

Enable debug logging by editing the config.php file in SuiteCRM:


'logger' => [

'level' => 'debug',

],

πŸ“„ Viewing Logs

View logs depending on your setup:

  • Docker:

docker logs suitecrm

  • Manual installation:

tail -f /var/www/html/suitecrm/logs/suitecrm.log

πŸ› οΈ Troubleshooting Common Issues

Check for common issues like missing database connections:


grep -i "error" /var/www/html/suitecrm/logs/suitecrm.log

πŸ“€ Exporting Logs

Send SuiteCRM logs to an external ELK Stack using Filebeat:

  1. Install Filebeat:

sudo apt install filebeat -y

  1. Configure Filebeat to monitor log files:

filebeat.inputs:

- type: log

paths:

- /var/www/html/suitecrm/logs/*.log

output.elasticsearch:

hosts: ["localhost:9200"]

Backup and Restore

πŸ—‚οΈ File-Based Backups

Backup SuiteCRM files with the following command:


tar -czvf suitecrm-backup.tar.gz /var/www/html/suitecrm

πŸ”„ Database Backups

Export the database:


mysqldump -u suitecrm_user -p suitecrm > suitecrm_db_backup.sql

Restore the database:


mysql -u suitecrm_user -p suitecrm < suitecrm_db_backup.sql

πŸ“… Automated Backup Scripts

Automate backups using a cron job:


crontab -e

## Add the following line:

0 2 * * * /usr/bin/mysqldump -u suitecrm_user -psuitecrm_password suitecrm > /backup/suitecrm_$(date +\%F).sql

Updating and Upgrading SuiteCRM

⬆️ Updating Docker Images

Update SuiteCRM’s Docker image:


docker-compose pull suitecrm

docker-compose up -d

πŸ› οΈ Manual Updates

  1. Download the latest version:

wget https://suitecrm.com/files/latest.zip

unzip latest.zip -d /var/www/html/suitecrm

  1. Set permissions:

sudo chown -R www-data:www-data /var/www/html/suitecrm

sudo chmod -R 775 /var/www/html/suitecrm

πŸ” Checking for Updates

Check for updates within SuiteCRM by navigating to the "Admin" panel and selecting "Upgrade Wizard."

Leveraging SuiteCRM’s Unique Features

πŸ”§ Enabling APIs

Enable SuiteCRM’s REST API by editing config.php:


'api' => [

'enabled' => true,

],

Test the API with curl:


curl -X GET https://suitecrm.example.com/api/v8/modules -H "Authorization: Bearer YOUR_ACCESS_TOKEN"

🌟 Advanced Configurations

Enable custom modules or workflows by using the "Module Builder" and "Workflow Management" tools in the admin dashboard.

Wrapping Up

This guide covered the end-to-end process of deploying, configuring, and managing SuiteCRM, along with leveraging its features for maximum impact. By following these steps, you can harness the full power of SuiteCRM while maintaining full control over your data. Start exploring SuiteCRM today and customize it to meet your organization’s unique needs!

Great! You’ve successfully signed up.
Welcome back! You've successfully signed in.
You've successfully subscribed to Selfhosted Ninja.
Your link has expired.
Success! Check your email for magic link to sign-in.
Success! Your billing info has been updated.
Your billing was not updated.