This article is a complete guider of installing and configuring SuiteCRM system in Docker with tips on how to enable service web interface as a separate webpage in Apache2.
What is suitecrm?
“SuiteCRM is a completely open source enterprise-grade Customer Relationship Management (CRM) application. SuiteCRM is a software fork of the popular customer relationship management (CRM) system SugarCRM.” (https://www.suitecrm.com/)
It’s a tool with a great variety of possibilities for marketing management which can help to automate and optimize every-day tasks of business development. Implemented reporting and analytics enables users to correct its strategy accordingly and customize the system to their needs. Main features of SuiteCRM:
- Sales Force Automation: Customer contact, Task, Contract, Product and Sales lifecycle Management
- Marketing Automation: Lead Management, Email Marketing, ROI Analytics, Campaign Management
- Support: Customer Support and Analytics, Tracking System,
- Social Network Integration
- Reporting and Analytics
- Customization
Why docker?
During our work, we were more than convinced by the profitability of using containers. The main reason why in this article Docker was used – its short time of deployment, ease of management and comfortable log access. But besides this, it has a lot of other advantages:
- Deployment time – just a few seconds to launch a container saves operational costs and enables to track server load spikes.
- Resource allocation – enables to run the same configured service instance flexibly, in a different environment.
- The small size of container results in its ergonomic – same host may run more containers with more workload in a contradiction to VMs.
- Development, testing and bug tracking of a service are cost-effective and not painful since deployed container will act the same while running on different servers.
Installing Docker
To start with, make sure that your host system has Docker Engine to serve containers and Docker Compose to run a multi-container application installed.
The second step is to download to your machine a docker-compose template, which is sort of config file with the list of services in containers involved to your application. You can pick a preferable solution, e.g. from here.
1. Let’s check the downloaded template docker-compose.yml. Inside one template we declare two containers – suitecrm and mariadb to serve an application. SMTP server (to send notifications from SuiteCRM) and Apache2 (to serve http-requests) we have on the system pre-installed and configured.
version: '2' services: mariadb: image: 'bitnami/mariadb:latest' environment: #Replace all credentials in <...> with your data - MARIADB_ROOT_USER=<UsernameRoot> - MARIADB_ROOT_PASSWORD=<PasswordRoot> - MARIADB_USER=<UserDB> - MARIADB_PASSWORD=<PasswordDB> - MARIADB_DATABASE=<DBName> volumes: #Mount directory mariadb_data into container to get direct access to config files - 'mariadb_data:/bitnami' suitecrm: image: 'bitnami/suitecrm:latest' environment: - MARIADB_HOST=mariadb - MARIADB_PORT_NUMBER=3306 - SUITECRM_DATABASE_USER=<UserDB> - SUITECRM_DATABASE_PASSWORD=<PasswordDB> - SUITECRM_DATABASE_NAME=<DBName> - SUITECRM_USERNAME=<UserSuite> - SUITECRM_PASSWORD=<PasswordSuite> - SUITECRM_HTTP_TIMEOUT=320 # - SUITECRM_SMTP_HOST= # - SUITECRM_SMTP_USER= # - SUITECRM_SMTP_PASSWORD= # - SUITECRM_SMTP_PORT=587 # - SUITECRM_SMTP_PROTOCOL=TLS ports: #Forward SuiteCRM port from container to external http port - '12281:80' #Mount directory ./config into container to get direct access to config files volumes: - './config:/bitnami' depends_on: - mariadb volumes: mariadb_data: driver: local
2. Run containers. Navigate to the directory with docker-compose.yml file and run the following:
docker-compose up -d; docker-compose ps
The output of the command should be something like this:
Name Command State Ports
———————————————————————————————————————————–
suite_mariadb_1 /entrypoint.sh /run.sh Up 3306/tcp
suite_suitecrm_1 /app-entrypoint.sh /run.sh Up 0.0.0.0:12281->443/tcp, 80/tcp
3. Useful commands in managing containers:
#show container info like IP-address, host configs, etc. docker inspect suiteclean_suitecrm_1 #run bash shell in suitecrm container to login docker-compose exec suitecrm bash #list directories of services config files in the container docker-compose exec suitecrm ls -lh /opt/bitnami #remove all containers in a docker-compose.yml file docker-compose stop; docker-compose rm -f --remove-orphans #run the container and follow its logs docker-compose up -d; docker-compose logs -f
Apache2 Configuration
1. To make SuiteCRM visible to the world make sure you have apache2 mod-proxy module installed:
sudo apt install libapache2-mod-proxy-html; sudo a2enmod proxy_http; sudo service apache2 reload
2. Go to any VirtualHost config in your apache2 server and add to it the following:
<VirtualHost *:443> ServerName example.com ServerAlias www.example.com ..... # To check your <containerIP_address> run docker inspect suiteclean_suitecrm_1 command, where suiteclean_suitecrm_1 is the name of your container ProxyPass /suitecrm http://<containerIP_address>:80/ ProxyPassReverse /suitecrm http://<containerIP_address>:80/ ....... </VirtualHost>
3. Now you should be able to see SuiteCRM Web-interface under https://example.com/suitecrm/.
But by default, trailing slash (…/suitecrm/) is not added to the request end which might cause problems in the web-page loading if a user requests https://example.com/suitecrm.
To avoid such situation add to the same VirtualHost config follow rewrite rule:
<VirtualHost *:443> .... RewriteEngine On RewriteCond %{REQUEST_URI} /+[^\.]+$ RewriteRule ^(.+[^/])$ %{REQUEST_URI}/ [R=301,L] .... </VirtualHost>
4. Login to your SuiteCRM system under the link https://example.com/suitecrm with credentials defined in suitecrm container (see docker-compose.yml).
Want to get more?
At Dexor, we offer a wide range of IT services. If you would like a custom Docker configuration for your service or need support in any of the technologies listed here here, please feel free to contact us.