Skip to content

Deployment Workflow

It doesn’t matter what type of project you want to deploy on a VPS or cloud server—the steps remain the same.

Order a Server and Domain Name

Before you start deploying, you need to create an account with a cloud provider, order a server, and be able to log in to that server. You’ll also need a domain. We’ll cover this in detail with cloud provider recommendations in the chapter “Getting a Cloud Server, Setting Backups.” If you already have a server with Ubuntu 22.04 and a domain name, you can skip that chapter and proceed to “Server Provision.”

Server Provision

Once you have your server and can log in, the next step is to install the necessary tools. This is straightforward, even if you have no prior experience with Linux or server administration. All you need to do is run a set of commands in the terminal. The chapter “Server Provision” will walk you through the commands to install the required deployment tools. “Provisioning” simply means installing everything you need to deploy your project.

Setup Security

Before deploying your projects, you should secure your server by closing unnecessary ports to prevent unauthorized access. This will ensure that your projects are only accessible via HTTPS or WSS (for WebSocket projects), and not through URLs like http://ip_address:port. We will also discuss how to protect communication between multiple servers within the same data center or across different locations in the chapter "Security."

Prepare Your Project

In most cases, there’s nothing special to do when deploying your project for the first time, as long as you’re not using containers. If you are using containers and have a Dockerfile or Docker Compose in the project repository, you’re all set. However, as your project grows and goes into production, you may need separate environments (e.g., production and testing). The chapter "Prepare Your Project" will guide you through deploying multiple environments from a single repository.

Deployment from a Local Machine

There are two ways to deploy your project. The first option is to deploy directly from your local machine by uploading code from your local repository to the server. This method works even if you don’t use Git. We’ll cover this in detail in the chapter “Deployment from a Local Machine.”

Deployment from GitHub, Bitbucket, and GitLab

The second option is to deploy projects using GitHub, Bitbucket, GitLab, or even a custom Git server. The idea here is to push code to a remote Git repository and then pull the code from that repository onto the server. This method will be discussed in the chapter “Deployment from GitHub, Bitbucket, and GitLab.”

That’s it! The steps above are the basic, essential steps for deploying a web app. Most actions within these steps only need to be done once per server, and they can be automated. In the chapter “Server Provision,” you’ll find scripts to automate the server provisioning process. Once these steps are completed, your infrastructure will be capable of hosting multiple apps, projects, or services on a single server. Each app can be accessible via its own domain, subdomain, or subfolder with HTTPS. For example, you could have a static website at domain.com and a blog powered by Ghost CMS at domain.com/blog. While there are many ways to achieve this, our method is likely the simplest.

Advanced Deployment Options

If your project is more than just an internal app and you plan to update it frequently, you can set up Continuous Integration and Continuous Delivery (CI/CD) to automatically deploy updates whenever you push changes to the Git repository. This will be covered in the chapter “CI/CD,” where we’ll set up auto-deployments from a local Git repository, as well as from GitHub, Bitbucket, and GitLab.

When you notice that your server, even with the maximum allowed CPUs and RAM, is running at 50-60% capacity or more, or if your project is live and you have extra time, it might be time to think about distributing the load across multiple servers. This will be covered in the chapters “Load Balancers and DNS Balancers” and “Autoscalers.”

To simplify testing your project with external services (for example, when handling webhooks or integrating payments), or to showcase a project running on localhost without redeploying it each time, you can set up localhost tunnels. This will be explained in the chapter “Localhost Tunnels.”