Migrate your old website to Windows Azure Websites using the Visual Studio Online “Monaco” console, cURL and unzip
Introduction
Have you considered migration to a Windows Azure website? The thought of downloading the files and content from your old website, then uploading them again to Windows Azure is not appealing? I agree with you!
The title might be a bit misleading. What we actually want to do is, zip the content of your website (I’m assuming you are using cPanel or something similar and know how to do this), then fetch it directly on the Windows Azure website, and unzip it there.
If you were to deploy that on a Windows Azure Virtual Machine, the above would be very easy, since you either have Remote Desktop access or SSH access to your machine and you can click a few buttons (or punch a few commands) and you will be able to do just that.
The question is, how can you do that without Remote Desktop or SSH access? Since Windows Azure Websites is purely a Platform as a Service, by definition, you have give up access to the underlying machine, in return for higher abstraction. In this post, I’ll show you how to access a “pseudo shell” using the cool new Visual Studio Online which is now part of Windows Azure.
Let’s start
I assume you have already managed to zip/backup the content of your old website in one way or the other. I will not go through the details of that.
Instead, let’s fire up a new Windows Azure Website from our management portal
Once the website is ready, go to the Configure tab, scroll down a bit and enable “Edit in Visual Studio Online” then save your settings.
Once your settings are saved, if you go back to the Dashboard of the website, there should be a new link that comes up on the right under “quick glance” saying ”Edit in Visual Studio Online”. Go ahead an click that link.
You will be asked to login, use the same username and password you set for the deployment credentials.
Once you are logged in, you will be presented with a beautiful online “IDE” that you can already use to start developing ASP.net, PHP and node.js apps right away!
The console
The console is the interesting part today, open it by clicking on the second button from the bottom of the left bar, or by pressing Shift + Ctrl + C on your keyboard.
If you type help in the console, you shall be presented with the list of available commands.
There are a lot of interesting commands in there, but the one we are going to be using out of those is unzip, in order to unzip our backup file once we have it. But how are we going to download the file in the first place? At the time of writing this, there isn’t a command available to download stuff. There are no wget or curl commands built in.
Fortunately, there is a very easy work around!
“Installing” cURL
Turns out you can create .bat files and even run .exe files from this console, so we are in luck. Go ahead and download the small cURL zip (I downloaded the one with SSL after dismissing that annoying pop-up ad), unzip it on your computer and then simply drag curl.exe from your computer and drop it into the Visual Studio Online app running in your browser onto the left “Explore” pane. This will upload it.
Going back to the console and running cURL will work now.
Migration
Use cURL to download the zip file from the remote server
curl -o backup.zip https://your.old.website.com/backup.zip
Then unzip this
unzip backup.zip
You’re done.
Note: This post is cross posted to my new blog at https://sabbour.me/
Comments
- Anonymous
December 10, 2013
Its very useful & easy to use. accounting2solution.blogspot.com