Phorest Cloud runs on Amazon Web Services. Last year, we made the decision to migrate the services that Phorest Cloud runs on to Docker. Each service was previously running on dedicated EC2 instances. We chose to use ECS (EC2 Container Service) as the tool to host Docker and orchestrate our deployments, and I’d like to share some of the things that happened as a result of the move to Docker and ECS.
We invested time in removing state from our system. ECS then let us deploy multiple tasks for our services, meaning we always have available containers to serve traffic, meaning we are now highly available.
We are resilient to containers going down. If one in the system did, ECS will deregister it from the load balancer, deploy a new task, and register that task with the load balancer.
We moved into a VPC, meaning we could lock down traffic. We no longer need ssh access to machines. Furthermore, our containers get IAM roles, and these roles are constrained to only what they need, meaning no more AWS access key and secrets floating around.
Moving to Docker made us also see the importance of centralized logging. We now stream all container logs to Logentries, where they can clearly be traced and analyzed.
When our system gets busy, we scale up more containers to handle the traffic. When it's not busy, we can remove those extra containers. As the business grows, we can easily bring up more containers to each service to handle the load.
Something that is nontrivial to achieve is green-blue deployments. ECS, out of the box, allows us easily deploy new code without downtime. New containers come up, existing container connections get drained, and the new containers get registered with the load balancers when they become healthy.
Cheaper AWS Bill
Moving to VPC allowed us to migrate databases to Aurora. It’s a more cost-effective alternative to MySQL, which needed heavy provisioned IOPS. Going to Aurora allowed us to take advantage of its failover, reader/writer endpoints, the new storage engine, and better handling of connections. Being in the VPC also allowed us to use the latest (and best) Amazon instance types.
By being able to forecast our capacity meant we could take out reservations on our instances and avail of massive Amazon discounts.
We are a bootstrapped company with ambitious goals. We care about costs and, more importantly, being able to predict them. We are now paying 25% less than our old infrastructure, and what we have now is far superior.
Efficiency and Consistency
With Docker and ECS deployments, we don’t need to worry about provisioning instances, configuring them, or versioning hell (Linux, Ruby, Java, etc). We can focus more on building the platform and not on operations (we have no dedicated ops person). Our applications are all deployed the same way for dev, staging, and production, meaning it’s easier for everyone to understand.
Fast Deployments. Really Fast.
Before the move, we had the whole system in one Cloudformation stack. It was a slow, painful process to build and deploy our system. We now deploy services multiple times a day via Jenkins and our new deployment scripts — built using AWS boto3.
Because of the elasticity and resilience we have become stable, we no longer suffer unforeseen outages or worry about issues out of office hours. The system is the most stable it has ever been.