How to run SugarCRM on Windows Azure Web Sites using WebMatrix 2

Windows Azure Web Sites (WAWS) is a powerful hosting platform provided by Microsoft on Windows Azure. One of the coolest features is that you can run your Web Sites/Web Apps pretty easily and it’s not limited to ASP.NET but it also supports PHP. Also on database level it’s not only SQL databases (MSSQL) that are supported but MySQL as well.

Creating the Web Site

On my previous post on how to migrate your WordPress blog to WAWS I’ve demonstrated some options you have when you create a new Web Site

In our case we just want one that has a database which we’re going to use to migrate our SugarCRM installation. So select “Create with Database”.

In the second step we choose the name and we agree to the terms. Now, in the preview there is a limitation of 1 MySQL database per account, so if you already have a DB like I did, you’ll get a notification and you won’t be able to go forward. Just select and existing MySQL database on the previous step, instead of “Create a new MySQL Database”.

Once this is finished, WAWS will provision your web site and in the next 5-10 seconds you’ll have your web site ready to publish your files to it.

Using WebMatrix 2 to create the SugarCRM installation

If you’re familiar with WebMatrix 2 then you’ll know that creating/installing and running a number of Web Apps it’s a matter of following a Wizard and choosing the correct options. WebMatrix takes care of the rest like creating the hosting locally, downloading dependencies, installing and configuring them and even publishing/migrating your data and files when you upload them to your hoster (with WebDeploy). In my case, I’ve created a new SugarCRM installation from the Application Gallery:

Finish the wizard and you’ll end up with a brand new and working installation of SugarCRM. If you don’t have MySQL installed, it will install it for your and configure it. Also, make sure you download MySQL Workbench because we’ll need it later to connect and inspect the database but also execute the migration of the local MySQL database to the one created on the cloud.

Uploading the website using WebDeploy

Once you finish the local installation of your SugarCRM and you get the login screen, then you’re ready to publish your web site to WAWS. There are two ways to do that, either you can use an FTP client like FileZilla and use the credentials from the portal:

We use WebMatrix, so there is an even easier way to publish them by using WebDeploy. You can download your Publish settings and Import them on your WebMatrix installation. To download your settings, go the Portal, click on your website and then choose “Download Publish Profile”:

Once you do this, you can import your profile to WebMatrix and use it to Publish your website:

Now, you can go ahead and publish your website to WAWS. If everything goes ok, WebMatrix should update your config.php with the correct connection settings imported from your publish profile. In case this doesn’t happen, you have to update your config.php file from SugarCRM with the correct connection settings to MySQL.

Uploading/migrating your database

WebMatrix will prompt you to upload your database along with the publishing of the files but this is not going to work as the local database name doesn’t match the database name of the one created by WAWS and you don’t have permission to create a new one anyway. I was being lazy and as I didn’t want to install anything more than the MySQL Workbench on my machine, I exported the data from my local MySQL database, then use Notepad++ to replace the database name to all of the files exported and then used MySQL Workbench again to import them to my WAWS MySQL database. Below step by step:

Export:

Then I renamed the schema by using Notepad++. What I did is “Find/Replace” a string on the dump file and replace the database name. Then the last step was import that to the WAWS MySQL Database:

It still says “sugarcrm143″ which is my local database name but the file uses the WAWS MySQL database name, so you can safely ignore that.

Again, as I said I was being lazy. What you could do is basically export the files using the mysql CLI and then import it directly to the database you want.

You’re done!

Well, that was pretty much it. You uploaded your SugarCRM installation, you uploaded your database data (I used demo data in mine) and your website is now hosted in WAWS with all the benefits that it has, like scaling up or down on the shared environment or even running it on dedicated instances. All, with just use a slider on the portal! You can access my installation at http://sugarcrm.azurewebsites.net It might be that the first time you try to access it, it will take a bit longer (8-10 seconds) if the web site is sleeping but then the responses are sub-second.

PS. I’ve decided to take the Web Site off as it has been running for a month now and it was only for the purpose of the blog. Here you can find a screenshot of the website running.

Comments, suggestions or corrections are more than welcome!

Thank you,

PK

 

 

Leave a Reply

Go to top