Recently we've been helping one of our clients to migrate their aging website to our managed hosting service. Their hosting providers instruction weirdly marked the date in 2014 , using FTP and 100MB Email account. Which totally remind us around five years ago when we first started doing business with our clients, we deploy websites using FTP.... Well, technically we were just transferring files using FTP to our servers.
Using FTP is simple, everyone knows how to use it. We went to GoDaddy, subscribed a shared hosting package and messed around with some account password and settings. We then configured Coda, our IDE of choice at that time, to use the FTP credential we just created. Wa-lah, we are all set.
It worked beautifully, every time we pressed Command + S to save the file we were working on, it got uploaded to the server via FTP automatically. When our clients wanted to change the background color of the website, no problem, we edited the CSS file, save it and we were done!
After a while, we featured we needed some sort of backup system to safeguard our code, just in case we accidentally deleted everything via FTP. We came across with Git, featured out it was also a good time to have a proper version control system to maintain our code base.
But how were we going to deploy websites using Git? Should we stick we FTP? Or should we use git hook with a branch of SSH commands?
As our business grows, we were hosting more and more of our clients' websites and apps. Things got really complicated when you were dealing with multiple websites on a single server. You had to create users, handle permissions, get sites set up with Nginx configuration, DNS, security and stuff. It's just a nightmare.
We once thought of using cPanel to solve all these problems, but cPanel didn't support Ubuntu and Nginx which we relied on heavily. Not to mention cPanel's ugly UI and UX, so cPanel is a no go for us. Luckily, Plesk released a major update at that time, it supports Ubuntu and Nginx, allowing us to use the Plesk hosting panel to maintain our clients' websites and apps.
Plesk also came with Git deployment and it's easy to set up. Fill in the URL of our project repositories, configured it to deploy only for master branch, set up a git hook and it's all set.
With Plesk and Git, we ditched FTP and moved on to Git deploy!
Things got really nice, we grew again and started to develop complex web applications for our clients. We needed some sort of "zero-downtime deployment" solutions. We came across with Buddy, a very useful SAAS for continuous deployment.
What we liked most was its fancy UI and its ability to use any docker images to build apps and deploy. For a standard Laravel project, we needed composer to install PHP dependencies, NPM to run webpack and PHPUnit to test. These settings could be configured using their GUI. It also came with atomic deployment built in (it's actually just a branch of SSH scripts to transfer files and symlinking), allowing us to install dependencies, test and deploy atomically to our Plesk servers.
So far so good, things got really nice, we grew again and started to develop complex web applications for our clients. We used PHP7 and Laravel framework to kickstart these projects and quickly faced a problem: how can we install and manage PHP versions and its dependencies in our computers and servers?
Some of our sites needed PHP5.6 while some of them needed PHP7. We didn't want to upgrade and downgrade our mac's PHP version every time when we switched between projects, it just didn't make sense.
Docker came to recuse! We forked Laradock (a Docker PHP development environment that facilitates running PHP Apps on Docker), built our own docker images on top of it and used Docker Compose to "bootstrap" our development stack. Problem solved for our local machines, but how about our servers?