SugarCRM — Sugar powered by Salt!
Posted on Sat 02 August 2014 in Tech
SugarCRM can be a pain to setup, especially if you are managing many installs on different servers/environments. I'm a big fan of using salt to configure my servers. I rarely manage any servers directly anymore and generally run things through my salt master. This guide should hopefully get you up and running with a production ready setup of SugarCRM that you can re-use over and over. If you are looking for a decent primer on saltstack, this video will give you a really useful introduction to what salt can really do. I'm barely scratching the surface.
Howto
- Install salt on the server you with to act as the salt-master(the provisioner). DigitalOcean is great and cheap for this sort of non-mission critical task.
- Spin up a new server(which will be production), install/configure the salt-minion and point it at the master.
- Clone this repo to your salt-master or fork and create your own. You'll need to do a bunch of customisations that you'll want private.
- Do a grep -iRn 'TODO' sugar_salt/* and fill in all details and copy files where needed.
- Overwrite or merge this folder with your existing /srv/salt.
- Run a sudo salt-call -l debug state.highstate on the minion box you've setup. This will give you a ton of output and let you know if anything has gone wrong.
What this configuration gives you
- A set of core server essentially tools including git, vim, curl etc.
- Systat which I find essential for finding out what's causing potential issues on servers.
- All of SugarCRMs LAMP requirements, including redis, elasticsearch, composer and apt-pinning to php 5.3.
- Correct php config including recommended increases to memory limit.
- Correct server permissions for your SugarCRM codebase.
- Ensures correct config files are always maintained.
- Ensures the correct htaccess files is always maintained.
- Ensures cache, upload directories exist with the correct permissions.
Notes
- This configuration is tested on Ubuntu servers ONLY, specifically 12.04. If you intend to use this on something else please verify this works with a virtual machine before using on production machines. Salt plays really well with vagrant, in fact I actually manage all of my development, testing and production boxes using salt and this includes the development Vagrant boxes on my laptop. Specifically you'll probably want to change the php.ini that might not play nice with your alternate OS of choice.
- One improvement that could be made is to in fact keep config.php and config_override.php in version control but have the take in environment variables that salt could maintain(or your server).
- This is actually a little different to how I generally configure my SugarCRM boxes with salt. This configuration is not as re-usable as it could be, so what I do is abstract everything that's per server into their own sub-folders and everything that repeats per server into it's own server. I haven't shown this here for the sake of simplicity but is should be fairly straight forward.
- This repo was setup with SugarCRM 7 in mind. With the requirements specified here. Alter the configuration files based on the requirements of the version that's applicable to you.
Any tips or improvements(I'm sure there's plenty), feel free to comment.