Photo of a brown and white border collie dog, DNX logo in bottom left corner.

The Challenge

If you don’t know Cpanel, think of it as an all-in-one open-source box. Cpanel is a powerful hosting server with built-in services such as Apache, PHP, Mysql, and Named for DNS. It allows you to create customised hosting packages and host customers over them. Usually, it’s well suited to small customers. The biggest challenge starts when you put more and more load within the same box.

What about a scenario where you don’t have a single hosting package although you have built your solution years ago over Cpanel APIs? These APIs are used to provision email accounts, FTP users, DNS records, and so on.

You would end up with an infrastructure design like this:

All-in Cpanel

Even though you have a big server to handle all the workloads, what happens if the server goes down? And if you have that server hosted in a third-party data center? You would have to raise a ticket and wait for their answer. Meaning a big downtime ahead.

The Solution

Since decoupling services and applications into micro-services is a complex and long process, the fastest solution was to lift and shift the server to a similar Cpanel server on an EC2 instance.

That choice gave time to the developer teamwork on the overwhelming applications while allowing some standard applications to be pushed to the Cloud.

Previously, all the PHP Laravel APIs running on that box were modernised to docker images and deployed on ECS.

Check it out our open-source terraform ECS cluster module:

And our module to deploy ECS applications such as PHP Laravel:

If you want to find out more about application modernisation for PHP, Node, Ruby, etc, check out our website:

DNS to Route 53:

Dumping all Route 53 records from a Cpanel server is a pain in the neck. Why’s that? Because Cpanel usually creates a lot of ‘useless’ records if you’re creating a single domain or subdomain.

We managed to have all the DNS records and values and we’ve created all of them on Route 53.

There is no simple way to dump the DNS records on Cpanel. Be aware of that.

It is always DNS

Mysql to RDS:

The databases on Cpanel are created with a strange prefix to avoid duplication. We’ve got a dump of all databases, and using the python script below, we ran a 40 or so parallel syncs to restore all databases:

https://github.com/DNXLabs/tools-box/blob/master/scripts/parallel-script/parallel_db_restore.py

Now we have a server running on AWS and at least some ways to handle the forthcoming problems.

Right now, the solution is not yet finalised, so stay tuned for our next posts where we will update you with the next stages of this migration.

To Be Continued…

Na DNX Brasil, rabalhamos para trazer uma melhor experiência em nuvem e aplicações para empresas nativas digitais.

Trabalhamos com foco em AWS, Well-Architected Solutions, Containers, ECS, Kubernetes, Integração Contínua/Entrega Contínua e Malha de Serviços.

Estamos sempre em busca de profissionais experiêntes em cloud computing para nosso time, focando em conceitos cloud-native.

Confira nossos projetos open-souce em https://github.com/DNXLabs e siga-nos no Twitter, Linkedin or YouTube.

Tenha informações das últimas previsões e atualizações tecnológicas

 

Sem spam - apenas novidades, atualizações e informações técnicas.

Related Posts