A Brief History on the Growth Explosion of Containers
A couple of years ago, Linux containers began to gain popularity among devs and ops folks alike. It was a win win scenario as the benefits of containers to both dev and ops are clear. As time moved along and the adoption of containers in production workloads exceeded many people’s expectations, the world needed a way to manage container lifecycles at scale.
Enter Kubernetes, while it is not the only proven open source container manager out there (see Docker Swarm & Mesos,) it certainly has the majority share of voice in the community. Originally a Google project that was a core component of their internal Borg system, it has since been open sourced and embraced by companies like Microsoft and Red Hat (OpenShift is powered by Kubernetes.) Kubernetes is an open-source system for automating deployment, scaling, and management of containerized applications.
With the Canadian dollar on the decline and the high cost of popular US-based PaaS providers like Heroku, we are finding that more and more Canadian based SaaS providers, agency development shops and IT departments are on the lookout for an alternative solution that provide similar functionality at a lower cost.
You do not have to look very far. It is no secret that we are huge fans of our partner, Cloud 66. Cloud 66 provides full stack container management-as-a-service. What does this mean? Cloud 66 is DevOps-as-a-service and it provides you with everything you need to deploy, scale and protect your applications on a number of approved public clouds, including Cloud-A.
There is a huge buzz around Docker these days, and we are huge fans of it at Cloud-A. Docker is an essential component of our Continuous Integration System and it also runs Cloud-A’s management plane. We get lots of questions from customers about how they can run their containers on Cloud-A. Here is a look at how you can use Cloud 66 DevOps-as-a-service to deploy, scale and product your doctor container on Cloud-A.
We come across clients all the time who have their applications built on Heroku, but have requirements from their clients to have their data resident in Canada. This was one of the drivers for creating the relationship we have with Cloud66. Here is a guide for migrating from Heroku to Cloud66 + Cloud-A.
About migrating from Heroku
Migrating your application from Heroku to Cloud 66 involves deploying your code, importing your data and redirecting your traffic to the new endpoint.
What server size do I need?
Using Heroku, you can choose between 1X (512 MB), 2X (1 GB) and PX (6 GB) server sizes. This makes it easy to calculate your server requirements, and we recommend that you use similar server resources when deploying your stack with Cloud 66. We also recommend that you have a separate server for your database in production environments.
Once your code is deployed, it’s time to migrate your data across. The process differs for PostgreSQL and MySQL databases:
From your Heroku toolbelt, create a database backup URL by running heroku pgbackups:url. Next, visit your stack detail page and click the Import Heroku data link. Paste the URL provided by the toolbelt into the field, and click Import Heroku data.
Finally, use the command below to import your backup into the database. You can find the generated username, password and database name by visting your stack detail page and clicking into your database server (eg. MySQL server).
$ mysql -u [generated_user_name] -p [generated_password] "[database_name]" < /tmp/backupfile.sql
Once you’re ready to serve traffic from your Cloud 66 stack, you need to redirect your traffic to it. For more information, see Configure your DNS.
Web server and Procfile
By default, Cloud 66 will deploy your stack with Phusion Passenger, but you can also choose acustom web server like Unicorn. You may have a web entry in your Procfile to do this on Heroku. Cloud 66 ignores this entry to avoid compatability issues.
To run a custom web server, we require a custom_web entry. It is important to set this before analyzing your stack, to avoid building the stack with Passenger.
You can also use the Procfile to define other background jobs.
Heroku restarts all dynos at 24 hours of uptime, which may conceal possible memory leaks in your application. When you migrate to Cloud 66, these will become noticeable because we don’t restart your workers (other than during a deployment), so the leak can grow to be bigger. A temporary solution is to re-create the Heroku restart behavior, for example with this script:
for OUTPUT in $(pgrep -f sidekiq); do kill -TERM $OUTPUT; done
This will send a TERM signal to any Sidekiq workers, giving them 10 seconds (by default) to finish gracefully. Any workers that don’t finish within this time period are forcefully terminated and their messages are sent back to Redis for future processing. You can customize this script to fit your needs, and add it to your stack as a shell add-in.
Note that this is a temporary solution, and we recommend that you use a server monitoring solution to identify the source of your leak.
Asset Pipeline Compilation
If you haven’t compiled assets locally, Heroku will attempt to run the assets:precompile task during slug compilation. Cloud 66 allows you to specify whether or not to run this during deployment.
Making your App Canadian Data Resident
Probably the simplest step in the whole process is ensuring that your application is Canadian data resident. You will need to create an account with Cloud-A. Then when you set up your stack on Cloud66 ensure that you select Cloud-A as your cloud provider of choice.
We are happy to announce our partnership with Cloud 66, a leading provider of Devops-as-a-service, giving you everything you need to deploy, scale and protect your applications on Cloud-A in a single tool.
This partnership allows Cloud-A users to deploy and manage their applications more efficiently than ever before, offering one click, automated functionality for managing the lifecycle of your entire stack on Cloud-A which allows developers to do what they do best.
This partnership is part of an ongoing effort to provide Cloud-A users with world class tools to run their workflows on our high performing, secure, Canadian resident cloud servers.
Visit our Cloud 66 solutions page here for more details.