Adam Frieberg
Minister, Computer Programmer, Geographer, Photographer
Web Development

captures, reflections, sketches of and about images Even though Adam lacks classical training, he tries to pay attention an ordained minister in the Christian Church (Disciples of Christ), Adam serves the church and the world, experimenting with non-traditional models of ministry "didn't I already solve this once?"
the reminders of frontend (JS/TS), backend (C#), database (T-SQL)
issues and how Adam has solved them
August - November 2014
Adam and Heidi go across the U.S. on trains, retreat at monasteries,
and live in Jerusalem and Rome. Attempting to be "guests" for the entirety.
Discovering new ways of looking at humans' relationships with each other and their spaces

I'd been putting it off for over a year. I had two websites I had made in the past that were never going to change again.

One was the former version of this blog: nine years of posts, hosted for the moment on a full WordPress install. Every so often I would get my hosting company's automated message that they had auto-upgraded my WordPress version. I didn't need to worry about broken links (there were likely plenty) and I didn't need to worry about URL path integrity (Google can find and update it at the new one). But I didn't want to keep paying the WordPress hosting fees for a site I was never going to update again.

The other site was one of Heidi's: http://sabbatical.vicarofbolingbrook.net/ It was a great site, for a very specific moment in time, and it was also our first test of the Ghost hosting platform. Ghost is a phenomenal editor. If you're using their hosting, you get a great all-in-one setup that includes a great theme, a great traffic allotment, and tons of other features. It was great for Heidi's blog while we were on sabbatical at the end of 2014 -- but it was not worth the $15/mo it would take to keep it on Ghost.

How I got the sites downloaded

Browsers' "Save Websites" functionality are always lacking. They either throw it into a proprietary format that doesn't transfer well (including to future/past versions of the same browser), or they save just that one page and don't follow links and don't make those links relate to each other.

Fortunately, there's an open source tool called HTTrack Website Copier. Tools with websites like this make me either 1) think they're immediately legit because it looks like a single programmer made it, or 2) they're made by hackers and downloading the app will cause every secret on my computer to get stolen. It IS fully published on GitHub, however, so nefarious bugs are much less likely. Just to be safe, I installed it on one of my local virtual machines with a different OS that I use for all trial software.

Downloading the websites worked like a charm, giving me a folder with files with correct relative paths within them. I could open them from my desktop, from a remote server - anywhere - and they worked as I expected.

Then came the question of what to put them ...

Amazon S3 Static Website Hosting

I'd mentally filed a note several years ago when Amazon announced they were supporting website hosting with S3 buckets. For those who have never heard of S3, it is one of the building blocks of Amazon web services. It's where to put files. It doesn't care what kind, what extension ... in fact, I'm not even sure if it cares that the file has an extension. You just dump files there - sometimes for use in other things, sometimes as backups - and they can be given permission to either be super-secret, or open for the world, or anywhere in between.

Chad Thompson, a multi-talented developer in Iowa (perhaps best known for creating VagrantPress), wrote an article several years ago about how to configure S3 to do the web serving. It worked like a charm.

I uploaded, I set the permissions, I edited the DNS CNAME records, and I logged out for the night. I had downloaded two complete website and migrated them and re-served them within 30 minutes (probably 10 of which were spent reading the tutorials and documentation).

Anytime a church or organization is ready to switch websites, this is by far one of the best, cheapest, and easiest ways to not lose the old.

Then again, sometimes it's OK to let websites die. :)

OK, so I was in over my head almost as soon as I tried to tackle this whole self-hosted Ghost blog project.

For one -- I learned a heck of a lot about doing GitHub deployment to Azure. The ability to not only push new versions of the source code, but then also revert and restore to previous safe versions when you screw it up. That's almost the holy grail of version control. (Or by holy grail -- maybe it's just the starting foundation that took us decades to get to ...)

Azure also has some sweet debug tools. The Kudu debug console is slick.

Why I switched Hosts


