We're thrilled to announce that atomic deployments are now available in Buddy!

What are atomic deployments

The aim of atomic deployments is to eliminate the maintenance window so that your app is always available to the user. Derived from the database lingo, the concept of atomicity means a deployment that has either been executed completely or not executed at all, leaving no trace to the working code on the server. This means that your live website will only be updated once the deploy has finished successfully.

Using atomic deployments is especially recommended when:

  • you need to deploy lots of files to the server, which is time-consuming
  • the website involves additional services and dependencies that require migration
  • there are special prerequisities regarding updating servers in your company
  • the nature of the service you run doesn't allow for a downtime
Atomic deployment template
Atomic deployment template

How it works

The whole process is handled entirely by two actions — SFTP and SSH — and involves creating a couple of directories on the server:

  • /current - the directory to which your web server points. It containing a symbolic link to the current website version in the /releases directory.
  • /releases - contains the history of uploaded releases. For each version a directory with the name of the release tag is created. This allows for a quick rollback of changes.
  • /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.

In short, when the deployment is triggered, Buddy will first deploy the files to the cache directory on the server, copy the files to a newly created release directory, and switch the symlink of the web server to the new version.

Expanding your pipeline

Contrary to other deployment services, Buddy makes it very easy to customize and expand the workflow by adding additional actions. For example, you can update your assets on Amazon S3 and send a message to your Slack channel when the deployment is complete:

Customized pipeline
Customized pipeline

Restoring changes

To roll-back changes to a previous version, just select the release in the Run window and Buddy will switch the symlink on the server:

Rolling back changes
Rolling back changes

You can clear release and cache directories on the server at any time. In case you need to roll-back to a previous revision, Buddy will simply upload the files again.

Final word

Atomic deployments are the first in the upcoming template series. We're looking forward what kind of templates you'd like to see next — just leave a comment here or drop a line to support@buddy.works.

Happy coding!
Alex and the team @ Buddy