Event Notifications in Rails 5 with ActionCable!

activity-02-2016

Here at Onehub, we have an activity log for actions users perform. That way you can see when Workspaces, files and folders are created, moved, deleted, or downloaded. You can also see when comments and messages are made as well as many other events.

Currently, we maintain a separate project that handles streaming these events to your activity log. This project is a piece of legacy software (read: hard to maintain and confusing to trace). With the release of Rails 5.0.0beta2, we took a dive into one of Rails 5 most exciting new features, ActionCable.

ActionCable greatly simplifies the complexity of getting websockets up and running to stream real-time event notifications to the activity log. We can now have our activity log logic live right alongside our application logic.

Based on a video tutorial by DHH for a chat app, I put together a short tutorial on how to get an event system up and running in the new Rails 5 app. This tutorial assumes you have created a new Rails 5.0.0beta2 (installing Rails 5 here) project and have a redis server up and running (installing redis).

Lets make some events!

First we’re going to make our event model. An event will have a message, and we’ll use it’s created_at field for the timestamp

$ rails g model event message:string

Continue reading

When setting up a NAT gateway with Amazon VPCs, size matters

oh-dev-series-blue

Amazon’s cloud computing services have made launching an app or a startup easier than it has ever been. Sometimes getting set up may be a little too easy and you can overlook a simple step that can save your business time, frustration and money.

Paying attention to the size of your NAT gateway is really important when creating your Amazon Virtual Private Cloud (VPC) computing environment, and it’s important to monitor as your business scales.

The NAT gateway is what allows your VPC to communicate with Amazon services, the Internet, and more importantly — your customers. It will impact the speed with which your end users will be able to complete the tasks they want to perform through your service. The selection of the NAT gateway instance size is a simple drop-down menu. But it’s a drop-down menu you should pay attention to! Continue reading