Zero-downtime deployment

This type of deployment is applied for applications that require constant uptime. Buddy achieves that by:

A. Uploading the files to a separate directory on the server
B. Switching the symbolic link to the current version once the deployment has finished


  1. Create a new project and connect it to the repository from which you want to deploy (GitHub, Bitbucket, etc.).
  2. Add a new pipeline and set up the trigger mode and deployment branch:

Pipeline configurationPipeline configuration

  1. With the pipeline added, you can configure the deployment. Switch to the Transfer section and click Atomic Deployment:

Transfer actions rosterTransfer actions roster

  1. The last step is configuring the access details to your server, similar to setting up an SFTP deployment.
When you add the remote path to the configuration, Buddy creates folders current/, deploy-cache/ and releases/ inside this path. Make sure that your server serves the application from the $REMOTE_PATH/current folder.

How zero-downtime deployments work

A. Buddy creates 3 folders on your server in the provided path:

  • current/ – a symbolic link to the current version in the releases directory to which your web server points
  • releases/ – contains the history of uploaded releases. For each version a directory with the name of the revision tag is created
  • deploy-cache/ – used for storing new files during the deployment. Once the upload has finished, its contents are copied to a new directory in the /releases directory.

B. The template adds two actions to your pipeline:

  1. An SFTP action which uploads the changes to the deploy-cache/ folder. The deployment is based on changesets, which means that only files that changed since the last deployment are uploaded.
  2. An SSH action which performs the following tasks on your server:

    • copies the deploy-cache/ folder to the releases/$REVISION folder
    • changes the current/ symlink so that it points to releases/$REVISION
    • clears old releases – by default Buddy will keep the last 10 of them, allowing for a quick rollback if required.

Environment variables

All access data that you provide during the atomic deployment configuration is saved in the pipeline as encrypted environment variables. These variables are used in both actions, so in case you need to change the access data, you just have to edit the variables.

Environment variables in pipelineEnvironment variables in pipeline

Editing atomic deployment

Atomic deployments in Buddy can be easily edited. The template's logic is hardcoded in the SSH action: there you can manage previous versions, configure rollbacks, and set the folder to the proper release. The scripts can be freely modified by defining your own rules.

Atomic deployment configurationAtomic deployment configuration

The pipeline with the atomic template can be modified as well. For example, you can compile assets and test code for errors before the deployment, and send notifications using the selected messaging service:

Atomic deployment pipeline exampleAtomic deployment pipeline example

Last modified on July 10, 2023


Not sure how to configure a pipeline for your process? Reach out on the live-chat or contact support

Get Started

Sign up for free and deploy your project in less than 10 minutes.