Author: Nic Raboy

Bulk Remove Unconfirmed Sendy Subscribers After A Certain Number Of Days

May 12, 2017 Nic Raboy

You may or may not know this, but I use Sendy to send out my monthly newsletters because it is incredibly cheap in comparison to competitors like Mailchimp. Anyone who has done list building before knows that over time you’re going to end up with a lot of stale subscribers that need to be cleaned in an effort to save space and keep things organized.

My email lists require a secondary opt-in to prevent SPAM subscriptions. The problem with this is I still get a lot of SPAM subscriptions even if they are never included in my newsletters. These subscriptions have no business being in my list, so it is best to remove them after so long.

We’re going to see how to use SQL to remove unconfirmed email subscribers in Sendy after so many days.

Read More

Implement 2FA With Time-Based One-Time Passwords In A Node.js API

May 10, 2017 Nic Raboy

Not too long ago I wrote about authenticating within a Node.js API using Json Web Tokens (JWT). The basis of the example is around authenticating via a username and password and receiving a JWT for every future request against the API. While that example is incredibly useful and follows best practice, it doesn’t cover the scenario where you’d like to have a two-factor authentication (2FA) option for your users. In case you’re unfamiliar, 2FA is a second layer of protection for accounts made possible by a time-based token generated by a shared secret key.

We’re going to see how to add a two-factor authentication option to our Node.js API while continuing to use Json Web Tokens.

Read More

Concurrent Golang Applications With Goroutines And Channels

May 8, 2017 Nic Raboy

One of the highlights of the Go programming language is its ability to handle concurrency with minimal effort using what are called goroutines and channels. The beauty here versus other programming languages is that you don’t end up in a callback mess or locking hell. In fact, you can even create far more goroutines in Go than you can in a language such as Java with the same hardware.

We’re going to see an example where we have an application that starts several worker goroutines and shares a channel for accessing data.

Read More

Load Balancing A Docker Swarm Cluster With An NGINX Reverse Proxy

May 1, 2017 Nic Raboy

If you’ve been working towards containerizing your web applications like I have, you might be at a point where you’re ready to start clustering your containers. Previously I had written about creating a container cluster with Docker Swarm and using NGINX as a reverse proxy for a few containers. The catch here is that neither of these previous tutorials were meant to work together. In the previous example we were using a reverse proxy for containers on a single server. While Docker Swarm offers it’s own load balancing, you’ll find it makes sense to have NGINX as well because not every container can run on the host as port 80.

We’re going to see how to create two service containers that are replicated across several nodes. These services will be a simple Apache and NGINX web applications. Then we’re going to throw an NGINX reverse proxy into the mix that keeps track of the upstream nodes for its own load balancing.

Read More

Cross Compiling Golang Applications For Use On A Raspberry Pi

April 28, 2017 Nic Raboy

I recently invested in yet another Raspberry Pi, this time the new Raspberry Pi Zero W, which has wireless and bluetooth. I also made a leap and bought the camera module with it because the new official case by Raspberry Pi has a camera attachment. Probably the most popular development technology for Raspberry Pi is Python, but I am not a fan at all. Instead, I’ve been doing a lot of Go development and figured that would be my best bet when it comes to developing a camera application for the Raspberry Pi. The problem with this is that if I were to compile a Go application on the Raspberry Pi Zero itself, it would probably take ten years (I joke).

Cross compiling is a thing and we’re going to see how to do this via a different operating system and architecture, yet have it be compatible on the Raspberry Pi.

Read More

Using A SQLite Database For Local Data In A Golang Application

April 24, 2017 Nic Raboy

When developing an application with the Go programming language, you might find yourself needing to save data locally. If you’ve been keeping up you’ll remember that I’ve written about storing data remotely with Golang in a Couchbase NoSQL database, but never anything locally. Probably the easiest way to store data locally is with a SQLite database as it is a solid technology that has been around for a while.

We’re going to see how to use a SQLite database in our Golang application to read and write local data.

Read More

Using The Docker Client With A Remote Machine Or Virtual Private Server

April 21, 2017 Nic Raboy

Not too long ago I wrote about containerizing a bunch of web applications and putting them behind an NGINX reverse proxy. This is because I’ve been exploring the possibility of taking all my personal applications and turning them into Docker containers for easy maintenance and portability. I currently use Digital Ocean and if I had to guess, I’m going to be using it for a lot longer as it is a great service. So what does it take to get containerized applications on Digital Ocean or any other remote machine?

We’re going to take a look at creating and defining a remote machine in Docker and deploying containers on it.

Read More