Blog

Sage Northcutt Hype Derailed

By richardtylee.
Sage Northcutt Dana White Ufc 192

Saturday's UFC on Fox 18 (officially UFC Fight Night: Johnson vs. Bader) saw the derailment of the UFC hype train for 19-year-old prospect "Super" Sage Northcutt.  UFC President Dana White signed Northcutt filming his reality Youtube series Looking for a Fight.

Northcutt set himself apart from the pack with his Abercrombie model looks, flashy style and humble aw-shucks personality in front of the camera.  His UFC 192 pre-scrum video was picked by none-MMA sites like break.com.  Besides being good on camera, Sage is also a karate champion, Brazilian jiu-jitsu purple belt and has seven professional MMA wins (all finishes and coming in 2-0 in UFC).

Deploying Docker Hub Image to Elastic Beanstalk: i/o timeout

By richardtylee.

A few months back we saw the following error while trying to deploy a Docker image to AWS Elastic Beanstalk:


Command failed on instance. Return code: 1 Output: 
[CMD-AppDeploy/AppDeployStage0/AppDeployPreHook/03build.sh] command failed 
with error code 1: /opt/elasticbeanstalk/hooks/appdeploy/pre/03build.sh P
ulling repository username/repo 2015/10/23 22:50:35 Get 
https://registry-1.docker.io/v1/repositories/username/repo/tags: read tcp 10.0.0.1:443: 
i/o timeout Failed to pull Docker image username/repo:latest: Pulling repository 
username/repo 2015/10/23 22:50:35 Get 
https://registry-1.docker.io/v1/repositories/username/repo/tags: read tcp 10.0.0.1:443: 
i/o timeout. Check snapshot logs for details..

At first, it happened intermittently; maybe a third of the time.  After time, it occurred more than two-thirds of the time.  This ended up bottlenecking our QA team.

Why Cruz-Dillashaw Rematch Shouldn't Happen

By richardtylee.

Sunday saw the greatest career comeback in MMA history.  The original UFC Bantamweight Champion, Dominick Cruz, recaptured his title over T.J. Dillashaw.  Cruz had only fought one minute and one second in the UFC Octagon in the last four years because of three knee surgeries (all torn ACLs) and a torn groin.  He also came into the fight with an undisclosed foot injury.

Cruz won a close and very technical match by split decision.  Many analysts had Dillashaw winning the fight.  Several commentators have already called for an immediate rematch.  While the last match was fun and had decent buildup, there isn't an need for Cruz and Dillashaw to rematch right away.

Championship rematches have been overdone the last few years.

Scale Down to Zero on Elastic Beanstalk

By richardtylee.

AWS Elastic Beanstalk simplifies application management, with server scaling out-of-the-box.  Scaling is pretty idiot-proof.  In fact, if you try to scale down to zero instances, you get the following:


MaxBatchSize: Invalid option value: '0' (Namespace: 'aws:autoscaling:updatepolicy:rollingupdate', OptionName: 'MaxBatchSize'): Value is less than minimum allowed value: 1

A few weeks ago, I was asked to scale an environment down to determine if there was any adverse effect in terminating it.  Basically, we would scale down to zero and see if anyone missed it being alive.  In order to do this, we had to go around Elastic Beanstalk and using the Auto Scaling Group:

  1. In the AWS Console, go to Compute -> EC2
  2. In EC2 Dashboard, go to AUTO SCALING -> Auto Scaling Groups
  3. Use the Filter text box to find the auto scaling group for my environment.  Typing in the environment name (e.g. stag-rails-app-s1) should work.
  4. Click on your auto scaling group.
  5. In the Details tag, click the Edit button.
  6. Set the Desired and Min to 0.
  7. Click the Save button.

NW.js App Data Storage

By richardtylee.

I ran into an issue is week where our NW.js desktop application keep running into the same issue, even after a refresh reinstall.  The user had this application installed on their local machine before.  The answer was that we also need to delete the local app data, store in:

  • For Mac OS X,  ~/Library/Application\ Support/SOME_NW_APP
  • For Windows 8, C:\Users\%USERNAME%\AppData\Local\Chromium\User Data\Default

Thanks to Mike Ball for the info!

Brian Ortega Representing Gracie Jiu Jitsu at UFC 195

By richardtylee.

Brian "T-City" Ortega is showing how jiu-jitsu should be used in MMA.  Training out of the Gracie Jiu-Jitsu academy in Torrance, California, Ortega is a black belt under Rener and Ryron Gracie.

At UFC 195, Ortega faced Diego Brandao, a fellow jiu-jitsu black belt and an Ultimate Fighter Champion.  Down 20-18 after two rounds, Ortega needed a finish.  Starting in front headlock position, Ortega chained a beautiful set of transitions together: d'arce choke, to mount, to triangle.

Chef::Exceptions::ChildConvergeError While Deploying to OpsWorks

By richardtylee.

I attempted to deploy my Rails app to AWS OpsWorks and get the following error:


[2016-01-01T08:39:36+00:00] ERROR: Running exception handlers
[2016-01-01T08:39:36+00:00] ERROR: Exception handlers complete
[2016-01-01T08:39:36+00:00] FATAL: Stacktrace dumped to /var/lib/aws/opsworks/cache.stage2/chef-stacktrace.out
[2016-01-01T08:39:36+00:00] ERROR: deploy[/srv/www/myapp] (deploy::rails line 65) had an error: Chef::Exceptions::Exec: if [ -f Gemfile ]; then echo 'OpsWorks: Gemfile found - running migration with bundle exec' && /usr/local/bin/bundle exec /usr/local/bin/rake db:migrate; else echo 'OpsWorks: no Gemfile - running plain migrations' && /usr/local/bin/rake db:migrate; fi returned 1, expected 0
[2016-01-01T08:39:36+00:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1)