When travelling on a 10-day trip in March 2014, I ran into an issue with my blog. I hadn't pushed any changes (no new deployments). I hadn't posted any different content (no changed database). For some reason, though, the IIS Node instance completely crashed and said several of the Node modules were inaccessible.

I have no idea why that would have happened. There should have been nothing on my site that changed.

But it did ... and it crashed ... and trying to get it restored was just too much of a hassle.

What other options were there?

Oh, nothing major ... except for the hosted option by the makers of Ghost. Considering for a $5/mo fee, I can get my own custom domain, hosting and upgrades and security by them, and not have to worry about mucking it up as I've proven I can do.

I realized very quickly: if you want to learn, start doing it yourself; if you want it stable and cutting edge, go with the Pro version.

I'm not turned off from using Azure -- I use it for plenty of other stuff. For this type of development stack that I'm not fully familiar with ... I'm glad there's services like Ghost to do the configuration for me.

PS - In other news, the Ghost 0.4.2 upgrade made some very nice improvements in my touch-sensor retina display settings for the in-browser post editor. Exciting stuff from the Ghost team!

I'm very thankful the mark of a good web developer is not their ratio of palms-to-foreheads. In that case, I'd be a phenomenal developer .. but with a headache.

As it is, I'm just mediocre. And I'm definitely a glutton for punishment.

When the Ghost blogging software launched, they had some amazing documentation about how to get it running locally on my machine. They also had several partners, and eventually the non-profit org itself, who were able to setup hosting and scale for users to setup their own blogs without much fuss.

But as I said, I'm a glutton for punishment.

So when Windows Azure^ started offering a Ghost template on their Azure Websites section of the Azure portal, I decided to jump in.

In all, it wasn't too complicated of a process. Scott Hanselman had writtena great tutorial back when Ghost 3.3 was current. Jeremiah Billmann had also done a guiding article back when Ghost was just exposed on GitHub.

There were several steps to the process, with only a few hiccups:
  • Getting my local Visual Studio solution setup to unobtrusively let me edit my NodeJS code without adding lots of VS-specific files to it
    • There are NodeJS tools built for Visual Studio, but they're still in alpha and I'm not comfortable enough with my config skills to get them running locally without any problems. (Tried and backed out of that hole)
  • Getting Ghost deploying via Git pushes GitHub and then to Azure (pretty straightforward)
  • Getting Azure configured for IIS to serve the NodeJS site correctly (needed web.config ... see below)
  • Getting a decent separate local copy installed to debug the theme I put together to dive into the Handlebar errors (should be a way to do this without needing a separate local instance ... but I wasn't that much of a glutton for punishment)
Overall, I'm thrilled I tried it out and it's working great so far.

The hiccup I mentioned in the step list was that I needed to put a web.config file into my main repo for Azure Websites to know what to do with the code. To get this far, I created a clean copy from the Azure Websites (using the Ghost template) and then used Visual Studio Online to go in and see what else I was missing.

This was the web.config (sorry my Ghost theme doesn't preserve formatting that well; use Ctrl-K Ctrl-D in VS for a nicer version):

<?xml version="1.0" encoding="utf-8"?> <configuration>
<system.webServer> <httpErrors existingResponse="PassThrough" /> <handlers> <add name="iisnode" path="index.js" verb="*" modules="iisnode"/> </handlers> <rewrite> <rules> <rule name="StaticContent"> <action type="Rewrite" url="public{REQUEST_URI}"/> </rule> <rule name="DynamicContent"> <conditions> <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="True"/> </conditions> <action type="Rewrite" url="index.js"/> </rule> </rules> </rewrite> </system.webServer> </configuration>

^ = While I'm by no means a Microsoft fanboy or die-hard ... I have been using Visual Studio as my primary IDE for the past year or so. There's A LOT to be said for the underappreciated features of intellisense and lots of the web tech they've built into their One ASP.NET strategy. That's not to say that other IDEs or languages can't do the same (most of them can). I appreciate, however, that Microsoft can enable me to do much of them quicker. I really don't miss my days of PHP development in Sublime Text with sub-optimal (console only) debugging and troubleshooting.