Duplicate Sugar CRM instance for Development
Posted: February 1, 2012 Filed under: Admin, IT Survival, Sugar CRM 1 Comment »If you have email archiving enabled, you need to disable it before attempting this copy, also disable any special scheduled jobs that you may have.
This copy should be done out of hours to ensure that there is no impact, and if you could shut the Apache server down this would be even better.
The steps that we will follow are:
- Shut the web server down
- Copy the Sugar live folder outside the web server path
- Change the config files
- Clone the MySQL database
- Copy the test Sugar folder back into the web servers path
sudo su
cd /
mkdir sugarcrm_temp
If you can stop the Apache server
service httpd stop
Copy the crm installation folder in /var/www/html to a new folder name
cp -R /var/www/html/crm /sugarcrm_temp/crmdev
You then need to edit the config.php file and ammend the DB variable to match the new database that will be created in the next steps.
cd /sugarcrm_temp/crmdev
vi config.php
Look for the lines around dbconfig and change the db_name to match the database below.
We now need to create the database in Mysql.
mysql -u username -p -h servername
create database sugarcrm_prodev;
To ensure that the database has been created
show databases;
exit
if you already have cloned the database you will need to drop the database first.
drop database sugarcrm_prodev;
create database sugarcrm_prodev;
To ensure that the database has been created
show databases;
exit
We then just need to duplicate the database, this is a built in function and can be achieved with mysqldump
The basic syntax is
NOTE that this should all be on a single line, there should be no carriage return or line feed when pasting it into the command line (the wordpress editor also messes around with the — infront or password it should read – - so when copy and pasting make sure there is a single space in between the dashes)
mysqldump -u {source_username} –password={source_password} -h {source_server} {source_db_name} |
mysql -u {dest_username} –password={dest_password} -h {dest_server} {dest_db_name}
unfortunately I can not give you an example with letting you know my username and passwords but the syntax is pretty easy just ensure that the {dest_db_name} matches the database name from above.
To ensure that you have copied the database correctly we can run a few tests.
mysql -u username -p -h servername
use sugarcrm_pro;
select count(id) from contacts;
Take a note of the number
use sugarcrm_pro;
select count(id) from contacts;
exit
These should match perhaps the copy will be 1 or 2 less depending on how busy your database, if you shut you web server down these should match exactly.
Once the database has been cloned
cd /sugarcrm_temp
mv crmdev /var/www/html/
cd /var/www/html/
chown -R apache:apache crmdev
You will need to change the apache:apache to match the user and group that runs the web server in your environment.
Remember to restart the schedules and the email archiving in he live environment.
NOTE the address changes so you will need to re-issue the email address, I created a vcard and then just sent it out to all the user so that they could update the information.
Example of vcard file
BEGIN:VCARD
VERSION:3.0
FN:CRM
N:;CRM;;;
EMAIL;TYPE=INTERNET:xxxxxxxx@sugarondemand.com
END:VCARD
Save this as a vcf file and you are good to go
Change Sugar CRM URL
Posted: January 19, 2012 Filed under: Admin, Sugar CRM | Tags: Amazon AWS, Sugar CRM Leave a comment »I have just installed Sugar CRM in the Amazon cloud. More about the Amazon cloud will be coming in later in Amazon section.
The main issue that I had was that the URL is that of the server and I needed it to be the URL of the ELB (Elastic Load Balancer) in other words the URL was set to the hostname of the server.
To change this is relatively simple.
Navigate to
/var/www/html/XXXX
where XXXX is the directory where your Sugar installation is.
Edit the config.php file with your favourite editor and locate the hostname variable. Change this to what ever URL that you want, typically the CNAME entry from your DNS records.
A word of warning make sure you DNS is updated and proper-gated before change this setting.
Restart the HTTPD service and you should have the correct URL in place.
The steps
cd /var/www/html/XXXX
cp config.php config.php_DDMMYY
(sudo) vi config.php
Change the hostname variable
Change the site URL variable
Then either
service httpd restart
or
./etc/init.d/httpd restart
