Auto Shutdown policies

The auto shutdown policies are a great way to eliminate server waste, allowing your Squash deployments to stay active only when you need them, and no more. Below are listed several policies you can use to fit your needs.

Date & Time Policy

Deployments with this policy will automatically terminate at a given date and time.

How to define this policy from the Squash deployment settings page:

Click on the gear icon to change the date/time:

and then use the calendar to pick the date (and time in the "Time" tab) that works best for you:

Squash automatically saves this after you change the value in this field.

From the repository settings page:

Here you will be defining default settings for all new deployments within a given repo. For the example below all deployments will auto-shutdown 1 day (24 hours) after their start date.

Inactivity Policy

The advantage of the inactivity policy is that your deployments will automatically renew for the desired period every time they get used. For example:

  • You have configured your deployments to auto shutdown when inactive for 5 hours
  • You start your deployment at 1pm, by default the auto shutdown time will be 6 pm
  • You use it for the first hour only, in that case Squash will automatically adjust your shutdown time to 7 pm
  • Nobody uses this deployment for 4 hours in a row. However, the deployment gets used again within the last hour, shortly before 7 pm
  • Squash will automatically renew it for another 5 hours, your deployment will only shutdown at midnight.

How to define this policy from the Squash deployment settings page:

Go to the deployment settings page and click on "change expire policy to inactivity" in case this is not the policy being used:

then you should see this:

Click on the "change" link to adjust the expire policy:

Squash automatically saves this after you change the value in this field.

From the repository settings page:

You can also adjust this settings from the repository settings page.

Branch Merge Policy

This policy works on top of the Date&Time and Inactivity policies. When you enable this feature you specify a base branch Squash should watch for.  When the branch associated with a deployment gets merged into this base branch then Squash will automatically shut it down by reducing its expiration time to 30 minutes,  regardless of any time left you might still have on that deployment.

Let's use this example:

  • You have defined a Date&Time policy for a given deployment and it will automatically shut down 10 hours after each deployment's start.
  • You have also enabled the Branch Merge policy for this deployment, and the base branch is "master".
  • The deployment starts at 1pm.
  • Let's say after 2 hours from the deployment's start time the branch associated with this deployment gets merged into master.
  • Squash will automatically adjust its expiration time to 30 min from the time of the merge. The deployment will go down at 3:30pm.

You can also specify this option within the Squash YAML file for greater flexibility. Since you can define multiple apps in the YAML file it gives you the flexibility to add this policy only to certain apps.

How to define this policy from the Squash web interface

You can enable this policy either from the repository settings page or form the deployment settings page.

Repository settings page:

Go to Repository -> Settings and adjust the base branch as needed:

Deployment Settings page:

Click on "Settings":

And then adjust the Base Branch as needed:

User notification

Squash notifies users 30 min before the auto shutdown time with a red bar on top of the deployments. This bar has a "renew" button allowing users to review the deployment for another 2 hours in case it's still being used.

Default policies on a repository level

It's worth noting that each of the policies described above can be enabled by default on a repository level, or branch/deployment specific level.

When you define policies on a repository level, all new deployments for that repo will use this policy. You can still overwrite this on a per deployment/branch basis from the Squash deployment settings page.

To enable policies on a repository level, go to Settings -> Repository:

Then click on "Settings" for the desired repository:

From the repository settings page pick the policies that work best for you: