Showing posts with label EC2. Show all posts
Showing posts with label EC2. Show all posts

Saturday, February 18, 2017

Drupal 8 Site Construction

AWS and Drupal 8 marriage

Hello all, I have been away for a while but now I am back with an update regarding my experience with installing and administering a full Drupal 8 solution via AWS!
I first encountered Drupal when looking for a CMS for a prototype I developed for the DC Government back in 2012. Back then, the Drupal community was just as alive as it is now, and I had a great time looking through the Drupal forums for help with understanding just what was Drupal. I decided to go with Joomla for that particular project because it was the only worthy CMS being provided by my web host. For that particular project, however, the addition of CMS was more an over-engineered solution, as the customer very rarely used the Web interface for interacting with the system.

Fast forward to recently, I had begun searching for a CMS again for a company called B.H. Griner, which happens to be owned by a friend of mine. This recruiting agency's website was in dire need of an upgrade, and the website administrator was unwilling to move beyond the web design technologies of the past. Recognizing that my friend's website could use a touch of CMS, I remembered my experience with learning Drupal and how easy it was for end-users to understand and add content. I suggested that she do the research as well, and she decided that my suggestion of Drupal would greatly help her business.

The requirements for her upgrade to Drupal included:
  • An overall cost reduction of 50% or more
  • An email forwarding service
  • Some recruit management system for tracking prospects
  • A system for keeping track of positions received from clients
  • The ability to have anonymous users provide simple contact information for applying to positions
  • Secure Socket Layer coverage of the site
  • Domain hosting and configuration for email records
  • Potential to scale up for higher traffic if necessary
  • 24/7 availability within the USA


So, I first looked into a hosting service for help with these requirements. Naturally, the prices were steep. Each host that met the requirements necessary to begin the migration wanted 50% more than what she was paying initially (granted, she had been grandfathered into her hosting after at least 20 years of loyalty). I informed my friend that she would benefit greatly from a custom implementation on a cloud-based service. After she reviewed the cost-benefit analysis of each host and potential cloud solution, she decided that it was the AWS custom cloud implementation made the most sense. So then I began to design an implementation using many of the AWS services. I used EC2 and ELB for the Drupal 8 cluster configuration, SES and lambda for the email forwarding, Route 53 for the domain hosting and Certificate Manager for the SSL implementation.

In all, the experience setting up the SES and coding a custom forwarding Lambda was the sticky point, but once I understood the SES requirements and applied for a limit removal, the SES system began working smoothly. Installing the SSL via CM and ELB was much easier than I could have imagined and I was successful in providing a very solid domain configuration via Route 53. Installation and configuration of Drupal 8 was a breeze with Drush and Composer! After hardening the Drupal 8 and linux box, I also set up a few custom content models and views for their recruiting management and trained them on how to add content to the site. Now everyone can hit their website via bhgriner.com!

Thursday, August 20, 2015

Making a Silky Calculator

I like Silk. This dependency injection framework is just AWESOME! It is so intuitive that I just have to give it two thumbs up. Why? Because it makes dependency injection a part of the native Java language and is definitely simple to set up and use.

So I thought I would give it a go with one of my favorite web frameworks, Vaadin. I have used Vaadin off-and-on for about a year now and I have to say it is pretty slick. Vaadin is such a quick framework. When you need to get something to the screen Vaadin can build it fairly fast. And the code is so simple, it can easily simulate procedural coding. As a result, the code you write while putting up a quick prototype usually ends up a hot mess to read through the next day.

In with the fancy patterns now!

I decided to re-create the Calculator sample application on the Vaadin.com website.

Creation of a project is easy enough. I downloaded the latest version of Eclipse (Mars) and then installed the Vaadin framework through the Eclipse Marketplace.


I had an easy time using Ant to build SilkDI from www.silkDI.com. To build the Silk library, simply import the project to your eclipse workspace and run the ant task by clicking on the build.xml file and pressing Alt+Shift+X, then press the letter Q. The library, sources and Javadoc will be created. You just need the library added to your build path.



I built the user interface up using the new Vaadin Designer tool but the thing stopped working promptly after I finished the look and feel. So I had to limp by modifying the new html format manually. Not the most fun experience...



Thankfully, the interface is simple enough, what goes into a calculator other than a few numbers and some symbols? I just made all the buttons into a grid and included a text box for the display. I had to later change the text box for a label, since the text box read-only property prevents modification from the program side as well as the user side. Wish they would make up their minds on that.

I also ran into some trouble getting the Silk to work, but that was due to my sheer ignorance when it comes to actually wiring dependencies. I did some looking at the examples on the SilkDI site and managed to make it work. I had to understand how the objects were being constructed in the background and realize which examples were worth bothering with and which were for more advanced applications.

Separating the concerns of the Presenter, View and Model were easy as cake using Java 8. Passing behavior to each button was so much easier than the Calculator example on Vaadin's own site. I went the route of creating a single method that obtained the button's text then passed a communication to the model for interpretation. I would have liked to spend more time fleshing out a better separation of the business logic out of the Presenter, but in the end, I like how it turned out.

As far as the separation goes, I added a twist to the example Calculator app on the Vaadin website and created both a BigInteger and a BigDecimal model and added a button that would switch between the two types of calculators. The calculator that depends on the Integers will truncate the decimal places for us (obviously).

Check out the sample app in the links on the right.

Update: I've put the source up on GitHub

Thanks for reading.