DevLog: WebMatrix, GitHub, Azure and the Wonders of Continuous Deployment
This weekend I felt like working on my WebGL project again and I was reminded of how dreadful web development can be. Working on files in the wwwroot folder, copy-pasting them back to the local GitHub repository, pushing the changes up, FTPing the files to my host … sigh. There had to be a better way.
And there I was, all I needed was to use the wonderful tools around me. First of all, I created a separate GitHub project for the web part. This way I can separate web code from the C++ converters and general toolchain (the project can be split into two different parts: the WebGL demo player and the C++ code that converts binary files to json files that can be used in the web player).
I knew that there had to be a way to use an arbitrary folder in IIS ... it's called a virtual directory (please stop throwing bottles at me, I am just a newbie at this). Now I can edit files in the folder under source control and I can use
localhost/kzplayer/ to test the changes immediately.
OK, now that I have my files under source control, how do I deploy them? Well, Azure offers up to 10 free websites and you can set up Azure to pull the files from GitHub whenever I push them. This is similar to hooks on your own host, but this works across the web. Awesome, now any push to my
master branch gets immediately deployed. Continuous deployment FTW.
The final piece of the puzzle was WebMatrix. This is an awesome tool, a lightweight alternative to working in Visual Studio. You can open your folder as your website or you can connect directly to your Azure websites and then modify the files there. If you log in with the same live ID you use to manage Azure websites, it picks them up.
It even picks up the source control and allows you to work with Git straight from the UI instead of going back to Git Shell. All in all, it is cool … but it still lacks lots of Visual Studio's shortcuts, and
Ctrl+K,D doesn’t format the documents equally. Also, you don’t have Web Essentials in WebMatrix, but you can always click on the big Visual Studio ribbon button to switch your environment to VS if you feel more comfortable there. For me, WebMatrix is halfway between Notepad++ and Visual Studio.
The setup works great and has shortened my development cycle a lot. Too bad I hadn’t done this sooner, as I have probably wasted a lot of time on syncing things. That Azure and GitHub work together like a charm … wow, this just blows my mind. All Microsoft services should be as easy to integrate with as this scenario makes it.
(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)