The Rube Goldberg MEAN Stack

Since I’ve been using Node.js and AngularJS for awhile, I’ve been meaning to update my web page to use the MEAN stack (MondoDB/ExpressJS/AngularJS/Node). My old page used the LAMP stack (Linux/Apache/MySQL/PHP), which may have been state-of-the-art five years ago, but not anymore.

The future belongs to JavaScript – I realized that years ago, when I decided to start making HTML5 games instead of using Flash/ActionScript – and I’ve had enough experience and study with that language. Likewise, the design trend is moving towards REST. It was time to ditch the different pages and implement a state machine.

Moreover, as is my practice, I had to build and deploy the entire stack on my own.

I was warned – MEAN stacks are a lot more complicated than LAMP stacks, and the update took longer than I thought. But coding was the easiest part. I had several simple goals for this update, and all turned out to be harder than expected.

  1. Retain my original domain name (www.aphorism44.com).
  2. Update my blog to look better and to tie in with social media, the better to publicize myself.
  3. Don’t spend any more money.

 

I’ll start with the first roadblock – my domain. I purchased it through GoDaddy. When I was running my old page, it was a perfect choice – it has built-in support for MySQL. Unfortunately, as I soon learned, GoDaddy does not provide MongoDB hosting for their Economy packages.

So, I created a Mongo NoSQL database for free at MLab. Provided I didn’t go over 500MB, I’d be okay. I originally considered going directly through Amazon Web Services, but was worried about what happens after my 12 free months run out.

To practice (or so I initially thought), I decided to move my “page updates” functionality into the database. This was simply a list of dated updates on my home page, which originally I simply hardcoded onto the index. I moved that data into Mongo, added a login and edit page (only accessible to myself), and thanks to the magic of Angular, had a nice-looking editing screen. I had to store my data on a different server than my web page, but hey, that’s what the cloud is all about, right?

However, while I was developing on my local server, I failed to note something else: GoDaddy does not provide a Node server for its Economy package.

Now, there are sites that provide free Node website hosting. I choose Heroku, since it gave me 512 MB RAM and offered a future update to a very cheap “Hobby” option, which is precisely how I use it. However, I didn’t want to host my web page on “somePage.herokuapp.com;” it needed to stay on my original domain.

Luckily, there’s a way to do that by forwarding the domain.

So, by this point, I had a web page hosted on Heroku, being forwaded to GoDaddy, and grabbing data from mLab.

By now, I decided that my old homemade blog, whose most complicated component was TinyMCE, wasn’t going to cut it. I would not be personally writing the JavaScript to store entries in Mongo.  I decided to humble myself and use WordPress, three years after I bragged about skipping it to write my own blog.

My idea was to host my WordPress blog right on my site. After all, not only is there an easy-to-download package for it, but GoDaddy includes it in their package. And here I ran into the final barrier – WordPress was designed to work with PHP and MySQL.

(DISCLAIMER, yes, I know there are ways to at least grab WordPress data through a MEAN stack, but I wanted the full functionality).

I looked into content management systems for Node, and I did consider Keystone, but it didn’t have the type of social media support WordPress offered. With WordPress, the moment I publish a page, all my friends/contacts on LinkedIn and Facebook can see a nicely formatted announcement, which links to a mobile-friendly version of my entry. That’s what I needed.

At this point, needing to get the page done by the end of the long weekend, I decided to handle this issue with this brilliant line of code on my blog page:

<a href=”https://aphorism44.wordpress.com&#8221; target=”_blank”>I have moved my blog to WordPress!</a>

And that’s the end of that.


Come December, I’ll be cancelling my GoDaddy account. I really enjoyed having their MySQL, PHP, and WordPress support. I enjoyed them even better when I could use them.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s