How to Build SaaS Using Docker-based Tools — Part 1

Written by igor.petrov | Published 2017/06/27
Tech Story Tags: docker | saas | aws | cloud | infrastructure

TLDRvia the TL;DR App

If you’ve ever thought about using Docker for building SaaS, you probably asked yourself if you want to do this from scratch or utilize software (basically that does infrastructure orchestration) reducing complexity and simplifying boilerplate tasks. I came to this as well and decided to try the second option because this is much closer to developers/devops. Of course, in opposite, it imposes some limitations, but for a quick start on MVP building, this is the preferred option.

Where to start from?

When I’ve chosen to go with special libraries making life easier for me as developer, I looked at several of these but finally chose 2 — Docker Cloud and Kontena. Their positioning differs but in general both can handle similar tasks — creating and managing node clusters/grids, stacks, services, managing Docker images repositories, networking and other orchestration tasks.

In fact, it’s correct to compare Docker Swarm with Kontena Platform and Docker Cloud with Kontena Cloud but I’m going to compare both including every aspect — even cloud options and UI. Need to mention you could try both absolutely for free.

Docker Cloud

This was the first I’ve tried and need to be honest — I surrendered :-).

First of all — if you’re going to build Docker-based SaaS — you need to have an ability of quick and simple clusters and nodes provision. Docker Cloud has two modes — standard and swarm. In standard mode you will work with nodes, services, and apps as separate parts of your entire infrastructure, in swarm mode — you will utilize Docker swarm approach so you’ll have pretty solid infrastructure combining all your nodes into a unified interface with REST API.

Docker Cloud at this moment offers support of 5 cloud providers for your nodes: AWS, Digital Ocean, Microsoft Azure, SoftLayer and Packet. I’ve decided to go with AWS. For connecting Docker Cloud and AWS you need to set up some stuff on Amazon IAM — create a role and inline policy specifying permissions you may need — and paste resulting Role ARN on Docker Cloud settings page. Then you should be able to provision swarm cluster (if you’re in swarm mode) or standard node cluster straight from Web UI or utilizing CLI.

Looks cool, but what’s wrong with it?

The first frustrating thing for me was discovering that swarm mode doesn’t have REST API yet. So, in theory, I could launch swarm cluster, but it won’t be useful because I can’t access it from SaaS web app. Ok, no problem, you can use mature standard mode — https://docs.docker.com/apidocs/docker-cloud/.

The second one is connecting AWS mess: as I described above you need to create a role and a policy by following this guide — https://docs.docker.com/docker-cloud/cloud-swarm/link-aws-swarm/ (looks complicated, right?). Your policy document should be based on this one — https://docs.docker.com/docker-for-aws/iam-permissions/ — that’s how I did it. Ok, now I’ve got Role ARN and pasted it on Docker Cloud — setup completed. But when I’ve tried to create a node cluster, it just didn’t work. This is what I’ve got under new Node Cluster “Timeline” tab (displays some logs):

AWS returned an error: unauthorized operation. Please check that the AWS credentials you have provided have enough permissions

Believe me, I’ve tried many many times: terminated clusters and created new ones, chose different AWS regions, tried re-creating role and policy, edited policy by completely redefining it or adding/removing several concrete permissions, surfed Docker Cloud forum, repeated all of these again — no luck.

And the third frustrating thing was community silence or even community absence (except some enthusiasts). Looks like Docker Cloud team is not involved in discussions on the official forum. Just look at these topics below — they look dead.

Cannot create node cluster on AWS - unauthorized operation_Hi, I've connected the Docker account to AWS like described here https://docs.docker.com/docker-cloud/infrastructure…_forums.docker.com

Access GUI created swarm via API_I successfully created a swarm using the docker cloud UI. It's dpeloyed to AWS and I can run stuff on it via the client…_forums.docker.com

Next, please!

As I mentioned in the beginning of my post — I surrendered… and decided to look towards Kontena which I’m going to review in Part 2.

In general, Docker Cloud looks very promising and cool instrument for building infrastructure or microservices-based SaaS and I believe they can quickly become a leader in this. But these days Docker company’s rapid growth, on the contrary, prevents them from doing several things well. In my humble opinion.


Published by HackerNoon on 2017/06/27