Setting up a poor man’s continuous deployment using Azure and Github

Summary

Right. I created an MVP personal site last month (yay agile!). It’s an MVP because it;s not fancy but all important information about me is available and it’s a bit more expressive than linkedin. If I get lazy and forget about this project next month then at least I’ll always have one piece of creativity on the interwebs that Facebook doesn’t own.

Main Goal

I’ve been using the internet since 1996 or earlier. I’ve owned domains since 1998 and I’ve done f**k-all with any of my knowledge in all this time. So my goal was to have a personal website describing my experience, achievements and learnings. A bonus would be having some ability to contact me and I really wanted a blog. I wanted to do all of this using the skills I have now to get it done quickly while minimizing the cost.

Hosting

I’d used AWS for production environments in previous jobs but I wanted to use Azure for this to get experience with its interface. It’s not cheap for a static site like mine – $15/month for sites with domains on pay as you go. But it offers stellar integration with the toolset and IDE I’ve used for a decade or more. I was coding and deploying to production in about an hour.

Azure is very cool compared to what I’ve used in the past for hosting. Server debugging was easy with visual studio integration. Setting up CI through my github master branch was super easy. Storing production configuration data was really simple.

Whats bad? The price is a bit crappy. Like I’m pretty sure Heroku could host my site for free on a different platform “But Rails is so easy Darragh” – yea yea, whatever) . I knew if I didn’t get this up quickly my enthusiasm would absolutely crash.

Here is a list of amazing free tools for software developers  https://github.com/ripienaar/free-for-dev/blob/master/README.md

I had to buy the domain. I started with my old domain fuzzyminds.com. but then I thought “screw it I’ll check if darraghoriordan.com is available” and it was.  Now I know it’s hard to say, spell and remember, it’s me dammit! I might regret it later. Dara O’Brien was pretty smart to change his name to be phonetic.

Site Architecture and Setup

Nothing special here. A basic .Net MVC site sending out server generated html to clients directly. It uses Ninject for dependency injection and NUnit for a smattering of tests (I don’t TDD because I’m lazy, I’m sorry).

The weirdest thing with it is that the blog is hosted by WordPress.com so I don’t have to pay extra for hosting it. This means a redirect to wordpress.com for the blog. I’ll almost certainly change this in the future in favour of my domain. The main site template matches the free wordpress blog template so the menus look reasonably seamless on redirect. MVP all the way.

The site is all server side. There’s a tiny bit of javascript for Google Analytics and the menu. There’s no database. Some data is served off a json file as a file I/O proof of concept with azure. I’l be moving all the data in here in the future.

You can’t have https with the cheaper azure websites and  custom domain. So don’t let any accidental https links to parts of your site get in to google. If you want a custom ssl cert you need to pay for  a $70/year web application.

Code

72 commits, 4 branches. Mostly c# (It’s not a javascript project no matter what you think github project classifier:p)

Learnings

Learning BEM was great. I had read about it quite a bit and recently used it in our new platform at work but I didn’t really understand it until this site. Really solid learning there.

Azure pricing. It pays to be wary here.  They show you more expensive server options than you need as “recommended”. Always scroll down to find the really cheap options. You can’t run databases on the really cheap sites. But you probably don’t need to either. Just use files for any readonly data. Hide data retrieval behind a service so you can put it in a database later.

Debugging directly on azure was amazing. Through it I discovered that when you’re doing github deploys, Azure doesn’t delete any files from your Web application that aren’t in github anymore. Its not a ‘clean’ deploy. So if this might be causing you issues log in through azure manager and delete the offending file off the server directly.

This is more of a .Net issue, but if you rename your MVC project and you manually change any broken references or namespaces and your site is still messed up then check the additional Web.config in the Views folder. You need to update that one too.

Things to Improve

Ohhhh so many things. Primarily I want to change the architecture to have an api and a client. This will let me play with all kinds of tech like ng2 or react.

Other than that I would…

  • Have all the data come from a data source (not on the page directly)
  • Wrap file IO in async methods
  • Make the controller methods async
  • Add asset versioning to js and css
  • Not having to deploy for data changes would be awesome (admin panel to edit json data source file).
  • Maybe try to improve speed. It should very fast given its simplicity.
  • Improve meta tags. Currently shared by all non-blog pages
  • Huge css bloat from copying theme file csstle and overriding properties I wanted. 99% of it is unused.
  • Hire a designer:)

 

Leave a Reply

Your email address will not be published. Required fields are marked *