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
- Create a new project and connect it to the repository from which you want to deploy (GitHub, Bitbucket, etc.).
- Add a new pipeline and set up the trigger mode and deployment branch:
- With the pipeline added, you can configure the deployment. Switch to the Transfer section and click Atomic Deployment:
Transfer actions roster
- 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
releases/ inside this path. Make sure that your server serves the application from the
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
releasesdirectory 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
B. The template adds two actions to your pipeline:
- 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
An SSH action which performs the following tasks on your server:
- copies the
deploy-cache/folder to the
- changes the
current/symlink so that it points to
- clears old releases – by default Buddy will keep the last 10 of them, allowing for a quick rollback if required
- copies the
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 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 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 example