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

 

 

How to migrate and run your WordPress blog on Windows Azure WebSites

I was testing Windows Azure Web Sites (Codename Antares, for short WAWS) for about 3 weeks before it was announced two days ago at MeetWindowsAzure. Since the beginning I wanted to migrate my blog from WordPress.com to Windows Azure Web Sites so I can have more control (on the blog) but enough abstraction (hosting etc.). Sound cool, right? Well WAWS does exactly that. Follow the process below to create your own web site to host the WordPress engine and also assign and use a custom domain on the environment. I’ll also include some description about the migration steps I did from WordPress.com to WAWS, like export/import of blog posts and installing some plugins to achieve similar functionality with WordPress.com

Creating the Web Site

Creating your Web Site it’s really easy and fast on Windows Azure Web Sites.

As I want to use a WordPress engine powered blog, I can choose “From Gallery” and get a list of ready-to-use Web Sites

All you have to do after that is give a name to it and let Windows Azure Web Sites do the rest for you, like create a MySQL Database, install WordPress and configure it for you. The whole process takes 10-12 seconds. After the provisioning of the Web Site, you can Browse to it. In our case you get the setup page of WordPress asking for an admin username and a password. Fill that information and of you go, your blog is ready.

Migrating existing content

WordPress is really helpful in this case as it has a special plugin only for that reason. By going to Tools -> Export on your existing WordPress blog, like mine hosted on WordPress.com, you can export to an XML file containing references for the Import engine of WordPress. Once, you logon to your Windows Azure Web Sites admin panel, you can navigate to Tools -> Import and then select the file you exported from your previous blog. You can then proceed with the import of all your content to your new blog. Mine took about 2-3 minutes to import everything.

Missing plugins/Similar functionality to WordPress.com

If your blog was hosted on WordPress.com there is some functionality that doesn’t exist on the installation we just did on Windows Azure Web Sites because the plugins are not included. Site stats for example or a couple of Widgets are not there. To include all that functionality WordPress has released a plugin called “JetPack” which includes all that functionality for your hosted WordPress site. All you need is an existing WordPress.com account to link your blog with the WordPress Cloud as they call it.

Creating the DNS records

You need to create the necessary DNS records for your site in order to point to the WAWS site. WAWS assigns to you an address of the <your_name>.azurewebsites.net format. For example this blog is running at http://kefalidis.azurewebsites.net but it’s accessible from http://www.kefalidis.me. I’m hosting my DNS records with GoDaddy so they look like below.

My www is actually an alias (CNAME) to the WAWS address.

Making Windows Azure Web Sites understand your custom domain

After you create the CNAME record and your site now points to the WAWS address, you need to make WAWS understand about your custom domain, otherwise sites running e.g. on WordPress won’t be accessible on the custom domain. To achieve this we have to logon to the Windows Azure Portal and go your Web Site. After you do that you have to click on the “Scale” tab and switch from Shared to Reserved mode.

That way you enable the option to use a custom domain header on your Web Site. Next step is click on the “Configure” tab and insert your custom hostname.

Final Steps

One last step left is making your WordPress site, listen and respond to the custom domain. In order to do that, you have to logon your Administration panel, click “Settings” and then “General”. There you have two options the Site Url and the WordPress URL. Make them both listen on your custom domain just like I did.

Now your Web site is accessible from your custom domain :)

Conclusion

The whole migration took my about an hour and was mostly setting up the things/plugins for my WordPress than it was WAWS preparing the deployment. The experience is really fast and responsive, I love the new UI on the portal and I hope you do too.

Any comments/remarks/questions are, as always, welcome!

Thanx,

PK

 

 

Go to top