← All Articles

Review changes before deploying to production - Build. Preview. Deploy.

Kasia HoffmanKasia Hoffman
Oct 11th 22
Features

Review changes before deploying to production - Build. Preview. Deploy.

Whether you have two or two dozen developers working on features for your product, updates can introduce bugs or unwanted changes. Therefore, before merging a feature branch to production, you can review all the changes with our preview deployment feature. It allows you and your team to quickly and easily check that the latest changes work as desired. It also allows you to share feedback and helps prevent “it worked on my machine” scenarios.

How do Preview Deployments work?

When it is enabled Preview Deployments automatically builds and deploys (private) preview versions of your application whenever you commit changes to your repo. This means that the changes are only visible to your team members, specifically those who have the preview deployment URL.

The preview runs in parallel with your active application and helps you to quickly test changes to your code without having to deploy to a separate environment.

The benefits of Preview Deployments

The main benefits are:

  • It’s automated - changes can be automatically pushed to Preview so you can see changes as soon as you commit them to a feature branch.
  • It’s an effortless way to collaborate and review changes with the team. The unique preview URL is easy to access and share, and it's only visible to your team. The preview URL helps to shorten the feedback cycle and, as a result, it helps you deliver your work faster.
  • It allows for quick reviews of front-end development work, and UI and UX implementations.
  • It offers additional support for existing CI/CD implementations. Previews remove one of the biggest hurdles in setting up end-to-end CD pipelines.
  • It adds another layer of security that reduces the chance that buggy code will be merged into production
  • It helps you cut your server bills because there’s no need to deploy or clone your app to a new environment which would use additional servers.

The limitations:

  • Previews only apply to your application's web components. They use the same database(s), and the same environment variables, components, and manifest settings as the base application, which means they are not truly separate instances of your application.
  • It is not available for containerized applications.

How does it work at Cloud 66?

The Preview Deployments feature is available for Rails and Jamstack applications. Preview builds are triggered by changes to your app's git repository. This means that simply pulling new code to your repo automatically updates your preview (depending on your settings).

When enabled, any GitHub PR, git branch, or tag that matches your configuration will be deployed to the same application, but on a different (private) domain accessible only via the preview deployment URL.

Types of the preview deployments:

There are three types of preview deployments available at Cloud 66: new previews can be deployed based on the git branch name, tag name, or pull request. Branches and tags use a glob format. This means that if you set feature* as your branch name, it would create a preview of any branch names starting with the word “feature”.

Databases:

If needed you can use preview deployments to run database migrations. However, please make sure that the database changes are backward-compatible because both your active application and the preview will use the same (newly migrated) database.

How to set up Preview Deployments?

By default Preview Deployments are disabled. However, you can enable them via your Cloud 66 Dashboard. To enable them:

  • Click on the Previews tab in your Application Overview
  • Click the Set Up Previews button
  • Configure the conditions for which Previews will be created (by branch name, tag name or PR)
  • Save your settings

GitHub preview alert:

If you are not using the GitHub integration and want to automate previews for changes committed to GitHub (or another git provider), you will need to add a Cloud 66 webhook URL to your repo’s configuration. This will automatically alert us whenever a new branch or tag is created or pushed.

Monitoring and Managing Previews:

For easy viewing and team collaboration, you can find links to preview deployments on the preview page in Cloud 66 dashboard. The page lists of all the previews currently running on your servers (if you are running multiple previews at the same time). Additionally, you can share the preview URL with the people outside of your team to ask for feedback, and you can delete previews once you have completed your work.

monitoring-and-managing-previews.png

Additionally, Preview Deployments can be managed via the Cloud 66 dashboard or the Cloud 66 Toolbelt (cx). You can list and delete existing previews as needed.


Try Cloud 66 for Free, No credit card required