OpsWorks doesn’t give the best logging from the AWS Console. All we know from this is that the deployment failed on the following line:


if [ -f Gemfile ]; then echo 'OpsWorks: Gemfile found - running migration with bundle exec' && /usr/local/bin/bundle exec /usr/local/bin/rake db:migrate; else echo 'OpsWorks: no Gemfile - running plain migrations' && /usr/local/bin/rake db:migrate; fi

This means that it failed during a migration, but several possible issues could have caused that call to fail. As John C. Bland suggests, the best option to SSH into the EC2 instance and get the stacktrace.

If you haven’t set up ssh access to your instances, you can read: http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-key-pairs.html

When I ssh’ed into my instance and tried to run /usr/local/bin/rake db:migrate, I found a handful of problems. These are just a few that I encountered:

"Ruthless" Robbie Lawler at B/R

By richardtylee.

The day "Ruthless" Robbie Lawler was the B/R office enforcer.

Lawler defends his belt tonight against "The Natural Born Killer" Carlos Condit at UFC 195.

Create a Website with Refinery CMS and Bootstrap

By richardtylee.

The birth of any startup begins with a dream. Then they need a website. The goal for this post is to describe how to quickly create a website.

I often see companies use drag-and-drop platforms (like Wix and Weebly) or contract out developers to create a Wordpress website. While they may meet certain needs, these platforms have limitations and may fail meet business needs as a company grows. To make a custom changes, developers often have to work around the framework and hack domain-specific features. Since these platforms are made to be generic and for quick development, performance is often sacrificed and maintenance is more difficult. A company contracts out to have one of these sites built and is left owning a codebase that they cannot maintain themselves.

As a developer, I want to make my life and lives of my company or client easier. To do this, we’ll use Refinery CMS. Refinery is a content management system written for Ruby on Rails. Refinery CMS will allow the user to easily and quickly change content on the site. Since it is using Rails, it does not get in the way of future coding development.

Rails is a well-established web framework, with many libraries written for it. I’ve been doing Ruby and Rails work professionally for several years. Relative to other technologies, it is easy to learn. And the large community makes it an easy skill to hire for, if the business grows.

Refinery also has a very active community. Many common issues can be found through Github, StackOverflow and Google. And the code updated very often. Refinery is built as an engine, which means it can be integrated into an existing Rails website. It also allows the developer to do things the “Rails way”, so no invasive hacks or workarounds are needs to add custom features. There are also many useful extensions. One that I will be using is refinerycms-blog.

Ryan Bates has some very good railscasts on Refinery (though a bit dated):
http://railscasts.com/episodes/332-refinery-cms-basics
http://railscasts.com/episodes/333-extending-refinery-cms

Besides that, check out the official site and repos:
http://www.refinerycms.com/
https://github.com/refinery/refinerycms
https://github.com/refinery/refinerycms-blog

Besides functionality, we also want to make a presentable user interface. To save development time, we will use Bootstrap. Bootstrap is a front-end framework (HTML, CSS and JS) developed at Twitter, then open-sourced. It codifies many of the best front-end practices and styles. This allows developers to create presentable websites quickly. For better or worse, it is also why many of today’s website look the same.

Checkout the official Bootstrap documentation: http://getbootstrap.com/

And railcast (again, dated): http://railscasts.com/episodes/328-twitter-bootstrap-basics

There is even a gem available that integrates Bootstrap into Refinery: https://github.com/fernandoaleman/refinerycms-bootstrap

Now on to creating the website.  Let's assume Rails is already installed locally.

  1. Create the Rails app.  Let's call it myapp.
    1. In the terminal, enter: rails new myapp
  2. cd into the myapp directory
  3. Integrate Refinery CMS.
    1. In Gemfile, add:
      
      gem 'refinerycms', '~> 3.0' 
      
      gem 'quiet_assets', group: :development
      
      # Add support for searching inside Refinery's admin interface.
      gem 'refinerycms-acts-as-indexed', ['~> 2.0', '>= 2.0.0']
      
      # Add support for Refinery's custom fork of the visual editor WYMeditor.
      gem 'refinerycms-wymeditor', ['~> 1.0', '>= 1.0.6']
      
      # The default authentication adapter
      gem 'refinerycms-authentication-devise', '~> 1.0'
      
      gem 'sprockets-rails', '~> 2.3.3'
      
      
    2. Note: At the time of this post, sprocket-rails had an issue.
    3. In the terminal, enter: rails generate refinery:cms
  4. Integrate Refinery CMS Blog.
    1. In Gemfile, add:
      
      gem 'refinerycms-blog', git: 'git@github.com:refinery/refinerycms-blog', branch: 'master'
      
      
    2. In the terminal, enter: rails generate refinery:blog
    3. In the terminal, enter: rake db:migrate
    4. In the terminal, enter: rake db:seed
  5. Integrate Refinery Bootstrap.
    1. In Gemfile, add:
      
      gem 'refinerycms-bootstrap', :github => 'fernandoaleman/refinerycms-bootstrap', :branch => '2-1-stable'
      
      
    2. In the terminal, enter: rails generate refinery:bootstrap

Now start your rails application. In the terminal, enter: rails s 

That's it!