The 5 Stages of VPS Deployment Strategies
No matter whether you’re using SSD Nodes for your personal website hosting, game server, or as the home for your startup’s SaaS application, there will probably be a point where you need to take code from your local machine and send it to your server.
There’s an incredible variety of methodologies and applications that can aid in the transfer, along with a number of solid techniques and best practices to go along with each—far too many to discuss in detail here. Even then, we find that individuals and small organizations go through a fairly predictable number of stages along the journey to a solid, replicable deployment strategy.
For better or worse, cPanel has made File Transfer Protocol (FTP) access to VPS’s easier than ever, and it’s often the first solution that individuals and small teams turn to. FTP and its secure variant (SFTP) allow users to transfer large batches of files between two machines, and while the protocol used to be accessed using command-line tools, GUI-based solutions like Filezilla have taken a dominant role.
VPS PLANS STARTING $3 PER MONTH!
All our Standard plans, from 4GB to 32GB RAM, are at a super 22% discount today! 🚀
This means that you can own a VPS starting at $3 per month! To get the discount, choose any Standard Plan and use the code SUPER22 at checkout.
While (S)FTP is relatively easy to set up, thanks in part to cPanel and other dashboards, it was never really designed to be a secure protocol for regularly deploying code to a remote server. With that in mind, most people move on quickly, and we don't necessarily recommend relying too heavily on FTP.
Secure Copy (SCP) and rsync are two different programs that aim to do the same thing: copy the contents of a particular folder (or the folder itself) onto a remote machine. They both utilize the SSH to connect to the remote server and send information across the wire securely, which is an added plus over FTP.
(For more information about how to use incredibly secure key-based SSH logins, check out our ebook: "The 6 Critical Steps to Secure Your Servers.")
|Can you make sense of these rsync caommands? It's not as complicated as it looks.|
One benefit of rsync is that it doesn't just copy the files over—it uses delta encoding to understand the differences between every file on the local machine and every file on the remote machine. That means you're only sending over the code that's changed, which leads to quicker uploads.
You might already be using Git for some of your workflow, whether you're an individual taking advantage of multiple branches, or part of a team who need to contribute to the same codebase. Git can be used like rsync to selectively copy new changes onto the remote machine, and adds in the benefit of built-in version control.
|One of the infinite organization strategies available via Git.|
It's possible to log into your remote machine and perform a `git pull` to download new code to the VPS, or you can set up a Git hook, which executes a custom script whenever you commit new code, for example. From your local machine, it's possible to commit a change and have it automatically pushed to your VPS.
A major issue in using a VPS to deploy a website or a SaaS application is that sometimes minor differences in hardware or software versions can mean an application that works on your local machine won't work once you deploy it to your VPS.
Docker and Vagrant are two applications that create "containers" or "environments" for your application, so that you know your development environment is exactly the same as what you'll deploy to on your VPS. On top of that, a containerized deployment means that all your applications are kept separate, which improves security and minimizes the impact of crashes.
Both of these solutions are a large step up in terms of development and deployment complexity, and are mostly for advanced users who are deploying large volumes of code to important production environments.
5. Ansible/Chef/Puppet and other configuration managers
The last practical step for VPS deployment strategies tends to be the variety of configuration management suites available, such as Ansible, Chef, Puppet, and more. These applications aim to automate the entire IT/deployment process, are even more complex than adding in Docker/Vagrant.
|An example of the Ansible Tower interface.|
The pros of these systems are that once you create the automation, they'll be set for a very long time, and can be expanded across many different nodes to create a true infrastructure for high-volume SaaS applications. If that sounds like too much complexity for your personal use, you're probably right—it makes more sense to spend your time hardening your server's security, learning a new programming language, or coding up your next big project, or doing one of the other many things that a VPS is capable of.